monit-5.26.0/0000775000175000017500000000000013507751355012655 5ustar martinpmartinpmonit-5.26.0/libmonit/0000775000175000017500000000000013507751355014472 5ustar martinpmartinpmonit-5.26.0/libmonit/configure.ac0000664000175000017500000002740613507751326016767 0ustar martinpmartinp# 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 # --------------------------------------------------------------------------- # Libtool # --------------------------------------------------------------------------- AC_PROG_LIBTOOL # --------------------------------------------------------------------------- # 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" 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_HEADER_STDC AC_CHECK_HEADERS([ctype.h errno.h fcntl.h limits.h pthread.h setjmp.h \ signal.h stdarg.h stdio.h string.h string.h strings.h \ sys/socket.h sys/time.h sys/types.h unistd.h execinfo.h \ sys/sendfile.h sys/dirent.h poll.h sys/poll.h sys/event.h \ stropts.h sys/ioctl.h sys/filio.h kstat.h ifaddrs.h \ net/if_media.h netinet/in.h sys/sysctl.h net/if_dl.h \ sys/random.h sys/protosw.h mach/boolean.h uvm/uvm_param.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([boolean_t], [], [], [ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_MACH_BOOLEAN_H #include #endif #ifdef HAVE_UVM_UVM_PARAM_H #include #endif ]) AC_CHECK_TYPES([uchar_t]) AC_CHECK_TYPES([uint32_t]) # ------------------------------------------------------------------------ # Functions # ------------------------------------------------------------------------ # Require a working setjmp AC_CACHE_CHECK([setjmp is available], [libmonit_cv_setjmp_available], [AC_RUN_IFELSE([AC_LANG_PROGRAM( [[#include ]], [[jmp_buf env; setjmp(env);]])], [AC_MSG_RESULT(yes)], [AC_MSG_FAILURE([setjmp is required])], [AC_MSG_ERROR(cross-compiling: please set 'libmonit_cv_setjmp_available=[yes|no]')])]) # Require that we have vsnprintf that conforms to c99. I.e. does bounds check AC_CACHE_CHECK([vsnprintf is c99 conformant], [libmonit_cv_vsnprintf_c99_conformant], [AC_RUN_IFELSE([AC_LANG_PROGRAM( [[#include #include ]], [[char t[1]; va_list ap; int n = vsnprintf(t, 1, "hello", ap); if(n == 5) return 0;return 1;]])], [AC_MSG_RESULT(yes)], [AC_MSG_FAILURE([vsnprintf does not conform to c99])], [AC_MSG_ERROR(cross-compiling: please set 'libmonit_cv_vsnprintf_c99_conformant=[yes|no]')])]) AC_CHECK_FUNCS([timegm]) # random number generators AC_CHECK_FUNCS([getrandom]) AC_CHECK_FUNCS([arc4random_buf]) # ------------------------------------------------------------------------ # Architecture/OS # ------------------------------------------------------------------------ architecture=`uname` if test "$architecture" = "Linux" then CFLAGS="$CFLAGS -D _REENTRANT" 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 # --------------------------------------------------------------------------- # Compiler characteristics AC_C_CONST AC_C_BIGENDIAN # If the compiler is gcc, tune warnings and make the char type unsigned # and enable C99 support if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -Wall -Wunused -Wno-unused-label -funsigned-char"; # Add C99 support CFLAGS="$CFLAGS -D_GNU_SOURCE -std=c99" # does this compiler support -Wno-pointer-sign ? svd_CFLAGS="$CFLAGS" CFLAGS="-Wno-pointer-sign $CFLAGS" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return 0;])], [], [CFLAGS="$svd_CFLAGS"]) # does this compiler support -Wno-address ? svd_CFLAGS="$CFLAGS" CFLAGS="-Wno-address $CFLAGS" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return 0;])], [], [CFLAGS="$svd_CFLAGS"]) fi # ------------------------------------------------------------------------ # IPv6 Support # ------------------------------------------------------------------------ AC_MSG_CHECKING(for IPv6 support) AC_CACHE_VAL(ac_cv_ipv6, AC_TRY_RUN([ #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.*/ main() { 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 AC_DEFINE([IPV6], 1, [Define to 1 if the system supports IPv6]) fi # --------------------------------------------------------------------------- # Outputs # --------------------------------------------------------------------------- AC_CONFIG_HEADERS(src/xconfig.h) AC_CONFIG_FILES([Makefile test/Makefile]) AC_OUTPUT cat <. # # 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*) 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/*) 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 ) 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 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: monit-5.26.0/libmonit/config/missing0000755000175000017500000001533013507751342017332 0ustar martinpmartinp#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2014 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=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://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 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: monit-5.26.0/libmonit/config/config.sub0000755000175000017500000010645013507751342017722 0ustar martinpmartinp#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-02-22' # 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/gitweb/?p=config.git;a=blob_plain;f=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. 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-2018 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" 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 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo "$1" | sed 's/-[^-]*$//'` if [ "$basic_machine" != "$1" ] then os=`echo "$1" | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -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*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | wasm32 \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-pc os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; asmjs) basic_machine=asmjs-unknown ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2*) basic_machine=m68k-bull os=-sysv3 ;; e500v[12]) basic_machine=powerpc-unknown os=$os"spe" ;; e500v[12]-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=$os"spe" ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; nsv-tandem) basic_machine=nsv-tandem ;; nsx-tandem) basic_machine=nsx-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh5el) basic_machine=sh5le-unknown ;; simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; x64) basic_machine=x86_64-pc ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; none) basic_machine=none-none os=-none ;; # 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) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases that might get confused # with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) -es1800*) os=-ose ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ | -midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -xray | -os68k* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4*) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $basic_machine in arm*) os=-eabi ;; *) os=-elf ;; esac ;; -nacl*) ;; -ios) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; pru-*) os=-elf ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $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 ;; -mvs* | -opened*) vendor=ibm ;; -os400*) 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 basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac echo "$basic_machine$os" exit # Local variables: # eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: monit-5.26.0/libmonit/config/install-sh0000755000175000017500000003546313507751342017750 0ustar martinpmartinp#!/bin/sh # install - install a program, script, or datafile scriptversion=2014-09-12.12; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) # $RANDOM is not portable (e.g. dash); use it when possible to # lower collision chance tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 # As "mkdir -p" follows symlinks and we work in /tmp possibly; so # create the $tmpdir first (and fail if unsuccessful) to make sure # that nobody tries to guess the $tmpdir name. 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;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: monit-5.26.0/libmonit/config/config.guess0000755000175000017500000012637313507751342020265 0ustar martinpmartinp#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-02-24' # 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/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . 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-2018 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 trap 'exit 1' 1 2 15 # 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. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > "$dummy.c" ; for c in cc gcc c89 c99 ; do if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; 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 ; set_cc_for_build= ;' # 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) >/dev/null 2>&1 ; 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/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval "$set_cc_for_build" cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl 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". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in 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) eval "$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. echo "$machine-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) 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. echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval "$set_cc_for_build" SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; 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'. echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; 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) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # 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:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval "$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; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval "$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 echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/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 echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 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 [ -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 [ "$HP_ARCH" = "" ]; then eval "$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 [ "$HP_ARCH" = hppa2.0w ] then eval "$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 echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) eval "$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; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; 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*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; 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:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; i*86:Minix:*:*) echo "$UNAME_MACHINE"-pc-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` 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 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) eval "$set_cc_for_build" if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) if objdump -f /bin/sh | grep -q elf32-x86-64; then echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32 else echo "$UNAME_MACHINE"-pc-linux-"$LIBC" fi exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; 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 echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" exit ;; 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 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming 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. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; 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*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval "$set_cc_for_build" if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # 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 fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *: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 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; esac 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 </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 exit 1 # Local variables: # eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: monit-5.26.0/libmonit/config/ltmain.sh0000644000175000017500000117147413507751340017566 0ustar martinpmartinp#! /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-2" 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='eval 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=2014-01-07.03; # 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 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 eval $_G_hook '"$@"' # 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 done func_quote_for_eval ${1+"$@"} func_run_hooks_result=$func_quote_for_eval_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, remove any # options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # func_quote_for_eval ${1+"$@"} # my_options_prep_result=$func_quote_for_eval_result # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # # 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=: ;; # # 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 # ;; # *) set dummy "$_G_opt" "$*"; shift; break ;; # esac # done # # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # } # 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." # # func_quote_for_eval ${1+"$@"} # my_option_validation_result=$func_quote_for_eval_result # } # func_add_hook func_validate_options my_option_validation # # You'll alse 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 [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd func_options_prep ${1+"$@"} eval func_parse_options \ ${func_options_prep_result+"$func_options_prep_result"} eval func_validate_options \ ${func_parse_options_result+"$func_parse_options_result"} eval func_run_hooks func_options \ ${func_validate_options_result+"$func_validate_options_result"} # save modified positional parameters for caller func_options_result=$func_run_hooks_result } # 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 propogate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning. func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= # 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. func_run_hooks func_parse_options ${1+"$@"} # Adjust func_parse_options positional parameters to match eval set dummy "$func_run_hooks_result"; shift # Break out of the loop if we already parsed every option. test $# -gt 0 || break _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) test $# = 0 && func_missing_arg $_G_opt && break 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 ;; --) break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result } # 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 # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result } ## ----------------- ## ## 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-2 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= # 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 ;; esac # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _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; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result } 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 -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=*) 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.26.0/libmonit/COPYING0000664000175000017500000010417413507751326015532 0ustar martinpmartinp GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. 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.26.0/libmonit/Makefile.in0000664000175000017500000007705713507751342016553 0ustar martinpmartinp# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2017 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)/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/statistics/Statistics.lo src/system/Mem.lo \ src/system/Net.lo src/system/Time.lo src/system/Command.lo \ src/system/System.lo src/system/Link.lo src/util/List.lo \ src/util/Str.lo src/util/Fmt.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__depfiles_maybe = 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 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)` ETAGS = etags CTAGS = ctags CSCOPE = cscope 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 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ 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_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/statistics -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/statistics/Statistics.c \ src/system/Mem.c \ src/system/Net.c \ src/system/Time.c \ src/system/Command.c \ src/system/System.c \ src/system/Link.c \ src/util/List.c \ src/util/Str.c \ src/util/Fmt.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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ 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/statistics/$(am__dirstamp): @$(MKDIR_P) src/statistics @: > src/statistics/$(am__dirstamp) src/statistics/Statistics.lo: src/statistics/$(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/Time.lo: src/system/$(am__dirstamp) src/system/Command.lo: src/system/$(am__dirstamp) src/system/System.lo: src/system/$(am__dirstamp) src/system/Link.lo: src/system/$(am__dirstamp) src/util/$(am__dirstamp): @$(MKDIR_P) src/util @: > src/util/$(am__dirstamp) src/util/List.lo: src/util/$(am__dirstamp) src/util/Str.lo: src/util/$(am__dirstamp) src/util/Fmt.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/statistics/*.$(OBJEXT) -rm -f src/statistics/*.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/statistics/.libs src/statistics/_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: $(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-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 ;;\ 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) dvi \ && $(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/statistics/$(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 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 -rm -f Makefile.in test/Makefile.in src/Makefile.in configure aclocal.m4 src/xconfig.h.in -rm -rf m4 config 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.26.0/libmonit/README0000664000175000017500000000037113507751326015351 0ustar martinpmartinp libmonit This library synthesis modules used by Monit (http://mmonit.com/monit/) into a static library. Libmonit is built as part of Monit and is not meant to be installed nor distributed. PLEASE DO NOT DISTRIBUTE LIBMONIT AS A SEPARATE LIBRARY. monit-5.26.0/libmonit/test/0000775000175000017500000000000013507751354015450 5ustar martinpmartinpmonit-5.26.0/libmonit/test/OutputStreamTest.c0000664000175000017500000001447613507751326021143 0ustar martinpmartinp#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_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, "%c", 'h') == 1); assert(OutputStream_print(out, "%d", 12345) == 5); assert(OutputStream_print(out, "%i", -12345) == 6); assert(OutputStream_print(out, "%u", 12345) == 5); assert(OutputStream_print(out, "%o", 8) == 2); //10 assert(OutputStream_print(out, "%x", 255) == 2); //ff assert(OutputStream_print(out, "%e", 12.34) == 12); //1.234000e+01 assert(OutputStream_print(out, "%f", -12.34) == 10); //-12.340000 assert(OutputStream_print(out, "%g", 12.34) == 6); //012.34 OutputStream_print(out, "%p", out); assert(OutputStream_print(out, "%%hello%%") == 7); // Length modifier assert(OutputStream_print(out, "%ld", 32767L) == 5); assert(OutputStream_print(out, "%li", -32767L) == 6); assert(OutputStream_print(out, "%lu", 32767L) == 5); assert(OutputStream_print(out, "%lo", 32767L) == 5); //77777 assert(OutputStream_print(out, "%lx", 32767L) == 4); //7fff // Test width and precision assert(OutputStream_print(out, "%16.16s\n%16.16s\n", "hello", "world") == 34); assert(OutputStream_print(out, "%-16.16s\n%-16.16s\n", "hello", "world") == 34); assert(OutputStream_print(out, "%.2f", 12.3456789) == 5); //12.35 assert(OutputStream_print(out, "%02d", 3) == 2); // 03 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.26.0/libmonit/test/Makefile0000664000175000017500000005435213507751354017121 0ustar martinpmartinp# Makefile.in generated by automake 1.15.1 from Makefile.am. # test/Makefile. Generated from Makefile.in by configure. # Copyright (C) 1994-2017 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) ListTest$(EXEEXT) DirTest$(EXEEXT) \ StringBufferTest$(EXEEXT) InputStreamTest$(EXEEXT) \ OutputStreamTest$(EXEEXT) FileTest$(EXEEXT) \ ExceptionTest$(EXEEXT) NetTest$(EXEEXT) LinkTest$(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)/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_CommandTest_OBJECTS = CommandTest.$(OBJEXT) CommandTest_OBJECTS = $(am_CommandTest_OBJECTS) CommandTest_LDADD = $(LDADD) CommandTest_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_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_LinkTest_OBJECTS = LinkTest.$(OBJEXT) LinkTest_OBJECTS = $(am_LinkTest_OBJECTS) LinkTest_LDADD = $(LDADD) LinkTest_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_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__depfiles_maybe = 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 = $(CommandTest_SOURCES) $(DirTest_SOURCES) \ $(ExceptionTest_SOURCES) $(FileTest_SOURCES) \ $(FmtTest_SOURCES) $(InputStreamTest_SOURCES) \ $(LinkTest_SOURCES) $(ListTest_SOURCES) $(NetTest_SOURCES) \ $(OutputStreamTest_SOURCES) $(StrTest_SOURCES) \ $(StringBufferTest_SOURCES) $(SystemTest_SOURCES) \ $(TimeTest_SOURCES) DIST_SOURCES = $(CommandTest_SOURCES) $(DirTest_SOURCES) \ $(ExceptionTest_SOURCES) $(FileTest_SOURCES) \ $(FmtTest_SOURCES) $(InputStreamTest_SOURCES) \ $(LinkTest_SOURCES) $(ListTest_SOURCES) $(NetTest_SOURCES) \ $(OutputStreamTest_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)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = ${SHELL} /tmp/monit/libmonit/config/missing aclocal-1.15 AMTAR = $${TAR-tar} AM_DEFAULT_VERBOSITY = 1 AR = ar AUTOCONF = ${SHELL} /tmp/monit/libmonit/config/missing autoconf AUTOHEADER = ${SHELL} /tmp/monit/libmonit/config/missing autoheader AUTOMAKE = ${SHELL} /tmp/monit/libmonit/config/missing automake-1.15 AWK = gawk CC = gcc CCDEPMODE = depmode=none CFLAGS = -Wno-address -Wno-pointer-sign -g -O2 -D _REENTRANT -Wall -Wunused -Wno-unused-label -funsigned-char -D_GNU_SOURCE -std=c99 CPP = gcc -E CPPFLAGS = CYGPATH_W = echo DEFS = -DHAVE_CONFIG_H DEPDIR = .deps DLLTOOL = false DSYMUTIL = DUMPBIN = ECHO_C = ECHO_N = -n ECHO_T = EGREP = /bin/grep -E EXEEXT = FGREP = /bin/grep -F GREP = /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 = LIBOBJS = LIBS = -lm -lpthread -lz LIBTOOL = $(SHELL) $(top_builddir)/libtool LIPO = LN_S = ln -s LTLIBOBJS = LT_SYS_LIBRARY_PATH = MAKEINFO = ${SHELL} /tmp/monit/libmonit/config/missing makeinfo MANIFEST_TOOL = : MKDIR_P = /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 = /bin/sed SET_MAKE = SHELL = /bin/bash STRIP = strip UNIT_TEST = test VERSION = 1.0 abs_builddir = /tmp/monit/libmonit/test abs_srcdir = /tmp/monit/libmonit/test abs_top_builddir = /tmp/monit/libmonit abs_top_srcdir = /tmp/monit/libmonit ac_ct_AR = ar ac_ct_CC = gcc 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} /tmp/monit/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/statistics -I../src/thread StrTest_SOURCES = StrTest.c FmtTest_SOURCES = FmtTest.c CommandTest_SOURCES = CommandTest.c SystemTest_SOURCES = SystemTest.c ListTest_SOURCES = ListTest.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 LinkTest_SOURCES = LinkTest.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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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 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) LinkTest$(EXEEXT): $(LinkTest_OBJECTS) $(LinkTest_DEPENDENCIES) $(EXTRA_LinkTest_DEPENDENCIES) @rm -f LinkTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(LinkTest_OBJECTS) $(LinkTest_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) 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: $(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-local 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-local 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 distclean-local: -rm -f Makefile.in 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.26.0/libmonit/test/InputStreamTest.c0000664000175000017500000001172613507751326020735 0ustar martinpmartinp#include "Config.h" #include #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); 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) { int n = 0; char array[2][STRLEN + 1]; in = InputStream_new(fd); for (int i = 0; ((n = 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); 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("============> InputStream Tests: OK\n\n"); return 0; } monit-5.26.0/libmonit/test/Makefile.am0000664000175000017500000000224713507751326017510 0ustar martinpmartinpAUTOMAKE_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/statistics -I../src/thread noinst_PROGRAMS = StrTest \ FmtTest \ SystemTest \ ListTest \ DirTest \ StringBufferTest \ InputStreamTest \ OutputStreamTest \ FileTest \ ExceptionTest \ NetTest \ LinkTest \ TimeTest \ CommandTest StrTest_SOURCES = StrTest.c FmtTest_SOURCES = FmtTest.c CommandTest_SOURCES = CommandTest.c SystemTest_SOURCES = SystemTest.c ListTest_SOURCES = ListTest.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 LinkTest_SOURCES = LinkTest.c TimeTest_SOURCES = TimeTest.c DISTCLEANFILES = *~ distclean-local: -rm -f Makefile.in verify: @/bin/sh ./test.sh monit-5.26.0/libmonit/test/ExceptionTest.c0000664000175000017500000002474713507751326020427 0ustar martinpmartinp#include "Config.h" #include #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"}; void throwA() { THROW(A, NULL); } void throwB() { THROW(B, NULL); } void throwC() { THROW(C, "A cause"); } void throwD() { THROW(D, "A cause"); } void indirectA() { throwA(); } /* Throw and catch exceptions and check that we got the expected exception. * If the exception stack is corrupt somehow this should be detected */ void *thread(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 Exeption 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"); { 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 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("============> Exception Tests: OK\n\n"); return 0; } monit-5.26.0/libmonit/test/FileTest.c0000664000175000017500000001343013507751326017333 0ustar martinpmartinp#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); } 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_ctime(path)) > 0); printf("\tchange time: %ld\n", j); assert(j == s.st_ctime); assert((j = File_atime(path)) > 0); printf("\taccess time: %ld\n", j); assert(j == s.st_atime); assert((k = File_size(path)) >= 0); printf("\tsize: %lld B\n", k); assert(k == s.st_size); assert((c = File_isFile(path)) == true); assert((c = File_type(path)) == 'r'); printf("\ttype: regular file\n"); assert((File_exist(path)) == true); printf("\texist: yes\n"); assert((i = File_mod(path)) > 0); printf("\tpermission mode: %o\n", i & 07777); assert(i == s.st_mode); assert(File_chmod(path, 00640) == true); assert((File_mod(path) & 07777) == 00640); assert(File_isReadable(path) == true); assert(File_isWritable(path) == true); #if defined(SOLARIS) || defined (FREEBSD) || defined (AIX) || defined(DRAGONFLY) /* Some systems like Solaris and FreeBSD 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); } printf("=> Test2: OK\n\n"); printf("=> Test3: check directory\n"); { assert(File_isDirectory("/") == true); 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(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")); 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_getRealPath("/././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("============> File Tests: OK\n\n"); return 0; } monit-5.26.0/libmonit/test/ListTest.c0000664000175000017500000002066213507751326017374 0ustar martinpmartinp#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); } 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.26.0/libmonit/test/Makefile.in0000664000175000017500000005400213507751342017513 0ustar martinpmartinp# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2017 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) ListTest$(EXEEXT) DirTest$(EXEEXT) \ StringBufferTest$(EXEEXT) InputStreamTest$(EXEEXT) \ OutputStreamTest$(EXEEXT) FileTest$(EXEEXT) \ ExceptionTest$(EXEEXT) NetTest$(EXEEXT) LinkTest$(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)/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_CommandTest_OBJECTS = CommandTest.$(OBJEXT) CommandTest_OBJECTS = $(am_CommandTest_OBJECTS) CommandTest_LDADD = $(LDADD) CommandTest_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_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_LinkTest_OBJECTS = LinkTest.$(OBJEXT) LinkTest_OBJECTS = $(am_LinkTest_OBJECTS) LinkTest_LDADD = $(LDADD) LinkTest_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_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__depfiles_maybe = 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 = $(CommandTest_SOURCES) $(DirTest_SOURCES) \ $(ExceptionTest_SOURCES) $(FileTest_SOURCES) \ $(FmtTest_SOURCES) $(InputStreamTest_SOURCES) \ $(LinkTest_SOURCES) $(ListTest_SOURCES) $(NetTest_SOURCES) \ $(OutputStreamTest_SOURCES) $(StrTest_SOURCES) \ $(StringBufferTest_SOURCES) $(SystemTest_SOURCES) \ $(TimeTest_SOURCES) DIST_SOURCES = $(CommandTest_SOURCES) $(DirTest_SOURCES) \ $(ExceptionTest_SOURCES) $(FileTest_SOURCES) \ $(FmtTest_SOURCES) $(InputStreamTest_SOURCES) \ $(LinkTest_SOURCES) $(ListTest_SOURCES) $(NetTest_SOURCES) \ $(OutputStreamTest_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)` ETAGS = etags CTAGS = ctags 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ 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_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/statistics -I../src/thread StrTest_SOURCES = StrTest.c FmtTest_SOURCES = FmtTest.c CommandTest_SOURCES = CommandTest.c SystemTest_SOURCES = SystemTest.c ListTest_SOURCES = ListTest.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 LinkTest_SOURCES = LinkTest.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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 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 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) LinkTest$(EXEEXT): $(LinkTest_OBJECTS) $(LinkTest_DEPENDENCIES) $(EXTRA_LinkTest_DEPENDENCIES) @rm -f LinkTest$(EXEEXT) $(AM_V_CCLD)$(LINK) $(LinkTest_OBJECTS) $(LinkTest_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) 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: $(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-local 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-local 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 distclean-local: -rm -f Makefile.in 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.26.0/libmonit/test/FmtTest.c0000664000175000017500000000476613507751326017216 0ustar martinpmartinp#include "Config.h" #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "Fmt.h" /** * Str.c unity tests */ int main(void) { Bootstrap(); // Need to initialize library printf("============> Start Ftm 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(9083741824987653, str); assert(Str_isEqual(str, "8.1 PB")); Fmt_bytes2str(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.26.0/libmonit/test/TimeTest.c0000664000175000017500000002615613507751326017363 0ustar martinpmartinp#include "Config.h" #include #include #include #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "system/Time.h" /** * Time.c unity tests. */ int main(void) { setenv("TZ", "CET", 1); tzset(); Bootstrap(); // Need to initialize library printf("============> Start Time Tests\n\n"); printf("=> Test1: check string ouput\n"); { char result[STRLEN]; Time_string(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_gmtstring(1267441200, result); /* 01 Mar 2010 12: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 12: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 } 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 1s\n"); { time_t now; now = Time_now(); Time_usleep(1000000); assert((now + 1) == Time_now()); } 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 = 730251059; // Sun, 21. Feb 1993 00:30:59 printf("\tResult: %s (winter time)\n", Time_string(time, b)); assert(Time_seconds(time) == 59); assert(Time_minutes(time) == 30); assert(Time_hour(time) == 0); assert(Time_weekday(time) == 0); assert(Time_day(time) == 21); assert(Time_month(time) == 2); assert(Time_year(time) == 1993); time = 1253045894; // Tue, 15 Sep 2009 22:18:14 +0200 printf("\tResult: %s (DTS/summer time)\n", Time_string(time, b)); assert(Str_startsWith(b, "Tue, 15 Sep 2009 22:18:14")); } printf("=> Test5: OK\n\n"); printf("=> Test6: Time_build\n"); { time_t time = Time_build(2001, 1, 29, 12, 0, 0); assert(Time_seconds(time) == 0); assert(Time_minutes(time) == 0); assert(Time_hour(time) == 12); assert(Time_day(time) == 29); assert(Time_month(time) == 1); assert(Time_year(time) == 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"); { 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); // 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); // 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); // Invalid date TRY { Time_toDateTime("1901-123-45", &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); // Invalid timestamp string TRY { Time_toTimestamp("1901-123-45 10:12:14"); // 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; } printf("=> Test9: OK\n\n"); printf("============> Time Tests: OK\n\n"); return 0; } monit-5.26.0/libmonit/test/LinkTest.c0000664000175000017500000000103113507751326017343 0ustar martinpmartinp#include "Config.h" #include #include #include #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "system/Time.h" #include "Thread.h" #include "system/Link.h" #include "File.h" /** * Link unit tests. */ int main(int argc, char **argv) { Bootstrap(); // Need to initialize library printf("============> Start Link Tests\n\n"); printf("============> Link Tests: OK\n\n"); return 0; } monit-5.26.0/libmonit/test/DirTest.c0000664000175000017500000000401613507751326017172 0ustar martinpmartinp#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); } 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")); } 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); } 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"); } printf("=> Test4: OK\n\n"); printf("============> Dir Tests: OK\n\n"); return 0; } monit-5.26.0/libmonit/test/data/0000775000175000017500000000000013507751326016360 5ustar martinpmartinpmonit-5.26.0/libmonit/test/data/stream.data0000664000175000017500000000002213507751326020500 0ustar martinpmartinpline1 line2 line3 monit-5.26.0/libmonit/test/StrTest.c0000664000175000017500000004412113507751326017225 0ustar martinpmartinp#include "Config.h" #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)); } 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 e[] = " "; char o[] = " 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(e), "")); memcpy(e, " ", sizeof(" ") - 1); assert(Str_isEqual(Str_rtrim(e), "")); memcpy(e, " ", sizeof(" ") - 1); assert(Str_isEqual(Str_trim(e), "")); assert(Str_isEqual(Str_ltrim(o), "a ")); memcpy(o, " a ", sizeof(" a ") - 1); assert(Str_isEqual(Str_rtrim(o), " a")); memcpy(o, " a ", sizeof(" a ") - 1); assert(Str_isEqual(Str_trim(o), "a")); assert(Str_isEqual(Str_trim(o), "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"; printf("\tResult:\n"); printf("\tParsed int = %d\n", Str_parseInt(i)); assert(Str_parseInt(i)==-2812); printf("\tParsed long long = %lld\n", Str_parseLLong(ll)); assert(Str_parseLLong(ll)==2147483642); 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 Str_parseInt(ie); assert(false); CATCH(NumberFormatException) printf("=> Test11: OK\n\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"; // 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)); } 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_compareConstantTime\n"); { assert(Str_compareConstantTime(NULL, NULL) == 0); assert(Str_compareConstantTime("abcdef", NULL) != 0); assert(Str_compareConstantTime(NULL, "abcdef") != 0); assert(Str_compareConstantTime("abcdef", "abcdef") == 0); assert(Str_compareConstantTime("abcdef", "ABCDEF") != 0); assert(Str_compareConstantTime("abcdef", "abc") != 0); assert(Str_compareConstantTime("abcdef", "abcdefghi") != 0); // Test maximum length unsigned char ok[] = "1111111111111111111111111111111111111111111111111111111111111111"; // 64 characters currently assert(Str_compareConstantTime(ok, ok) == 0); // Test maximum length + 1 unsigned char ko[] = "11111111111111111111111111111111111111111111111111111111111111111"; // 65 characters should fail assert(Str_compareConstantTime(ko, ko) != 0); } printf("=> Test24: OK\n\n"); printf("============> Str Tests: OK\n\n"); return 0; } monit-5.26.0/libmonit/test/SystemTest.c0000664000175000017500000000452413507751326017744 0ustar martinpmartinp#include "Config.h" #include #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. */ 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_getLastError(), error)); } printf("=> Test0: OK\n\n"); printf("=> Test1: check filedescriptors wrapper\n"); { assert(System_getDescriptorsGuarded() <= 2<<15); } printf("=> Test1: OK\n\n"); printf("=> Test2: random data generator\n"); { srandom((unsigned)(Time_now() + getpid())); // printf("\tnumber: %"PRIx64"\n", System_randomNumber()); // printf("\t1 byte: "); char buf0[1]; assert(System_random(buf0, sizeof(buf0))); for (int i = 0; i < sizeof(buf0); i++) { printf("%x", buf0[i]); } printf("\n"); // printf("\t4 bytes: "); char buf1[4]; assert(System_random(buf1, sizeof(buf1))); for (int i = 0; i < sizeof(buf1); i++) { printf("%x", buf1[i]); } printf("\n"); // printf("\t16 bytes: "); char buf2[16]; assert(System_random(buf2, sizeof(buf2))); for (int i = 0; i < sizeof(buf2); i++) { printf("%x", buf2[i]); } printf("\n"); // assert(System_randomNumber() != System_randomNumber()); } printf("=> Test1: OK\n\n"); printf("============> System Tests: OK\n\n"); return 0; } monit-5.26.0/libmonit/test/CommandTest.c0000664000175000017500000002430413507751326020034 0ustar martinpmartinp#include "Config.h" #include #include #include #include #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "List.h" #include "system/System.h" #include "system/Command.h" #include "system/Time.h" /** * Command.c unit tests. */ boolean_t timeout_called = false; static void onExec(Process_T P) { assert(P); char buf[STRLEN]; // Child process info printf("\tSubprocess ((pid=%d) created with cwd (%s)\n", Process_getPid(P), Process_getDir(P)); InputStream_T in = Process_getInputStream(P); OutputStream_T out = Process_getOutputStream(P); InputStream_T err = Process_getErrorStream(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", 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); } Process_free(&P); assert(! P); } static void onTerminate(Process_T P) { assert(P); printf("\tTest terminate subprocess ((pid=%d)\n", Process_getPid(P)); assert(Process_isRunning(P)); Process_terminate(P); printf("\tWaiting on process to terminate.. "); fflush(stdout); printf("Process exited with status: %d\n", Process_waitFor(P)); Process_free(&P); assert(! P); } static void onKill(Process_T P) { assert(P); printf("\tTest kill subprocess ((pid=%d)\n", Process_getPid(P)); assert(Process_isRunning(P)); Process_kill(P); printf("\tWaiting on process to exit.. "); printf("Process exited with status: %d\n", Process_waitFor(P)); Process_free(&P); assert(! P); } static void onEnv(Process_T P) { assert(P); char buf[STRLEN]; InputStream_T in = Process_getInputStream(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); } 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", NULL); assert(c); Command_free(&c); assert(!c); } printf("=> Test1: OK\n\n"); printf("=> Test2: set and get uid/gid/umask\n"); { Command_T c = Command_new("/bin/sh", "-c", "ps -aef|grep monit", NULL); assert(c); // Check that default is 0 assert(Command_getUid(c) == 0); assert(Command_getGid(c) == 0); // set and test uid and gid Command_setUid(c,42); assert(Command_getUid(c) == 42); Command_setGid(c,148); assert(Command_getGid(c) == 148); Command_free(&c); assert(!c); } printf("=> Test2: OK\n\n"); printf("=> Test3: set and get working directory\n"); { Command_T c = Command_new("/bin/sh", "-c", "ps -aef|grep monit", NULL); assert(c); // Check that a default working directory is NULL. I.e. current directory assert(! Command_getDir(c)); // Check that a NULL working directory is allowed, meaning the calling process's current directory Command_setDir(c, NULL); // Set and get Command_setDir(c, "/tmp/"); assert(Str_isEqual(Command_getDir(c), "/tmp")); // trailing separator is removed upon set // Check invalid value TRY { Command_setDir(c, "/hubba/bubba"); printf("Test failed\n"); exit(1); } ELSE { assert(Str_isEqual(Command_getDir(c), "/tmp")); } END_TRY; Command_free(&c); assert(!c); } printf("=> Test3: OK\n\n"); printf("=> Test4: set and get env\n"); { Command_T c = Command_new("/bin/sh", "-c", "ps -aef|grep monit", NULL); assert(c); // 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_getEnv(c, "PATH"), "/usr/bin")); assert(Str_isEqual(Command_getEnv(c, "SHELL"), "/bin/bash")); assert(Str_isEqual(Command_getEnv(c, "PAT"), "Carroll")); // Empty and NULL value Command_setEnv(c, "PATH", ""); Command_setEnv(c, "SHELL", NULL); assert(Str_isEqual(Command_getEnv(c, "PATH"), "")); assert(Str_isEqual(Command_getEnv(c, "SHELL"), "")); // Unknown variable should result in NULL assert(Command_getEnv(c, "UKNOWNVARIABLE") == NULL); // vSetEnv Command_vSetEnv(c, "PID", "%ld", (long)getpid()); assert(Str_parseLLong(Command_getEnv(c, "PID")) > 1); Command_vSetEnv(c, "ZERO", NULL); assert(Str_isEqual(Command_getEnv(c, "ZERO"), "")); Command_free(&c); assert(!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", NULL); assert(c); List_T l = Command_getCommand(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); assert(!c); } printf("=> Test5: OK\n\n"); printf("=> Test6: Append arguments\n"); { Command_T c = Command_new("/bin/ls", NULL); assert(c); Command_appendArgument(c, "-l"); Command_appendArgument(c, "-t"); Command_appendArgument(c, "-r"); List_T l = Command_getCommand(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); assert(!c); } printf("=> Test6: OK\n\n"); printf("=> Test7: execute invalid program\n"); { // Program producing error Command_T c = Command_new("/bin/sh", "-c", "baluba;", NULL); assert(c); Command_setDir(c, "/"); printf("\tThis should produce an error:\n"); onExec(Command_execute(c)); Command_free(&c); assert(!c); } 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\";", NULL); assert(c); onExec(Command_execute(c)); Command_free(&c); assert(!c); } printf("=> Test8: OK\n\n"); printf("=> Test9: terminate sub-process\n"); { Command_T c = Command_new("/bin/sh", "-c", "exec sleep 30;", NULL); assert(c); onTerminate(Command_execute(c)); Command_free(&c); assert(!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; ", NULL); assert(c); onKill(Command_execute(c)); Command_free(&c); assert(!c); } printf("=> Test10: OK\n\n"); printf("=> Test11: environment in sub-process\n"); { Command_T c = Command_new("/bin/sh", "-c", "echo $SULT", NULL); assert(c); // Set environment in sub-process only Command_setEnv(c, "SULT", "Ylajali"); onEnv(Command_execute(c)); Command_free(&c); assert(!c); } printf("=> Test11: OK\n\n"); #if ! defined(OPENBSD) && ! defined(AIX) /* FIXME: MONIT-35: OpenBSD and AIX vfork() doesn't share memory, so the current implementation of Command_execute() cannot pass the execve() error to parent. Disable the unit test on OpenBSD and AIX for now. */ printf("=> Test12: on execute error\n"); { // Try executing a directory should produce an error Command_T c = Command_new("/tmp", NULL); assert(c); Process_T p = Command_execute(c); assert(! p); Command_free(&c); printf("\tOK, got execute error -- %s\n", System_getLastError()); assert(!c); } printf("=> Test12: OK\n\n"); #endif printf("============> Command Tests: OK\n\n"); return 0; } monit-5.26.0/libmonit/test/NetTest.c0000664000175000017500000000103113507751326017174 0ustar martinpmartinp#include "Config.h" #include #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(int argc, char **argv) { Bootstrap(); // Need to initialize library printf("============> Start Net Tests\n\n"); printf("============> Net Tests: OK\n\n"); return 0; } monit-5.26.0/libmonit/test/test.sh0000775000175000017500000000040313507751326016762 0ustar martinpmartinp#!/bin/sh PATH="$PATH:." export PATH StrTest && \ FmtTest && \ TimeTest && \ SystemTest && \ ListTest && \ LinkTest && \ StringBufferTest && \ DirTest && \ InputStreamTest && \ OutputStreamTest && \ FileTest && \ ExceptionTest && \ NetTest && \ CommandTest monit-5.26.0/libmonit/test/StringBufferTest.c0000664000175000017500000004610313507751326021057 0ustar martinpmartinp#include "Config.h" #include #include #include #include #include #include "Bootstrap.h" #include "Str.h" #include "StringBuffer.h" /** * StringBuffer.c unity tests. */ 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); } 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); 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")); 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 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 void *compressed = StringBuffer_toCompressed(sb, 6, &compressedLength); assert(compressed); assert(compressedLength == 46); for (int 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] == *(unsigned char *)(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 void *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 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 void *compressed = StringBuffer_toCompressed(sb, 6, &compressedLength); assert(compressed); assert(compressedLength == 46); for (int 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] == *(unsigned char *)(compressed + i)); } } ////////////////////////////////////////////////////////////////////////////// printf("\tStage 2: clear content + compress\n"); const char *input2 = "" "" "" "" ""; const 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 (int 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] == *(unsigned char *)(compressed + i)); } } ////////////////////////////////////////////////////////////////////////////// printf("\tStage 3: append content + compress\n"); const char *input3 = ""; const 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 (int 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] == *(unsigned char *)(compressed + i)); } } ////////////////////////////////////////////////////////////////////////////// StringBuffer_free(&sb); assert(sb == NULL); } printf("=> Test15: OK\n\n"); #endif printf("============> StringBuffer Tests: OK\n\n"); return 0; } monit-5.26.0/libmonit/bootstrap0000775000175000017500000000066613507751326016443 0ustar martinpmartinp#!/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.26.0/libmonit/src/0000775000175000017500000000000013507751355015261 5ustar martinpmartinpmonit-5.26.0/libmonit/src/util/0000775000175000017500000000000013507751326016234 5ustar martinpmartinpmonit-5.26.0/libmonit/src/util/StringBuffer.h0000664000175000017500000001646013507751326021014 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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); /** * Replace all occurences 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 occurence 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 occurence 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.26.0/libmonit/src/util/Fmt.c0000664000175000017500000000525113507751326017131 0ustar martinpmartinp/* * 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-6; static boolean_t _isInt(double x) { return fabs(x - round(x)) < epsilon; } /* -------------------------------------------------------- Public Methods */ char *Fmt_bytes2str(double bytes, char s[static 10]) { assert(s); static const char *kNotation[] = {"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", NULL}; *s = 0; char *sign = (bytes < 0) ? "-" : ""; bytes = fabs(bytes); assert(bytes < 1e+24); for (int i = 0; kNotation[i]; i++) { if (bytes >= 1024) { bytes /= 1024; } else { snprintf(s, 10, _isInt(bytes) ? "%s%.0lf %s" : "%s%.1lf %s", sign, bytes, kNotation[i]); break; } } return s; } char *Fmt_time2str(double milli, char s[static 11]) { assert(s); struct conversion { double base; char *suffix; } conversion[] = { {1000, "ms"}, // millisecond {60, "s"}, // second {60, "m"}, // minute {24, "h"}, // hour {365, "d"}, // day {999, "y"} // year }; *s = 0; char *sign = (milli < 0) ? "-" : ""; milli = fabs(milli); assert(milli < 3.14e+12); // -99.569 y for (int i = 0; i < (sizeof(conversion) / sizeof(conversion[0])); i++) { if (milli >= conversion[i].base) { milli /= conversion[i].base; } else { snprintf(s, 11, _isInt(milli) ? "%s%.0lf %s" : "%s%.3lf %s", sign, milli, conversion[i].suffix); break; } } return s; } monit-5.26.0/libmonit/src/util/StringBuffer.c0000664000175000017500000002167313507751326021011 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ /* ------------------------------------------------------------ Definitions */ #define T StringBuffer_T struct T { int used; int length; unsigned char *buffer; void *compressedBuffer; }; /* ---------------------------------------------------------------- Private */ 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 = ALLOC(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 >= 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.26.0/libmonit/src/util/Str.h0000664000175000017500000003270513507751326017164 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ /** * Maximum length of input for Str_compareConstantTime() method. We support * currently up to 64 characters, which is enough for SHA256 digests. */ #define MAX_CONSTANT_TIME_STRING_LENGTH 64 /** * 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)) /** * 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); /** * 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 int 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 */ int 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 */ int 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 */ int 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 */ int 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 */ int 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__, 0) /** Copy n bytes from a variable number of strings. @see Str_join() */ char *_Str_join(char *dest, int n, ...); /** * Creates a new String by merging a formated 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 formated 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 concating s and va_list or NULL on error * @exception MemoryException if memory allocation fails */ char *Str_vcat(const char *s, va_list ap); /** * 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, 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
 */
int 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 agains pattern * @return true if subject match pattern, otherwise false * @exception AssertException if pattern is invalid or cannot be * compiled. */ int 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 */ unsigned 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 case sensitive two strings in constant time. This function * can be used for timing-attack resistent comparison of credentials. * @param x A String * @param y A String * @return 0 if x and y are equal otherwise a non-zero integer */ int Str_compareConstantTime(const void *x, const void *y); #endif monit-5.26.0/libmonit/src/util/Fmt.h0000664000175000017500000000347413507751326017143 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ /** * Convert 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 10 chars * @return A pointer to s */ char *Fmt_bytes2str(double bytes, char s[static 10]); /** * Convert 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 11 chars * @return A pointer to s */ char *Fmt_time2str(double milli, char s[static 11]); #endif monit-5.26.0/libmonit/src/util/List.c0000664000175000017500000001141413507751326017314 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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 = ALLOC(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 = ALLOC((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.26.0/libmonit/src/util/Str.c0000664000175000017500000002701713507751326017157 0ustar martinpmartinp/* * 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 "NumberFormatException.h" #include "system/System.h" #include "Str.h" /** * Implementation of the Str interface * * @author http://www.tildeslash.com/ * @see http://www.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 (size_t j = strlen(s) - 1; 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; } 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 int 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; } int Str_startsWith(const char *a, const char *b) { if (a && b) { do if (toupper(*a++) != toupper(*b++)) return false; while (*b); return true; } return false; } int 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; } int 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; } int 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; } int 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 = ALLOC(n); memcpy(t, s, n); } return t; } char *Str_ndup(const char *s, long n) { char *t = NULL; assert(n >= 0); if (s) { size_t l = strlen(s); n = l < n ? l : n; // Use the actual length of s if shorter than n t = ALLOC(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 = ALLOC(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 > 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, char *t) { if (s) { char *x = Str_sub(s, t); if (x) *x = 0; } return s; } int Str_lim(const char *s, int limit) { assert(limit>=0); if (s) for (; (*s && limit--); s++) ; return (limit < 0); } int 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; } unsigned int Str_hash(const void *x) { const char *s = x; unsigned 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); } int Str_compareConstantTime(const void *x, const void *y) { // Copy input to zero initialized buffers of fixed size, to prevent string length timing attack (handle NULL input as well). If some string exceeds hardcoded buffer size, error is returned. char _x[MAX_CONSTANT_TIME_STRING_LENGTH + 1] = {}; char _y[MAX_CONSTANT_TIME_STRING_LENGTH + 1] = {}; if (snprintf(_x, sizeof(_x), "%s", x ? (const char *)x : "") > MAX_CONSTANT_TIME_STRING_LENGTH || snprintf(_y, sizeof(_y), "%s", y ? (const char *)y : "") > MAX_CONSTANT_TIME_STRING_LENGTH) return 1; int rv = 0; for (size_t i = 0; i < sizeof(_x); i++) rv |= _x[i] ^ _y[i]; return rv; } monit-5.26.0/libmonit/src/util/List.h0000664000175000017500000001062513507751326017324 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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.26.0/libmonit/src/system/0000775000175000017500000000000013507751326016603 5ustar martinpmartinpmonit-5.26.0/libmonit/src/system/Time.h0000664000175000017500000002547313507751326017665 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ /** @name class methods */ //@{ /** * Returns a Unix timestamp representation of the parsed 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:58Z") -> 1387066378
 *  Time_toTimestamp("2013-12-14 19:12:58-05:00") -> 1387066378
 * 
* @param s The Date String to parse. Time is expected to be in UTC, but * local time with timezone information is also allowed. * @return A UTC time representation of s or 0 if * s is NULL * @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 the parsed 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 * @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); /** * Factory method for building a specific time. Time is normalized and * built in the local time zone. * @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 * @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 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 int 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 int Time_micro(void); /** * Returns the second of the minute for time. * @param time Number of seconds since the EPOCH * @return The second of the minute (0..61) */ int Time_seconds(time_t time); /** * Returns the minute of the hour for time. * @param time Number of seconds since the EPOCH * @return The minute of the hour (0..59) */ int Time_minutes(time_t time); /** * Returns the hour of the day for time. * @param time Number of seconds since the EPOCH * @return The hour of the day (0..23) */ 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 * @return The day of the week (Sunday=0..Saturday=6) */ int Time_weekday(time_t time); /** * Returns the day of the month for time. * @param time Number of seconds since the EPOCH * @return The day of the month (1..31) */ int Time_day(time_t time); /** * Returns the month of the year. * @param time Number of seconds since the EPOCH * @return The month of the year (January=1..December=12) */ int Time_month(time_t time); /** * Returns the year of time. * @param time Number of seconds since the EPOCH * @return The year of time in the range ~ (1970..2037) */ int Time_year(time_t time); /** * Returns a RFC1123 date string for the given UTC time. The returned string * is computed in the local timezone. The result buffer must be large enough * to hold at least 26 bytes. Example: *
 *  Time_string(1253052085, buf) -> "Wed, 16 Sep 2009 12:01:25"
 * 
* @param time Number of time seconds since the EPOCH in UTC * @param result The buffer to write the date string too * @return a pointer to the result buffer */ char *Time_string(time_t time, char result[static 26]); /** * Returns a RFC1123 date string for the given UTC time. The returned string * represent the specified time in GMT timezone. The submitted result buffer * must be large enough to hold at least 30 bytes. Example: *
 *  Time_gmtstring(1253052085, buf) -> "Tue, 15 Sep 2009 22:01:25 GMT"
 * 
* @param time Number of time seconds since the EPOCH in UTC * @param result The buffer to write the date string too * @return a pointer to the result buffer */ char *Time_gmtstring(time_t time, char result[static 30]); /** * Returns time as a date string. 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 seconds since ephoc to convert to a date string * @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 formated 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(time_t 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, otherwise 0. */ int Time_incron(const char *cron, time_t time); /** * This method suspend the calling process or Thread for * u micro seconds. * @param u Micro seconds to sleep */ void Time_usleep(long u); //@} #undef T #endif monit-5.26.0/libmonit/src/system/Command.c0000664000175000017500000004135713507751326020337 0ustar martinpmartinp/* * 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 "Str.h" #include "Dir.h" #include "File.h" #include "List.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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ /* ----------------------------------------------------------- Definitions */ #define T Command_T struct T { uid_t uid; gid_t gid; List_T env; List_T args; char **_env; char **_args; char *working_directory; }; struct Process_T { pid_t pid; uid_t uid; gid_t gid; int status; int stdin_pipe[2]; int stdout_pipe[2]; int stderr_pipe[2]; InputStream_T in; InputStream_T err; OutputStream_T out; char *working_directory; }; /* --------------------------------------------------------------- Private */ /* 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) { for (list_t p = C->env->head; p; p = p->next) { if ((strncmp(p->e, name, strlen(name)) == 0)) if (((char*)p->e)[strlen(name)] == '=') // Ensure that p->e is not just a sub-string return p->e; } return NULL; } /* Remove env variable and value identified by name */ static inline void _removeEnv(T C, const char *name) { char *e = _findEnv(C, name); if (e) { List_remove(C->env, e); FREE(e); } } /* Free each string in a list of strings */ static void _freeStringsInList(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 arguments to the program */ static void _buildArgs(T C, const char *path, const char *x, va_list ap) { _freeStringsInList(C->args); List_append(C->args, Str_dup(path)); va_list ap_copy; va_copy(ap_copy, ap); for (; x; x = va_arg(ap_copy, char *)) List_append(C->args, Str_dup(x)); va_end(ap_copy); } /* Returns an array of program args */ static inline char **_args(T C) { if (! C->_args) C->_args = (char**)List_toArray(C->args); return C->_args; } /* Returns an array of program environment */ static inline char **_env(T C) { if (! C->_env) C->_env = (char**)List_toArray(C->env); return C->_env; } /* Create stdio pipes for communication between parent and child process */ static void _createPipes(Process_T P) { if (pipe(P->stdin_pipe) < 0 || pipe(P->stdout_pipe) < 0 || pipe(P->stderr_pipe) < 0) { ERROR("Command pipe(2): Bad file descriptors -- %s", System_getLastError()); } } /* Setup stdio pipes in subprocess */ static void _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) ERROR("Command: dup2(stdin) -- %s\n", System_getLastError()); close(P->stdin_pipe[0]); } 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) ERROR("Command: dup2(stdout) -- %s\n", System_getLastError()); close(P->stdout_pipe[1]); } 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) ERROR("Command: dup2(stderr) -- %s\n", System_getLastError()); close(P->stderr_pipe[1]); } } /* Setup stdio pipes in parent process for communication with the subprocess */ static void _setupParentPipes(Process_T P) { close(P->stdin_pipe[0]); // close read end close(P->stdout_pipe[1]); // close write end close(P->stderr_pipe[1]); // close write end Net_setNonBlocking(P->stdin_pipe[1]); Net_setNonBlocking(P->stdout_pipe[0]); Net_setNonBlocking(P->stderr_pipe[0]); } /* Close stdio pipes in parent process */ static void _closeParentPipes(Process_T P) { close(P->stdin_pipe[1]); // close write end close(P->stdout_pipe[0]); // close read end close(P->stderr_pipe[0]); // close read end } /* Close and destroy opened stdio streams */ static void _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); } /* -------------------------------------------------------------- Process_T */ static inline void _setstatus(Process_T P) { if (WIFEXITED(P->status)) P->status = WEXITSTATUS(P->status); else if (WIFSIGNALED(P->status)) P->status = WTERMSIG(P->status); else if (WIFSTOPPED(P->status)) P->status = WSTOPSIG(P->status); } static Process_T _Process_new(void) { Process_T P; NEW(P); P->status = -1; return P; } void Process_free(Process_T *P) { assert(P && *P); FREE((*P)->working_directory); if (Process_isRunning(*P)) { Process_kill(*P); Process_waitFor(*P); } _closeParentPipes(*P); _closeStreams(*P); FREE(*P); } uid_t Process_getUid(Process_T P) { assert(P); return P->uid; } gid_t Process_getGid(Process_T P) { assert(P); return P->gid; } const char *Process_getDir(Process_T P) { assert(P); if (! P->working_directory) { char t[STRLEN]; P->working_directory = Str_dup(Dir_cwd(t, STRLEN)); } return P->working_directory; } pid_t Process_getPid(Process_T P) { assert(P); return P->pid; } int Process_waitFor(Process_T P) { assert(P); if (P->status < 0) { int r; do r = waitpid(P->pid, &P->status, 0); // Wait blocking while (r == -1 && errno == EINTR); if (r != P->pid) P->status = -1; else _setstatus(P); } return P->status; } int Process_exitStatus(Process_T P) { assert(P); if (P->status < 0) { int r; do r = waitpid(P->pid, &P->status, WNOHANG); // Wait non-blocking while (r == -1 && errno == EINTR); if (r == 0) // Process is still running P->status = -1; else _setstatus(P); } return P->status; } int Process_isRunning(Process_T P) { assert(P); return Process_exitStatus(P) < 0; } OutputStream_T Process_getOutputStream(Process_T P) { assert(P); if (! P->out) P->out = OutputStream_new(P->stdin_pipe[1]); return P->out; } InputStream_T Process_getInputStream(Process_T P) { assert(P); if (! P->in) P->in = InputStream_new(P->stdout_pipe[0]); return P->in; } InputStream_T Process_getErrorStream(Process_T P) { assert(P); if (! P->err) P->err = InputStream_new(P->stderr_pipe[0]); return P->err; } void Process_terminate(Process_T P) { assert(P); kill(P->pid, SIGTERM); } void Process_kill(Process_T P) { assert(P); kill(P->pid, SIGKILL); } /* ---------------------------------------------------------------- Public */ T Command_new(const char *path, const char *arg0, ...) { 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(); va_list ap; va_start(ap, arg0); _buildArgs(C, path, arg0, ap); va_end(ap); // Copy this process's environment for transit to sub-processes extern char **environ; for (char **e = environ; *e; e++) { List_append(C->env, Str_dup(*e)); } return C; } void Command_free(T *C) { assert(C && *C); FREE((*C)->_args); FREE((*C)->_env); _freeStringsInList((*C)->args); List_free(&(*C)->args); _freeStringsInList((*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)); FREE(C->_args); // Recreate Command argument on exec } void Command_setUid(T C, uid_t uid) { assert(C); C->uid = uid; } uid_t Command_getUid(T C) { assert(C); return C->uid; } void Command_setGid(T C, gid_t gid) { assert(C); C->gid = gid; } gid_t Command_getGid(T C) { assert(C); return C->gid; } void Command_setDir(T C, const char *dir) { assert(C); if (dir) { // Allow to set a NULL directory, meaning the calling process's current directory 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 = Str_dup(dir); File_removeTrailingSeparator(C->working_directory); } const char *Command_getDir(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 : "")); FREE(C->_env); // Recreate Command environment on exec } /* 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); StringBuffer_T b = StringBuffer_new(name); StringBuffer_append(b, "="); va_list ap; va_start(ap, value); StringBuffer_vappend(b, value, ap); va_end(ap); List_append(C->env, Str_dup(StringBuffer_toString(b))); StringBuffer_free(&b); FREE(C->_env); // Recreate Command environment on exec } /* Returns the value part from a "name=value" environment string */ const char *Command_getEnv(T C, const char *name) { assert(C); assert(name); char *e = _findEnv(C, name); if (e) { char *v = strchr(e, '='); if (v) return ++v; } return NULL; } List_T Command_getCommand(T C) { assert(C); return C->args; } /* The Execute function. Note that we use vfork() rather than fork. Vfork has a special semantic in that the child process runs in the parent address space until exec is called in the child. The child also run first and suspend the parent process until exec or exit is called */ Process_T Command_execute(T C) { assert(C); assert(_env(C)); assert(_args(C)); volatile int exec_error = 0; Process_T P = _Process_new(); int descriptors = System_getDescriptorsGuarded(); _createPipes(P); if ((P->pid = vfork()) < 0) { ERROR("Command: fork failed -- %s\n", System_getLastError()); Process_free(&P); return NULL; } else if (P->pid == 0) { // Child if (C->working_directory) { if (! Dir_chdir(C->working_directory)) { exec_error = errno; ERROR("Command: sub-process cannot change working directory to '%s' -- %s\n", C->working_directory, System_getLastError()); _exit(errno); } } setsid(); // Loose controlling terminal _setupChildPipes(P); // Close all descriptors except stdio, _before_ any uid/gid switching for (int i = 3; i < descriptors; i++) { close(i); } P->gid = getgid(); if (C->gid) { if (setgid(C->gid) == 0) { P->gid = C->gid; } else { ERROR("Command: Cannot change process gid to '%d' -- %s\n", C->gid, System_getLastError()); } } P->uid = getuid(); if (C->uid) { struct passwd *user = getpwuid(C->uid); if (user) { Command_setEnv(C, "HOME", user->pw_dir); if (initgroups(user->pw_name, P->gid) == 0) { if (setuid(C->uid) == 0) { P->uid = C->uid; } else { ERROR("Command: Cannot change process uid to '%d' -- %s\n", C->uid, System_getLastError()); } } else { ERROR("Command: initgroups for user %s failed -- %s\n", user->pw_name, System_getLastError()); } } else { ERROR("Command: uid %d not found on the system -- %s\n", C->uid, System_getLastError()); } } // Unblock any signals and reset signal handlers sigset_t mask; sigemptyset(&mask); pthread_sigmask(SIG_SETMASK, &mask, NULL); signal(SIGINT, SIG_DFL); signal(SIGQUIT, SIG_DFL); signal(SIGABRT, SIG_DFL); signal(SIGTERM, SIG_DFL); signal(SIGPIPE, SIG_DFL); signal(SIGCHLD, SIG_DFL); signal(SIGUSR1, SIG_DFL); signal(SIGHUP, SIG_IGN); // Ensure future opens won't allocate controlling TTYs // Execute the program execve(_args(C)[0], _args(C), _env(C)); // Won't print to error log as descriptor was closed above, but will // print error to stderr Processor_T can be read ERROR("Command: '%s' failed to execute -- %s", _args(C)[0], System_getLastError()); exec_error = errno; _exit(errno); } // Parent _setupParentPipes(P); if (exec_error != 0) Process_free(&P); errno = exec_error; return P; } monit-5.26.0/libmonit/src/system/Process.h0000664000175000017500000001364313507751326020401 0ustar martinpmartinp/* * 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_getOutputStream(), * Process_getInputStream(), and Process_getErrorStream(). Your program can * then use these streams to feed input to and get output from the sub-process. * * The sub-process continues executing until it stops or until either * Process_free() is called or it is terminated with either Process_terminate() * or Process_kill(). * *

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. * * @see Command.h * @author http://www.tildeslash.com/ * @see http://www.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. * 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 the user id of the sub-process * @param P A Process object * @return The user id of the sub-process */ uid_t Process_getUid(T P); /** * Returns the group id of the sub-process * @param P A Process object * @return The group id of the sub-process */ gid_t Process_getGid(T P); /** * Returns the working directory of the Process * @param P A Process object * @return The Process working directory */ const char *Process_getDir(T P); /** * Returns the Process's identification number * @param P A Process object * @return The process identification number of the sub-process */ pid_t Process_getPid(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 */ int 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_getOutputStream(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_getInputStream(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_getErrorStream(T P); //@} /** * Destroy the sub-process. The sub-process is destroyed by sending * it a termination signal (SIGTERM) * @param P A Process object */ void 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 can not be blocked and will kill the process * @param P A Process object */ void Process_kill(T P); #undef T #endif monit-5.26.0/libmonit/src/system/os/0000775000175000017500000000000013507751326017224 5ustar martinpmartinpmonit-5.26.0/libmonit/src/system/os/solaris/0000775000175000017500000000000013507751326020700 5ustar martinpmartinpmonit-5.26.0/libmonit/src/system/os/solaris/Link.inc0000664000175000017500000002052513507751326022274 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ #include /* ------------------------------------------------------------- Definitions */ static boolean_t _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 boolean_t _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 < sizeof(interface->module) ? i + 1 : 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 boolean_t _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.26.0/libmonit/src/system/os/dragonfly/0000775000175000017500000000000013507751326021211 5ustar martinpmartinpmonit-5.26.0/libmonit/src/system/os/dragonfly/Link.inc0000664000175000017500000000703713507751326022610 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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)); // 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.26.0/libmonit/src/system/os/freebsd/0000775000175000017500000000000013507751326020636 5ustar martinpmartinpmonit-5.26.0/libmonit/src/system/os/freebsd/Link.inc0000664000175000017500000000703513507751326022233 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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)); // 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.26.0/libmonit/src/system/os/linux/0000775000175000017500000000000013507751326020363 5ustar martinpmartinpmonit-5.26.0/libmonit/src/system/os/linux/Link.inc0000664000175000017500000001733513507751326021764 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ static boolean_t _update(T L, const char *interface) { 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 (Optional: may not be present on older kernels). * $ cat /sys/class/net/eth0/operstate * up */ snprintf(path, sizeof(path), "/sys/class/net/%s/operstate", name); FILE *f = fopen(path, "r"); if (f) { if (fscanf(f, "%256s\n", buf) != 1) { fclose(f); THROW(AssertException, "Cannot parse %s -- %s", path, System_getError(errno)); } L->state = Str_isEqual(buf, "down") ? 0LL : 1LL; 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); } /* * 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, "%256s\n", buf) == 1 && ! Str_isEqual(buf, "unknown")) L->duplex = Str_isEqual(buf, "full") ? 1LL : 0LL; else L->duplex = -1; fclose(f); } /* * $ cat /sys/class/net/eth0/statistics/rx_bytes * 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 { THROW(AssertException, "Cannot read %s -- %s", path, System_getError(errno)); } /* * $ cat /sys/class/net/eth0/statistics/rx_packets * 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 { THROW(AssertException, "Cannot read %s -- %s", path, System_getError(errno)); } /* * $ cat /sys/class/net/eth0/statistics/rx_errors * 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 { THROW(AssertException, "Cannot read %s -- %s", path, System_getError(errno)); } /* * $ cat /sys/class/net/eth0/statistics/tx_bytes * 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 { THROW(AssertException, "Cannot read %s -- %s", path, System_getError(errno)); } /* * $ cat /sys/class/net/eth0/statistics/tx_packets * 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 { THROW(AssertException, "Cannot read %s -- %s", path, System_getError(errno)); } /* * $ cat /sys/class/net/eth0/statistics/tx_errors * 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 { THROW(AssertException, "Cannot read %s -- %s", path, System_getError(errno)); } L->timestamp.last = L->timestamp.now; L->timestamp.now = Time_milli(); return true; } monit-5.26.0/libmonit/src/system/os/openbsd/0000775000175000017500000000000013507751326020656 5ustar martinpmartinpmonit-5.26.0/libmonit/src/system/os/openbsd/Link.inc0000664000175000017500000000703513507751326022253 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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)); // 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.26.0/libmonit/src/system/os/aix/0000775000175000017500000000000013507751326020005 5ustar martinpmartinpmonit-5.26.0/libmonit/src/system/os/aix/Link.inc0000664000175000017500000000403713507751326021401 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ static boolean_t _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.26.0/libmonit/src/system/os/netbsd/0000775000175000017500000000000013507751326020503 5ustar martinpmartinpmonit-5.26.0/libmonit/src/system/os/netbsd/Link.inc0000664000175000017500000000703413507751326022077 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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)); // 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.26.0/libmonit/src/system/os/macosx/0000775000175000017500000000000013507751326020516 5ustar martinpmartinpmonit-5.26.0/libmonit/src/system/os/macosx/Link.inc0000664000175000017500000001103513507751326022106 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ static boolean_t _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)); 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)); // 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.26.0/libmonit/src/system/Net.c0000664000175000017500000001114713507751326017501 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ /* ---------------------------------------------------------------- Public */ int Net_setNonBlocking(int socket) { return (fcntl(socket, F_SETFL, fcntl(socket, F_GETFL, 0) | O_NONBLOCK) != -1); } int Net_setBlocking(int socket) { return (fcntl(socket, F_SETFL, fcntl(socket, F_GETFL, 0) & ~O_NONBLOCK) != -1); } int 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); } int 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; } int Net_shutdown(int socket, int how) { return (shutdown(socket, how) == 0); } int Net_close(int socket) { int r = 0; do { r = close(socket); } while (r == -1 && errno == EINTR); return (r == 0); } int 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_getLastError()); } do { r = close(socket); } while (r == -1 && errno == EINTR); return (r == 0); } monit-5.26.0/libmonit/src/system/Net.h0000664000175000017500000001032013507751326017476 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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 */ int Net_setNonBlocking(int socket); /** * Disable nonblocking i|o on the given socket * @param socket A socket * @return true if success, otherwise false */ int 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 occured, otherwise false. */ int 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 occured, otherwise false. */ int 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 occured. */ 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 occured. */ 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 */ int 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 */ int Net_shutdown(int socket, int how); /** * Close a socket connection * @param socket The socket connection to close * @return true if success otherwise false */ int Net_close(int socket); #endif monit-5.26.0/libmonit/src/system/Link.h0000664000175000017500000002133113507751326017651 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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 */ int 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.26.0/libmonit/src/system/Command.h0000664000175000017500000001711413507751326020336 0ustar martinpmartinp/* * 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. * * @see Process.h * @author http://www.tildeslash.com/ * @see http://www.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 arg0 argument is the first argument * in a sequence of arguments to the program. The arguments list can be thought * of as arg0, arg1, ..., argn. Together they describe a list of one or more * pointers to null-terminated strings that represent the argument list * available to the executed program specified in path. The * list of arguments must be terminated by a * NULL pointer. Example: *
 * Command_new("/bin/ls", NULL)
 * Command_new("/bin/ls", "-lrt", NULL)
 * Command_new("/bin/sh", "-c", "ps -aef|egrep mmonit", NULL)
 * 
* @param path A string containing the path to the program to execute * @param arg0 The first argument in a sequence of arguments. The last value * in the arguments list must be NULL. * @exception AssertException if the program does not exist or cannot be * executed * @return This Command object */ T Command_new(const char *path, const char *arg0, ...); /** * 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 * @param C A Command object * @param uid The user id the sub-process should switch to when executed */ 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_getUid(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 */ 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_getGid(T C); /** * Set the working directory for the sub-process. If directory cannot be changed * the sub-process will exit * @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_getDir(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 */ 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 */ 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_getEnv(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_getCommand(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_getLastError() 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.26.0/libmonit/src/system/System.c0000664000175000017500000000670713507751326020245 0ustar martinpmartinp/* * 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 #ifdef HAVE_SYS_RANDOM_H #include #endif #include "Str.h" #include "system/System.h" /** * Implementation of the System Facade for Unix Systems. * * @author http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ /* ----------------------------------------------------------- Definitions */ extern void(*_AbortHandler)(const char *error, va_list ap); extern void(*_ErrorHandler)(const char *error, va_list ap); /* ---------------------------------------------------------------- Public */ const char *System_getLastError(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); } int System_getDescriptorsGuarded() { int max = 2<<15; int fileDescriptors = (int)sysconf(_SC_OPEN_MAX); if (fileDescriptors < 2) fileDescriptors = getdtablesize(); assert(fileDescriptors > 2); return (fileDescriptors > max) ? max : fileDescriptors; } boolean_t System_random(void *buf, size_t nbytes) { #ifdef HAVE_ARC4RANDOM_BUF arc4random_buf(buf, nbytes); return true; #elif defined HAVE_GETRANDOM return (getrandom(buf, nbytes, 0) == nbytes); #else int fd = open("/dev/urandom", O_RDONLY); if (fd >= 0) { int bytes = read(fd, buf, nbytes); close(fd); if (bytes == nbytes) { return true; } } // Fallback to random() char *_buf = buf; for (int i = 0; i < nbytes; i++) { _buf[i] = random() % 256; } return true; #endif } uint64_t System_randomNumber() { uint64_t random; System_random(&random, sizeof(random)); return random; } monit-5.26.0/libmonit/src/system/Mem.h0000664000175000017500000001205513507751326017475 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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.26.0/libmonit/src/system/Time.c0000664000175000017500000006162613507751326017660 0ustar martinpmartinp/* * 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 "Str.h" #include "system/System.h" #include "system/Time.h" /** * Implementation of the Time interface * * @author http://www.tildeslash.com/ * @see http://www.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 int 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; int64_t 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 = ((int64_t)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[0] = ((i) / 10) + '0', x[1] = ((i) % 10) + '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; } /* ----------------------------------------------------------------- Class */ 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}; int has_date = false, has_time = false; const char *limit = s + strlen(s), *marker, *token, *cursor = s; while (true) { if (cursor >= limit) { if (has_date || has_time) { *(struct tm*)t = tm; return t; } THROW(AssertException, "Invalid date or time"); } token = cursor; #line 187 "" { unsigned char yych; unsigned int yyaccept = 0; static const unsigned char yybm[] = { 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, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 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, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; yych = *cursor; if (yych <= ',') { if (yych == '+') goto yy4; goto yy5; } else { if (yych <= '-') goto yy4; if (yych <= '/') goto yy5; if (yych >= ':') goto yy5; } yyaccept = 0; yych = *(marker = ++cursor); if (yych <= '/') goto yy3; if (yych <= '9') goto yy15; yy3: #line 243 "src/system/Time.re" { continue; } #line 244 "" yy4: yyaccept = 0; yych = *(marker = ++cursor); if (yych <= '/') goto yy3; if (yych <= '9') goto yy6; goto yy3; yy5: yych = *++cursor; goto yy3; yy6: yych = *++cursor; if (yych <= '/') goto yy7; if (yych <= '9') goto yy8; yy7: cursor = marker; if (yyaccept <= 1) { if (yyaccept == 0) { goto yy3; } else { goto yy9; } } else { if (yyaccept == 2) { goto yy23; } else { goto yy31; } } yy8: yyaccept = 1; yych = *(marker = ++cursor); if (yych == '\n') goto yy9; if (yych <= '/') goto yy10; if (yych <= '9') goto yy11; goto yy10; yy9: #line 230 "src/system/Time.re" { // Timezone: +-HH:MM, +-HH or +-HHMM is offset from UTC in seconds if (has_time) { // Only set timezone if time has been seen 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; } #line 294 "" yy10: yych = *++cursor; if (yych <= '/') goto yy7; if (yych <= '9') goto yy14; goto yy7; yy11: yych = *++cursor; if (yych <= '/') goto yy7; if (yych >= ':') goto yy7; yych = *++cursor; if (yych <= '/') goto yy9; if (yych >= ':') goto yy9; yy13: yych = *++cursor; goto yy9; yy14: yych = *++cursor; if (yych <= '/') goto yy7; if (yych <= '9') goto yy13; goto yy7; yy15: yych = *++cursor; if (yych <= '/') goto yy17; if (yych >= ':') goto yy17; yych = *++cursor; if (yych <= '/') goto yy7; if (yych <= '9') goto yy27; goto yy7; yy17: yych = *++cursor; if (yych <= '/') goto yy7; if (yych >= ':') goto yy7; yych = *++cursor; if (yych <= '/') goto yy7; if (yych >= ':') goto yy7; yych = *++cursor; if (yych <= '/') goto yy20; if (yych <= '9') goto yy7; yy20: yych = *++cursor; if (yych <= '/') goto yy7; if (yych >= ':') goto yy7; yych = *++cursor; if (yych <= '/') goto yy7; if (yych >= ':') goto yy7; yyaccept = 2; yych = *(marker = ++cursor); if (yych == ',') goto yy24; if (yych == '.') goto yy24; yy23: #line 214 "src/system/Time.re" { // Time: HH:MM:SS tm.tm_hour = _a2i(token, 2); tm.tm_min = _a2i(token + 3, 2); tm.tm_sec = _a2i(token + 6, 2); has_time = true; continue; } #line 353 "" yy24: yych = *++cursor; if (yybm[0+yych] & 128) { goto yy25; } goto yy7; yy25: ++cursor; yych = *cursor; if (yybm[0+yych] & 128) { goto yy25; } goto yy23; yy27: yych = *++cursor; if (yych <= '/') goto yy28; if (yych <= '9') goto yy29; yy28: yych = *++cursor; if (yych <= '/') goto yy7; if (yych <= '9') goto yy38; goto yy7; yy29: yych = *++cursor; if (yych <= '/') goto yy7; if (yych >= ':') goto yy7; yyaccept = 3; yych = *(marker = ++cursor); if (yych <= '-') { if (yych == ',') goto yy33; } else { if (yych <= '.') goto yy33; if (yych <= '/') goto yy31; if (yych <= '9') goto yy32; } yy31: #line 222 "src/system/Time.re" { // Compressed Time: HHMMSS tm.tm_hour = _a2i(token, 2); tm.tm_min = _a2i(token + 2, 2); tm.tm_sec = _a2i(token + 4, 2); has_time = true; continue; } #line 398 "" yy32: yych = *++cursor; if (yych <= '/') goto yy7; if (yych <= '9') goto yy36; goto yy7; yy33: yych = *++cursor; if (yych <= '/') goto yy7; if (yych >= ':') goto yy7; yy34: ++cursor; yych = *cursor; if (yych <= '/') goto yy31; if (yych <= '9') goto yy34; goto yy31; yy36: ++cursor; #line 206 "src/system/Time.re" { // Compressed Date: YYYYMMDD tm.tm_year = _a2i(token, 4); tm.tm_mon = _a2i(token + 4, 2) - 1; tm.tm_mday = _a2i(token + 6, 2); has_date = true; continue; } #line 424 "" yy38: yych = *++cursor; if (yych <= '/') goto yy7; if (yych >= ':') goto yy7; yych = *++cursor; if (yych <= '/') goto yy40; if (yych <= '9') goto yy7; yy40: yych = *++cursor; if (yych <= '/') goto yy7; if (yych >= ':') goto yy7; yych = *++cursor; if (yych <= '/') goto yy7; if (yych >= ':') goto yy7; ++cursor; #line 198 "src/system/Time.re" { // 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); has_date = true; continue; } #line 448 "" } #line 246 "src/system/Time.re" } return NULL; } 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 mktime(&tm); } time_t Time_now(void) { struct timeval t; if (gettimeofday(&t, NULL) != 0) THROW(AssertException, "%s", System_getLastError()); return t.tv_sec; } long long int Time_milli(void) { struct timeval t; if (gettimeofday(&t, NULL) != 0) THROW(AssertException, "%s", System_getLastError()); return (long long int)t.tv_sec * 1000 + (long long int)t.tv_usec / 1000; } long long int Time_micro(void) { struct timeval t; if (gettimeofday(&t, NULL) != 0) THROW(AssertException, "%s", System_getLastError()); return (long long int)t.tv_sec * 1000000 + (long long int)t.tv_usec; } 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); } #define i2a(i) (x[0]=(i/10)+'0', x[1]=(i%10)+'0') char *Time_string(time_t time, char *result) { if (result) { char x[2]; struct tm ts; localtime_r((const time_t *)&time, &ts); memcpy(result, "aaa, xx aaa xxxx xx:xx:xx\0", 26); /* 0 5 8 1214 17 20 2326 */ memcpy(result, days + 3 * ts.tm_wday, 3); i2a(ts.tm_mday); result[5] = x[0]; result[6] = x[1]; memcpy(result + 8, months + 3 * ts.tm_mon, 3); i2a((ts.tm_year + 1900) / 100); result[12] = x[0]; result[13] = x[1]; i2a((ts.tm_year + 1900) % 100); result[14] = x[0]; result[15] = x[1]; i2a(ts.tm_hour); result[17] = x[0]; result[18] = x[1]; i2a(ts.tm_min); result[20] = x[0]; result[21] = x[1]; i2a(ts.tm_sec); result[23] = x[0]; result[24] = x[1]; } return result; } char *Time_gmtstring(time_t time, char *result) { if (result) { char x[2]; struct tm ts; 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] = x[0]; result[6] = x[1]; memcpy(result + 8, months + 3 * ts.tm_mon, 3); i2a((ts.tm_year + 1900) / 100); result[12] = x[0]; result[13] = x[1]; i2a((ts.tm_year + 1900) % 100); result[14] = x[0]; result[15] = x[1]; i2a(ts.tm_hour); result[17] = x[0]; result[18] = x[1]; i2a(ts.tm_min); result[20] = x[0]; result[21] = x[1]; i2a(ts.tm_sec); result[23] = x[0]; result[24] = x[1]; } return result; } char *Time_fmt(char *result, int size, const char *format, time_t time) { struct tm tm; assert(result); assert(format); localtime_r((const time_t *)&time, &tm); if (strftime(result, size, format, &tm) == 0) *result = 0; return result; } char *Time_uptime(time_t sec, char *result) { // Write max 24 bytes to result if (result) { int n = 0; time_t 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 */ int Time_incron(const char *cron, time_t time) { assert(cron); #define YYCURSOR cron #define YYLIMIT end #define YYTOKEN t const char *m; const char *t; const char *end = cron + strlen(cron); int n = 0; int found = 0; int fields[] = {Time_minutes(time), Time_hour(time), Time_day(time), Time_month(time), Time_weekday(time)}; parse: if (YYCURSOR >= YYLIMIT) return found == 5; YYTOKEN = YYCURSOR; { unsigned char yych; static const unsigned char yybm[] = { 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, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 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, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; yych = *cron; if (yych <= ' ') { if (yych <= '\f') { if (yych <= 0x08) goto yy10; if (yych >= '\v') goto yy10; } else { if (yych <= '\r') goto yy2; if (yych <= 0x1F) goto yy10; } } else { if (yych <= '+') { if (yych == '*') goto yy4; goto yy10; } else { if (yych <= ',') goto yy6; if (yych <= '/') goto yy10; if (yych <= '9') goto yy8; goto yy10; } } yy2: ++cron; { goto parse; } yy4: ++cron; { n++; found++; goto parse; } yy6: ++cron; { n--; // backtrack on fields advance assert(n < 5 && n >= 0); goto parse; } yy8: yych = *(m = ++cron); goto yy13; yy9: { if (fields[n] == Str_parseInt(YYTOKEN)) found++; n++; goto parse; } yy10: ++cron; { return false; } yy12: m = ++cron; yych = *cron; yy13: if (yybm[0+yych] & 128) { goto yy12; } if (yych != '-') goto yy9; yych = *++cron; if (yych <= '/') goto yy15; if (yych <= '9') goto yy16; yy15: cron = m; goto yy9; yy16: ++cron; yych = *cron; if (yych <= '/') goto yy18; if (yych <= '9') goto yy16; yy18: { 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; } void Time_usleep(long u) { #ifdef NETBSD // usleep is broken on NetBSD (at least in version 5.1) struct timespec t = {u / 1000000, (u % 1000000) * 1000}; nanosleep(&t, NULL); #else usleep((useconds_t)u); #endif } monit-5.26.0/libmonit/src/system/Link.c0000664000175000017500000003477513507751326017664 0ustar martinpmartinp/* * 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 "system/Link.h" #include "system/Time.h" #include "system/System.h" #include "Str.h" /** * Implementation of the Statistics Facade for Unix Systems. * * @author http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ /* ------------------------------------------------------------- Definitions */ #define T Link_T static struct { struct ifaddrs *addrs; uint64_t timestamp; } _stats = {}; typedef struct LinkData_T { #ifndef __LP64__ unsigned long long raw; #endif unsigned long long last; unsigned long long now; 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 { unsigned long long last; unsigned 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() { #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; } #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 unsigned 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 (unsigned long long)((data->now - data->last) * 1000. / (L->timestamp.now - L->timestamp.last)); return 0ULL; } static unsigned 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 unsigned 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() { #ifdef HAVE_IFADDRS_H uint64_t 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); } int Link_isGetByAddressSupported() { #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 udate network statistics -- interface %s not found", interface); } long long Link_getBytesInPerSecond(T L) { assert(L); return L->state > 0 ? _deltaSecond(L, &(L->ibytes)) : -1LL; } long long Link_getBytesInPerMinute(T L, int count) { assert(L); return L->state > 0 ? _deltaMinute(L, &(L->ibytes), count) : -1LL; } long long Link_getBytesInPerHour(T L, int count) { assert(L); return L->state > 0 ? _deltaHour(L, &(L->ibytes), count) : -1LL; } long long Link_getBytesInTotal(T L) { assert(L); return L->state > 0 ? 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 ? _deltaSecond(L, &(L->ipackets)) : -1LL; } long long Link_getPacketsInPerMinute(T L, int count) { assert(L); return L->state > 0 ? _deltaMinute(L, &(L->ipackets), count) : -1LL; } long long Link_getPacketsInPerHour(T L, int count) { assert(L); return L->state > 0 ? _deltaHour(L, &(L->ipackets), count) : -1LL; } long long Link_getPacketsInTotal(T L) { assert(L); return L->state > 0 ? L->ipackets.now : -1LL; } long long Link_getErrorsInPerSecond(T L) { assert(L); return L->state > 0 ? _deltaSecond(L, &(L->ierrors)) : -1LL; } long long Link_getErrorsInPerMinute(T L, int count) { assert(L); return L->state > 0 ? _deltaMinute(L, &(L->ierrors), count) : -1LL; } long long Link_getErrorsInPerHour(T L, int count) { assert(L); return L->state > 0 ? _deltaHour(L, &(L->ierrors), count) : -1LL; } long long Link_getErrorsInTotal(T L) { assert(L); return L->state > 0 ? L->ierrors.now : -1LL; } long long Link_getBytesOutPerSecond(T L) { assert(L); return L->state > 0 ? _deltaSecond(L, &(L->obytes)) : -1LL; } long long Link_getBytesOutPerMinute(T L, int count) { assert(L); return L->state > 0 ? _deltaMinute(L, &(L->obytes), count) : -1LL; } long long Link_getBytesOutPerHour(T L, int count) { assert(L); return L->state > 0 ? _deltaHour(L, &(L->obytes), count) : -1LL; } long long Link_getBytesOutTotal(T L) { assert(L); return L->state > 0 ? 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 ? _deltaSecond(L, &(L->opackets)) : -1LL; } long long Link_getPacketsOutPerMinute(T L, int count) { assert(L); return L->state > 0 ? _deltaMinute(L, &(L->opackets), count) : -1LL; } long long Link_getPacketsOutPerHour(T L, int count) { assert(L); return L->state > 0 ? _deltaHour(L, &(L->opackets), count) : -1LL; } long long Link_getPacketsOutTotal(T L) { assert(L); return L->state > 0 ? L->opackets.now : -1LL; } long long Link_getErrorsOutPerSecond(T L) { assert(L); return L->state > 0 ? _deltaSecond(L, &(L->oerrors)) : -1LL; } long long Link_getErrorsOutPerMinute(T L, int count) { assert(L); return L->state > 0 ? _deltaMinute(L, &(L->oerrors), count) : -1LL; } long long Link_getErrorsOutPerHour(T L, int count) { assert(L); return L->state > 0 ? _deltaHour(L, &(L->oerrors), count) : -1LL; } long long Link_getErrorsOutTotal(T L) { assert(L); return L->state > 0 ? 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.26.0/libmonit/src/system/System.h0000664000175000017500000000537213507751326020247 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ /** * Returns a String describing the last system error * @return The last error message */ const char *System_getLastError(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 formated (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 formated (printf-style) message string */ void System_error(const char *e, ...) __attribute__((format (printf, 1, 2))); /** * Returns the number of available file descriptors for a process. * This method uses sysconf internally, but returns * a fixed size of 2^16 if the value is larger. * @return A guarded number of available file descriptors for a process */ int System_getDescriptorsGuarded(void); /** * 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 */ boolean_t System_random(void *buf, size_t nbytes); /** * Get random number * @return random number */ uint64_t System_randomNumber(void); #endif monit-5.26.0/libmonit/src/system/Mem.c0000664000175000017500000000456713507751326017501 0ustar martinpmartinp/* * 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 "assert.h" #include "System.h" #include "MemoryException.h" /** * Implementation of the Mem interface * * @author http://www.tildeslash.com/ * @see http://www.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_throw(&(MemoryException), func, file, line, System_getLastError()); 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_throw(&(MemoryException), func, file, line, System_getLastError()); return ptr; } void Mem_free(void *ptr, const char *func, const char *file, 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_throw(&(MemoryException), func, file, line, System_getLastError()); return ptr; } monit-5.26.0/libmonit/src/xconfig.h.in0000664000175000017500000001405313507751341017472 0ustar martinpmartinp/* 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 the system has the type `boolean_t'. */ #undef HAVE_BOOLEAN_T /* Define to 1 if you have the header file. */ #undef HAVE_CTYPE_H /* 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 `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 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_MACH_BOOLEAN_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_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_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 the system has the type `uint32_t'. */ #undef HAVE_UINT32_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_UVM_UVM_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_ZLIB_H /* Define to 1 if the system supports IPv6 */ #undef IPV6 /* 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 you have the ANSI C header files. */ #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.26.0/libmonit/src/thread/0000775000175000017500000000000013507751326016526 5ustar martinpmartinpmonit-5.26.0/libmonit/src/thread/Thread.c0000664000175000017500000000540713507751326020107 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ /* ----------------------------------------------------------- Definitions */ static pthread_attr_t myDetachStateAttribute; static pthread_once_t once_control = PTHREAD_ONCE_INIT; /* --------------------------------------------------------------- Private */ /* Setup common thread attribute */ static void init_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)); } } /* ----------------------------------------------------- Protected Methods */ /* Called from Bootstrap() */ void Thread_init(void) { pthread_once(&once_control, init_once); } /* Called at program termination for cleanup */ void Thread_fini(void) { pthread_attr_destroy(&myDetachStateAttribute); } /* ---------------------------------------------------------------- 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)); } monit-5.26.0/libmonit/src/thread/Thread.h0000664000175000017500000002264513507751326020117 0ustar martinpmartinp/* * 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 "system/System.h" /** * General purpose Thread abstractions. This interface defines object * types and methods for handling threads, synchronization and semaphores. * * @author http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ /** @cond hidden */ #define wrapper(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) \ wrapper(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) wrapper(pthread_detach(thread)) /** * Cancel execution of a thread * @param thread The thread to cancel * @exception AssertException If thread cancelation failed * @hideinitializer */ #define Thread_cancel(thread) wrapper(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) wrapper(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) wrapper(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) wrapper(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) wrapper(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) wrapper(pthread_cond_broadcast(&sem)) /** * Destroy a semaphore * @param sem The semaphore to destroy * @exception AssertException If destroy failed * @hideinitializer */ #define Sem_destroy(sem) wrapper(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) \ wrapper(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) wrapper(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) wrapper(pthread_mutex_destroy(&(mutex))) /** * Locks a mutex * @param mutex The mutex to lock * @exception AssertException If mutex lock failed * @hideinitializer */ #define Mutex_lock(mutex) wrapper(pthread_mutex_lock(&(mutex))) /** * Unlocks a mutex * @param mutex The mutex to unlock * @exception AssertException If mutex unlock failed * @hideinitializer */ #define Mutex_unlock(mutex) wrapper(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) wrapper(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) wrapper(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) wrapper(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) wrapper(pthread_rwlock_wrlock(&(lock))) /** * Release a read/write lock * @param lock A read/write lock * @exception AssertException If failed * @hideinitializer */ #define Lock_unlock(lock) wrapper(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) wrapper(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) wrapper(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)) //@} /* ----------------------------------------------------------------- Methods */ //<< Start filter-out /** * Initialize Threads. This method should be called at program startup */ void Thread_init(void); /** * Shutdown and cleanup threads. This method should be called at program termination */ void Thread_fini(void); //>> End filter-out /** * 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); #endif monit-5.26.0/libmonit/src/Bootstrap.c0000664000175000017500000000356313507751326017407 0ustar martinpmartinp/* * 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 "Thread.h" #include "Exception.h" #include "Bootstrap.h" /** * Implementation of the Bootstrap interface * * @author http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ /* ----------------------------------------------------------- Definitions */ void(*_AbortHandler)(const char *error, va_list ap) = NULL; void(*_ErrorHandler)(const char *error, 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; } monit-5.26.0/libmonit/src/exceptions/0000775000175000017500000000000013507751326017440 5ustar martinpmartinpmonit-5.26.0/libmonit/src/exceptions/ProtocolException.h0000664000175000017500000000256113507751326023275 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ extern Exception_T ProtocolException; #endif monit-5.26.0/libmonit/src/exceptions/MemoryException.h0000664000175000017500000000266113507751326022745 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ extern Exception_T MemoryException; #endif monit-5.26.0/libmonit/src/exceptions/assert.c0000664000175000017500000000217113507751326021106 0ustar martinpmartinp/* * 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.26.0/libmonit/src/exceptions/Exception.c0000664000175000017500000000715413507751326021551 0ustar martinpmartinp/* * 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 "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 http://www.tildeslash.com/ * @see http://www.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() { pthread_once(&once_control, init_once); } void Exception_throw(const T *e, const char *func, const char *file, int line, const char *cause, ...) { assert(e); va_list ap; Exception_Frame *p = ThreadData_get(Exception_Stack); if (p) { p->exception = e; p->func = func; p->file = file; p->line = line; if (cause) { va_start(ap, cause); vsnprintf(p->message, EXCEPTION_MESSAGE_LENGTH, cause, ap); va_end(ap); } pop_exception_stack; longjmp(p->env, Exception_thrown); } else if (cause) { char message[EXCEPTION_MESSAGE_LENGTH + 1] = "?"; va_start(ap, cause); vsnprintf(message, EXCEPTION_MESSAGE_LENGTH, cause, ap); va_end(ap); 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); } } monit-5.26.0/libmonit/src/exceptions/NumberFormatException.h0000664000175000017500000000265413507751326024100 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ extern Exception_T NumberFormatException; #endif monit-5.26.0/libmonit/src/exceptions/IOException.h0000664000175000017500000000260213507751326021777 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ extern Exception_T IOException; #endif monit-5.26.0/libmonit/src/exceptions/AssertException.h0000664000175000017500000000255113507751326022734 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ extern Exception_T AssertException; #endif monit-5.26.0/libmonit/src/exceptions/Exception.h0000664000175000017500000002262113507751326021552 0ustar martinpmartinp/* * 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 catched 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 http://www.tildeslash.com/ * @see http://www.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 #define TD_T pthread_key_t #define TD_set(key, value) pthread_setspecific((key), (value)) #define TD_get(key) pthread_getspecific((key)) typedef struct T { const char *name; } T; #define EXCEPTION_MESSAGE_LENGTH 511 typedef struct Exception_Frame Exception_Frame; struct Exception_Frame { int line; jmp_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 TD_T Exception_Stack; void Exception_init(void); void Exception_throw(const T *e, const char *func, const char *file, int line, const char *cause, ...) CLANG_ANALYZER_NORETURN; #define pop_exception_stack TD_set(Exception_Stack, ((Exception_Frame*)TD_get(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_throw(&(e), __func__, __FILE__, __LINE__, cause, ##__VA_ARGS__, 0) /** * 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 = TD_get(Exception_Stack); \ TD_set(Exception_Stack, &Exception_frame); \ Exception_flag = setjmp(Exception_frame.env); \ 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 * catched 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.26.0/libmonit/src/exceptions/assert.h0000664000175000017500000000352413507751326021116 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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.26.0/libmonit/src/Bootstrap.h0000664000175000017500000000510313507751326017404 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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 * emit an error message. The error message is passed to the handler * function in the string error with optional variable * arguments. * @see Exception.h */ void Bootstrap_setErrorHandler(void(*errorHandler)(const char *error, va_list ap)); #endif monit-5.26.0/libmonit/src/statistics/0000775000175000017500000000000013507751326017451 5ustar martinpmartinpmonit-5.26.0/libmonit/src/statistics/Statistics.h0000664000175000017500000000510413507751326021754 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ #define T Statistics_T typedef struct T { boolean_t initialized; #ifndef __LP64__ uint64_t raw; #endif struct { uint64_t time; uint64_t value; } last; struct { uint64_t time; uint64_t 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, uint64_t time, uint64_t 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 */ boolean_t Statistics_initialized(T S); /** * Return the last raw value * @param S A Statistics object * @return last raw value */ uint64_t Statistics_raw(T S); /** * Return the delta between last two updates * @param S A Statistics object * @return delta */ uint64_t 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.26.0/libmonit/src/statistics/Statistics.c0000664000175000017500000000531413507751326021752 0ustar martinpmartinp/* * 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 "Statistics.h" /** * Statistics * * @author http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ /* ------------------------------------------------------------- Definitions */ #define T Statistics_T /* ---------------------------------------------------------------- Public */ void Statistics_update(T S, uint64_t time, uint64_t value) { uint64_t _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; } boolean_t Statistics_initialized(T S) { return S->initialized; } uint64_t Statistics_raw(T S) { return S->current.value; } uint64_t 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.26.0/libmonit/src/io/0000775000175000017500000000000013507751326015666 5ustar martinpmartinpmonit-5.26.0/libmonit/src/io/InputStream.h0000664000175000017500000001177513507751326020325 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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 */ int 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.26.0/libmonit/src/io/File.c0000664000175000017500000001746013507751326016721 0ustar martinpmartinp/* * 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 "Str.h" #include "system/System.h" #include "File.h" /** * Implementation of the File Facade for Unix systems. * * @author http://www.tildeslash.com/ * @see http://www.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; } int File_close(int fd) { int r; do r = close(fd); while (r == -1 && errno == EINTR); return (r == 0); } int 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; } int File_isFile(const char *file) { if (file) { struct stat buf; return (stat(file, &buf) == 0 && S_ISREG(buf.st_mode)); } return false; } int File_isSocket(const char *file) { if (file) { struct stat buf; return (stat(file, &buf) == 0 && S_ISSOCK(buf.st_mode)); } return false; } int File_isDirectory(const char *file) { if (file) { struct stat buf; return (stat(file, &buf) == 0 && S_ISDIR(buf.st_mode)); } return false; } int 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; } int File_chmod(const char *file, mode_t mode) { if (file) return (chmod(file, mode) == 0); errno = EINVAL; return false; } mode_t File_mod(const char *file) { if (file) { struct stat buf; if (stat(file, &buf) == 0) return buf.st_mode; } return -1; } mode_t 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; } int File_isReadable(const char *file) { if (file) return (access(file, R_OK) == 0); return false; } int File_isWritable(const char *file) { if (file) return (access(file, W_OK) == 0); return false; } int File_isExecutable(const char *file) { if (file) return (access(file, X_OK) == 0); return false; } int File_delete(const char *file) { if (file) return (remove(file) == 0); errno = ENOENT; return false; } int 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_getRealPath(const char *path, char *resolved) { if (path && resolved) return realpath(path, resolved); return NULL; } monit-5.26.0/libmonit/src/io/OutputStream.c0000664000175000017500000003677513507751326020530 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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; boolean_t isclosed; int sessionWritten; long long int 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, 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, 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, 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, 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, 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, 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, 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, int code, va_list_box *box, unsigned char flags[], int width, 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 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; } int OutputStream_isClosed(T S) { assert(S); return S->isclosed; } long long int 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 (uchar_t *t = (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.26.0/libmonit/src/io/OutputStream.h0000664000175000017500000001436013507751326020517 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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 */ int 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 int 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.26.0/libmonit/src/io/Dir.c0000664000175000017500000000466013507751326016556 0ustar martinpmartinp/* * 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 "system/System.h" #include "Str.h" #include "File.h" #include "Dir.h" /** * Implementation of the Dir interface * * @author http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ /* ----------------------------------------------------------- Definitions */ /* ---------------------------------------------------------------- Public */ /* ----------------------------------------------------------------- Class */ int 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; } int Dir_delete(const char *dir) { if (dir) return File_delete(dir); errno = EINVAL; return false; } int 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.26.0/libmonit/src/io/File.h0000664000175000017500000002714713507751326016731 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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 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_getLastError() 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. */ int 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 */ int 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 */ int 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 */ int 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 */ int File_isDirectory(const char *file); /** * Check if the file exist * @param file An absolute file path * @return true if file exist otherwise false */ int 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. */ int 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 */ mode_t 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 */ mode_t 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 */ int 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 */ int 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 */ int File_isExecutable(const char *file); /** * Delete file from the filesystem * @param file An absolute path * @return true if success otherwise false */ int 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 */ int 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 occured */ char *File_getRealPath(const char *path, char *resolved); #endif monit-5.26.0/libmonit/src/io/Dir.h0000664000175000017500000000536413507751326016565 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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_getLastError() can be * used to get a description of the error that occurred * @see File_umask() */ int 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_getLastError() can be * used to get a description of the error that occurred */ int 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_getLastError() can be * used to get a description of the error that occurred */ int 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.26.0/libmonit/src/io/InputStream.c0000664000175000017500000001144113507751326020306 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.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; boolean_t 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 occured 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 occured 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; } int 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.26.0/libmonit/src/Config.h0000664000175000017500000000521213507751326016635 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ #include "xconfig.h" #include #include #include #include #ifdef HAVE_MACH_BOOLEAN_H #include #endif #ifdef HAVE_UVM_UVM_PARAM_H #include #endif #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 /* ------------------------------------------------------------ Exceptions */ #include "AssertException.h" #include "IOException.h" #include "NumberFormatException.h" /* ------------------------------------------ General Purpose value macros */ /** * Standard String length */ #define STRLEN 256 /* ---------------------------------------------------------- Build macros */ /* Mask out GCC __attribute__ extension for non-gcc compilers. */ #ifndef __GNUC__ #define __attribute__(x) #endif /* ------------------------------------------------------ Type definitions */ /** * The internal 8-bit char type */ #ifndef HAVE_UCHAR_T typedef unsigned char uchar_t; #endif /** * The internal 32 bits integer type */ #ifndef HAVE_UINT32_T typedef unsigned int uint32_t; #endif /** * The internal boolean integer type */ #ifndef HAVE_BOOLEAN_T typedef enum { false = 0, true } __attribute__((__packed__)) boolean_t; #else #define false 0 #define true 1 #endif #endif monit-5.26.0/libmonit/aclocal.m40000664000175000017500000012246713507751341016341 0ustar martinpmartinp# generated automatically by aclocal 1.15.1 -*- Autoconf -*- # Copyright (C) 1996-2017 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.69],, [m4_warning([this file was generated for autoconf 2.69. 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-2017 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.15' 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.15.1], [], [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.15.1])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-2017 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-2017 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-2017 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-2017 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. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _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. FIXME. This creates each '.P' file that we will # 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" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2017 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 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_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([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 ]) 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-2017 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-2017 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-2017 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 to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2017 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 case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac 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-2017 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-2017 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-2017 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-2017 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-2017 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-2017 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-2017 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-2017 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]) monit-5.26.0/libmonit/m4/0000775000175000017500000000000013507751340015004 5ustar martinpmartinpmonit-5.26.0/libmonit/m4/lt~obsolete.m40000644000175000017500000001377413507751340017632 0ustar martinpmartinp# 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.26.0/libmonit/m4/libtool.m40000644000175000017500000112617113507751340016721 0ustar martinpmartinp# 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 cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru 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[[91]]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[[012]][[,.]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _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=cru} _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 if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && 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' ;; # 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.26.0/libmonit/m4/ltoptions.m40000644000175000017500000003426213507751340017306 0ustar martinpmartinp# 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.26.0/libmonit/m4/ltversion.m40000644000175000017500000000127313507751340017274 0ustar martinpmartinp# 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.26.0/libmonit/m4/ltsugar.m40000644000175000017500000001044013507751340016724 0ustar martinpmartinp# 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.26.0/libmonit/README.md0000664000175000017500000000040513507751326015746 0ustar martinpmartinp [![Monit](http://mmonit.com/monit/img/logo.png)](http://mmonit.com/monit) #Libmonit synthesis modules used by [Monit](http://mmonit.com/monit/) into a static library. Libmonit is built as part of Monit and is not meant to be installed nor distributed. --- monit-5.26.0/libmonit/libtool0000775000175000017500000122712613507751354016076 0ustar martinpmartinp#! /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='' # 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="/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="/bin/grep" # An ERE matcher. EGREP="/bin/grep -E" # A literal string matcher. FGREP="/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="cru" # 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="-Wno-address -Wno-pointer-sign -g -O2 -D _REENTRANT -Wall -Wunused -Wno-unused-label -funsigned-char -D_GNU_SOURCE -std=c99" # 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="/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/7 /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/libfakeroot /usr/local/lib /usr/local/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu " # 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 # ### 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-2" 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='eval 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=2014-01-07.03; # 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 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 eval $_G_hook '"$@"' # 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 done func_quote_for_eval ${1+"$@"} func_run_hooks_result=$func_quote_for_eval_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, remove any # options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # func_quote_for_eval ${1+"$@"} # my_options_prep_result=$func_quote_for_eval_result # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # # 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=: ;; # # 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 # ;; # *) set dummy "$_G_opt" "$*"; shift; break ;; # esac # done # # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # } # 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." # # func_quote_for_eval ${1+"$@"} # my_option_validation_result=$func_quote_for_eval_result # } # func_add_hook func_validate_options my_option_validation # # You'll alse 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 [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd func_options_prep ${1+"$@"} eval func_parse_options \ ${func_options_prep_result+"$func_options_prep_result"} eval func_validate_options \ ${func_parse_options_result+"$func_parse_options_result"} eval func_run_hooks func_options \ ${func_validate_options_result+"$func_validate_options_result"} # save modified positional parameters for caller func_options_result=$func_run_hooks_result } # 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 propogate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning. func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= # 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. func_run_hooks func_parse_options ${1+"$@"} # Adjust func_parse_options positional parameters to match eval set dummy "$func_run_hooks_result"; shift # Break out of the loop if we already parsed every option. test $# -gt 0 || break _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) test $# = 0 && func_missing_arg $_G_opt && break 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 ;; --) break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result } # 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 # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result } ## ----------------- ## ## 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-2 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= # 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 ;; esac # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _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; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result } 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 -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=*) 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.26.0/libmonit/configure0000775000175000017500000160361213507751342016406 0ustar martinpmartinp#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for libmonit 1.0. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -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_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: 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_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If 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 } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null 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_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS UNIT_TEST CPP 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__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V 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' 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 enable_optimized enable_profiling with_zlib ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS LT_SYS_LIBRARY_PATH CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null 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 # Accept the important Cygnus configure options, so we can diagnose typos. 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=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_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=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_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=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_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=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. 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. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; 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" ;; *) $as_echo "$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 || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then 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-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 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. CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _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=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF libmonit configure 1.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## --------------------------------------- ## ## Report this to monit-dev@tildeslash.com ## ## --------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type 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 libmonit $as_me 1.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file 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,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in config "$srcdir"/config; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. am__api_version='1.15' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if 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+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # 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' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "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=`$as_echo "$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 case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. 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 (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ '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+set}" = set; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi 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+set}" = set; 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} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else 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 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$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' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # 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 -' # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$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" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : 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= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type 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 # --------------------------------------------------------------------------- # Libtool # --------------------------------------------------------------------------- case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "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*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. 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 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. 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 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$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+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else 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 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; 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=$? $as_echo "$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=$? $as_echo "$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.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac 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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # 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=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && 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=$? $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else 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|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 $as_echo "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 $as_echo_n "checking for a working dd... " >&6; } if ${ac_cv_path_lt_DD+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 $as_echo "$ac_cv_path_lt_DD" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 $as_echo_n "checking how to truncate binary pipes... " >&6; } if ${lt_cv_truncate_bin+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 $as_echo "$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+set}" = set; 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=$? $as_echo "$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=$? $as_echo "$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=$? $as_echo "$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=$? $as_echo "$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" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else 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 () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$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=$? $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else 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 () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else 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 cru libconftest.a conftest.o" >&5 $AR cru 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$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[91]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _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_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : 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 : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; 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 enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; 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 enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; 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 pic_mode=default fi # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; 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 enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test "${with_aix_soname+set}" = set; 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 if ${lt_cv_with_aix_soname+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$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' ;; # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$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\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "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 ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; 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$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 ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; 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$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) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else 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 lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $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=$? $as_echo "$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=$? $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "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 ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else 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 () { ; 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$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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$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 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_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$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 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_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$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_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$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_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$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" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else 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=$? $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$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\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else 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=$? $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$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= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "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" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "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" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report what library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$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: # --------------------------------------------------------------------------- # Build options # --------------------------------------------------------------------------- UNIT_TEST="test" # Check whether --enable-optimized was given. if test "${enable_optimized+set}" = set; 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 OPTIMIZED=0 fi # Check whether --enable-profiling was given. if test "${enable_profiling+set}" = set; 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" profile="true" fi else profile="false" fi # Check whether --with-zlib was given. if test "${with_zlib+set}" = set; then : withval=$with_zlib; if test "x$withval" = "xyes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlibVersion in -lz" >&5 $as_echo_n "checking for zlibVersion in -lz... " >&6; } if ${ac_cv_lib_z_zlibVersion+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char zlibVersion (); int main () { return zlibVersion (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_zlibVersion=yes else ac_cv_lib_z_zlibVersion=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_zlibVersion" >&5 $as_echo "$ac_cv_lib_z_zlibVersion" >&6; } if test "x$ac_cv_lib_z_zlibVersion" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBZ 1 _ACEOF LIBS="-lz $LIBS" else zlib="false" as_fn_error $? "libz not found" "$LINENO" 5 fi for ac_header in zlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" if test "x$ac_cv_header_zlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ZLIB_H 1 _ACEOF fi done elif test "x$withval" != "xno"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlib in $withval" >&5 $as_echo_n "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 $as_echo "#define HAVE_LIBZ 1" >>confdefs.h $as_echo "#define HAVE_ZLIB_H 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } else zlib="false" as_fn_error $? "zlib not found in $withval" "$LINENO" 5 fi else zlib="false" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlibVersion in -lz" >&5 $as_echo_n "checking for zlibVersion in -lz... " >&6; } if ${ac_cv_lib_z_zlibVersion+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char zlibVersion (); int main () { return zlibVersion (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_zlibVersion=yes else ac_cv_lib_z_zlibVersion=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_zlibVersion" >&5 $as_echo "$ac_cv_lib_z_zlibVersion" >&6; } if test "x$ac_cv_lib_z_zlibVersion" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBZ 1 _ACEOF LIBS="-lz $LIBS" else zlib="false" as_fn_error $? "libz not found" "$LINENO" 5 fi for ac_header in zlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" if test "x$ac_cv_header_zlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ZLIB_H 1 _ACEOF fi done fi # --------------------------------------------------------------------------- # Libraries # --------------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_create=yes else ac_cv_lib_pthread_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF LIBS="-lpthread $LIBS" else as_fn_error $? "POSIX thread library is required" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for round in -lm" >&5 $as_echo_n "checking for round in -lm... " >&6; } if ${ac_cv_lib_m_round+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char round (); int main () { return round (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_round=yes else ac_cv_lib_m_round=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_round" >&5 $as_echo "$ac_cv_lib_m_round" >&6; } if test "x$ac_cv_lib_m_round" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF LIBS="-lm $LIBS" else as_fn_error $? "Math library is required" "$LINENO" 5 fi # --------------------------------------------------------------------------- # Header files # --------------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi for ac_header in ctype.h errno.h fcntl.h limits.h pthread.h setjmp.h \ signal.h stdarg.h stdio.h string.h string.h strings.h \ sys/socket.h sys/time.h sys/types.h unistd.h execinfo.h \ sys/sendfile.h sys/dirent.h poll.h sys/poll.h sys/event.h \ stropts.h sys/ioctl.h sys/filio.h kstat.h ifaddrs.h \ net/if_media.h netinet/in.h sys/sysctl.h net/if_dl.h \ sys/random.h sys/protosw.h mach/boolean.h uvm/uvm_param.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in net/if.h net/route.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " #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 eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in \ libperfstat.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " #ifdef HAVE_SYS_PROTOSW_H #include #endif " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # ------------------------------------------------------------------------ # Types # ------------------------------------------------------------------------ ac_fn_c_check_type "$LINENO" "boolean_t" "ac_cv_type_boolean_t" " #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_MACH_BOOLEAN_H #include #endif #ifdef HAVE_UVM_UVM_PARAM_H #include #endif " if test "x$ac_cv_type_boolean_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_BOOLEAN_T 1 _ACEOF fi 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 : cat >>confdefs.h <<_ACEOF #define HAVE_UCHAR_T 1 _ACEOF fi ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default" if test "x$ac_cv_type_uint32_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UINT32_T 1 _ACEOF fi # ------------------------------------------------------------------------ # Functions # ------------------------------------------------------------------------ # Require a working setjmp { $as_echo "$as_me:${as_lineno-$LINENO}: checking setjmp is available" >&5 $as_echo_n "checking setjmp is available... " >&6; } if ${libmonit_cv_setjmp_available+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : as_fn_error $? "cross-compiling: please set 'libmonit_cv_setjmp_available=yes|no'" "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { jmp_buf env; setjmp(env); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "setjmp is required See \`config.log' for more details" "$LINENO" 5; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libmonit_cv_setjmp_available" >&5 $as_echo "$libmonit_cv_setjmp_available" >&6; } # Require that we have vsnprintf that conforms to c99. I.e. does bounds check { $as_echo "$as_me:${as_lineno-$LINENO}: checking vsnprintf is c99 conformant" >&5 $as_echo_n "checking vsnprintf is c99 conformant... " >&6; } if ${libmonit_cv_vsnprintf_c99_conformant+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : as_fn_error $? "cross-compiling: please set 'libmonit_cv_vsnprintf_c99_conformant=yes|no'" "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { char t[1]; va_list ap; int n = vsnprintf(t, 1, "hello", ap); if(n == 5) return 0;return 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "vsnprintf does not conform to c99 See \`config.log' for more details" "$LINENO" 5; } fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libmonit_cv_vsnprintf_c99_conformant" >&5 $as_echo "$libmonit_cv_vsnprintf_c99_conformant" >&6; } for ac_func in timegm do : ac_fn_c_check_func "$LINENO" "timegm" "ac_cv_func_timegm" if test "x$ac_cv_func_timegm" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_TIMEGM 1 _ACEOF fi done # random number generators for ac_func in getrandom do : ac_fn_c_check_func "$LINENO" "getrandom" "ac_cv_func_getrandom" if test "x$ac_cv_func_getrandom" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETRANDOM 1 _ACEOF fi done for ac_func in arc4random_buf do : ac_fn_c_check_func "$LINENO" "arc4random_buf" "ac_cv_func_arc4random_buf" if test "x$ac_cv_func_arc4random_buf" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ARC4RANDOM_BUF 1 _ACEOF fi done # ------------------------------------------------------------------------ # Architecture/OS # ------------------------------------------------------------------------ architecture=`uname` if test "$architecture" = "Linux" then CFLAGS="$CFLAGS -D _REENTRANT" $as_echo "#define LINUX 1" >>confdefs.h elif test "$architecture" = "FreeBSD" then CFLAGS="$CFLAGS -D _REENTRANT" $as_echo "#define FREEBSD 1" >>confdefs.h elif test "$architecture" = "GNU/kFreeBSD" then CFLAGS="$CFLAGS -D _REENTRANT" $as_echo "#define FREEBSD 1" >>confdefs.h elif test "$architecture" = "OpenBSD" then CFLAGS="$CFLAGS -D _REENTRANT" $as_echo "#define OPENBSD 1" >>confdefs.h elif test "$architecture" = "DragonFly" then CFLAGS="$CFLAGS -D _REENTRANT" $as_echo "#define DRAGONFLY 1" >>confdefs.h elif test "$architecture" = "Darwin" then CFLAGS="$CFLAGS -DREENTRANT" $as_echo "#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 $as_echo "#define SOLARIS 1" >>confdefs.h elif test "$architecture" = "NetBSD" then CFLAGS="$CFLAGS -D_REENTRANT -Wno-char-subscripts" $as_echo "#define NETBSD 1" >>confdefs.h elif test "$architecture" = "AIX" then CFLAGS=`echo $CFLAGS|sed 's/-g//'` CFLAGS="$CFLAGS -D_THREAD_SAFE -D_REENTRANT" $as_echo "#define AIX 1" >>confdefs.h LIBS="$LIBS -lcfg -lodm -lperfstat" else as_fn_error $? "Architecture not supported: ${architecture}" "$LINENO" 5 fi # --------------------------------------------------------------------------- # Compiler # --------------------------------------------------------------------------- # Compiler characteristics { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else 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.$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 () { #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 () { #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 ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi 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 () { #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 () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi 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. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; 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 () { 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.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* 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 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#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 # If the compiler is gcc, tune warnings and make the char type unsigned # and enable C99 support if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -Wall -Wunused -Wno-unused-label -funsigned-char"; # Add C99 support CFLAGS="$CFLAGS -D_GNU_SOURCE -std=c99" # does this compiler support -Wno-pointer-sign ? svd_CFLAGS="$CFLAGS" CFLAGS="-Wno-pointer-sign $CFLAGS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else CFLAGS="$svd_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # does this compiler support -Wno-address ? svd_CFLAGS="$CFLAGS" CFLAGS="-Wno-address $CFLAGS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else CFLAGS="$svd_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi # ------------------------------------------------------------------------ # IPv6 Support # ------------------------------------------------------------------------ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IPv6 support" >&5 $as_echo_n "checking for IPv6 support... " >&6; } if ${ac_cv_ipv6+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_ipv6=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #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.*/ main() { 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 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ipv6" >&5 $as_echo "$ac_cv_ipv6" >&6; } if test $ac_cv_ipv6 = yes ; then $as_echo "#define IPV6 1" >>confdefs.h 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_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `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+set}" = set || &/ 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 { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$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=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "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 : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by libmonit $as_me 1.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac 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 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ libmonit config.status 1.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' 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 ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # 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"`' 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; 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; 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+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || 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=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac 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@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t 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"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$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 || $as_echo 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) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$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. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "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='' # 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 # ### 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" ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi cat < monit-5.26.0/configure.ac0000664000175000017500000007745313507751326015161 0ustar martinpmartinp# 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.26.0], [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 # ------------------------------------------------------------------------ # Libtool # ------------------------------------------------------------------------ AC_DISABLE_STATIC AC_PROG_LIBTOOL # ------------------------------------------------------------------------ # 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_STDC AC_HEADER_SYS_WAIT AC_HEADER_STAT AC_HEADER_TIME 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/boolean.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 \ setjmp.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/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 \ inttypes.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_CHECK_TYPES([boolean_t], [], [], [ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_MACH_BOOLEAN_H #include #endif #ifdef HAVE_UVM_UVM_PARAM_H #include #endif #ifdef HAVE_VM_VM_H #include #endif #ifdef HAVE_KINFO_H #include #endif ]) AC_TYPE_MODE_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_PID_T AC_TYPE_SIGNAL # 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) AC_MSG_CHECKING(for va_copy) AC_TRY_LINK([ #include ], [ va_list ap; va_list ap_copy; va_copy(ap, ap_copy); ], [ AC_MSG_RESULT(yes) AC_DEFINE([HAVE_VA_COPY], [1], [Define to 1 if VA_COPY is defined.]) ], [ AC_MSG_RESULT(no) ]) # ------------------------------------------------------------------------ # Compiler # ------------------------------------------------------------------------ # Compiler characteristics AC_C_CONST AC_C_BIGENDIAN # If the compiler is gcc, tune warnings and make the char type unsigned # and enable C99 support if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -Wall -Wunused -Wno-unused-label -funsigned-char"; # Add C99 support CFLAGS="$CFLAGS -D_GNU_SOURCE -std=c99" # does this compiler support -Wno-pointer-sign ? svd_CFLAGS="$CFLAGS" CFLAGS="-Wno-pointer-sign $CFLAGS" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return 0;])], [], [CFLAGS="$svd_CFLAGS"]) # does this compiler support -Wno-address ? svd_CFLAGS="$CFLAGS" CFLAGS="-Wno-address $CFLAGS" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return 0;])], [], [CFLAGS="$svd_CFLAGS"]) fi # ------------------------------------------------------------------------ # IPv6 Support # ------------------------------------------------------------------------ AC_ARG_WITH(ipv6, AS_HELP_STRING([--without-ipv6], [Disable the IPv6 support (default: enabled)]), [ if test "x$withval" = "xno" then use_ipv6=0 elif test "x$withval" = "xyes" then use_ipv6=1 fi ], [ use_ipv6=1 ] ) if test $use_ipv6 = 1 then AC_MSG_CHECKING(for IPv6 support) AC_CACHE_VAL(ac_cv_ipv6, AC_TRY_RUN([ #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.*/ main() { 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 AC_DEFINE([HAVE_IPV6], 1, [Define to 1 if the system supports IPv6]) else use_ipv6=0 fi fi # ------------------------------------------------------------------------ # Paths # ------------------------------------------------------------------------ # Find the right directory to put the root-mode PID file in AC_MSG_CHECKING([pid file location]) 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]) AC_DEFINE([HAVE_CPU_WAIT], [1], [Define to 1 if CPU wait information is available.]) 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" if test `uname -r | awk -F '.' '{print$1$2}'` -ge "26" then AC_DEFINE([HAVE_CPU_WAIT], [1], [Define to 1 if CPU wait information is available.]) fi elif test "$architecture" = "OpenBSD" then ARCH="OPENBSD" CFLAGS="$CFLAGS -D _REENTRANT" AC_CHECK_LIB([kvm], [kvm_open]) use_pam=0 # No PAM on OpenBSD (supports BSD Auth API instead of PAM) elif test "$architecture" = "FreeBSD" then ARCH="FREEBSD" CFLAGS="$CFLAGS -D _REENTRANT" AC_CHECK_LIB([devstat], [devstat_getnumdevs]) AC_CHECK_LIB([kvm], [kvm_open]) 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]) 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 -multiply_defined suppress" 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" AC_DEFINE([HAVE_CPU_WAIT], [1], [Define to 1 if CPU wait information is available.]) 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 use_largefiles=0 AC_MSG_RESULT([disabled]) fi if test "x$withval" = "xyes" ; then use_largefiles=1 AC_MSG_RESULT([enabled]) fi ], [ if test `uname` = "AIX" then use_largefiles=0 AC_MSG_RESULT([disabled]) else use_largefiles=1 AC_MSG_RESULT([enabled]) fi ] ) # Settings for largefiles support if test "$use_largefiles" = 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], [], [ 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 fi ],[ AC_CHECK_LIB([z], [zlibVersion], [], [ zlib="false" AC_MSG_ERROR([libz not found]) ]) 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" ; then use_pam=0 AC_MSG_RESULT([disabled]) fi if test "x$withval" = "xyes" ; then use_pam=1 AC_MSG_RESULT([enabled]) fi ], [ if test "$use_pam" = "0"; then AC_MSG_RESULT([disabled]) else use_pam=1 AC_MSG_RESULT([enabled]) fi ] ) if test "$use_pam" = "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 # ------------------------------------------------------------------------ # 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 use_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" ], [ use_sslstatic=0 AC_MSG_RESULT([disabled]) ] ) if test "$use_sslstatic" = "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 use_ssl=0 AC_MSG_RESULT([disabled]) fi if test "x$withval" = "xyes" ; then use_ssl=1 AC_MSG_RESULT([enabled]) fi ], [ use_ssl=1 AC_MSG_RESULT([enabled]) ] ) # Check for SSL directory if test "$use_ssl" = "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/${build} \ $maindir/lib/${build_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 "$use_sslstatic" = "1" -o "$use_ssl" = "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 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" OPTIMIZED=1 else OPTIMIZED=0 fi ], [ OPTIMIZED=0 ] ) 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" profile="true" else profile="false" fi ], [ profile="false" ] ) AM_CONDITIONAL([ENABLE_PROFILING], [test x$profile = xtrue]) # ------------------------------------------------------------------------ # Outputs # ------------------------------------------------------------------------ AH_BOTTOM([ /* Mask out GCC __attribute__ extension for non-gcc compilers. */ #ifndef __GNUC__ #define __attribute__(x) #endif ]) AC_CONFIG_HEADER([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 "$use_sslstatic" = "1" -o "$use_ssl" = "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 < $@ -rm -f pod2* # ------------- # Grammar rules # ------------- src/y.tab.c src/tokens.h: src/p.y $(YACC) $(YACCFLAGS) -o src/y.tab.c $< -mv src/y.tab.h src/tokens.h src/tokens.h: src/y.tab.c src/lex.yy.c: src/l.l $(FLEX) $(FLEXFLAGS) -o$@ $< monit-5.26.0/system/0000775000175000017500000000000013507751326014177 5ustar martinpmartinpmonit-5.26.0/system/bash/0000775000175000017500000000000013507751326015114 5ustar martinpmartinpmonit-5.26.0/system/bash/monit0000664000175000017500000000524613507751326016174 0ustar martinpmartinp# 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.26.0/system/startup/0000775000175000017500000000000013507751351015677 5ustar martinpmartinpmonit-5.26.0/system/startup/monit.service.in0000664000175000017500000000160413507751326021017 0ustar martinpmartinp# 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.target Documentation=man:monit(1) https://mmonit.com/wiki/Monit/HowTo [Service] Type=simple KillMode=process ExecStart=@prefix@/bin/monit -I -c @sysconfdir@/monitrc ExecStop=@prefix@/bin/monit -c @sysconfdir@/monitrc quit ExecReload=@prefix@/bin/monit -c @sysconfdir@/monitrc reload Restart=on-abnormal StandardOutput=null [Install] WantedBy=multi-user.target monit-5.26.0/system/startup/rc.monit0000664000175000017500000000237013507751326017357 0ustar martinpmartinp#! /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.26.0/system/startup/monit.service0000664000175000017500000000161513507751351020412 0ustar martinpmartinp# 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.target Documentation=man:monit(1) https://mmonit.com/wiki/Monit/HowTo [Service] Type=simple KillMode=process ExecStart=/usr/local/bin/monit -I -c ${prefix}/etc/monitrc ExecStop=/usr/local/bin/monit -c ${prefix}/etc/monitrc quit ExecReload=/usr/local/bin/monit -c ${prefix}/etc/monitrc reload Restart=on-abnormal StandardOutput=null [Install] WantedBy=multi-user.target monit-5.26.0/system/startup/monit.upstart0000664000175000017500000000102713507751351020451 0ustar martinpmartinp# 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 -c ${prefix}/etc/monitrc pre-stop exec /usr/local/bin/monit -c ${prefix}/etc/monitrc quit monit-5.26.0/system/startup/monit.upstart.in0000664000175000017500000000102113507751326021052 0ustar martinpmartinp# 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 -c @sysconfdir@/monitrc pre-stop exec @prefix@/bin/monit -c @sysconfdir@/monitrc quit monit-5.26.0/system/packages/0000775000175000017500000000000013507751326015755 5ustar martinpmartinpmonit-5.26.0/system/packages/redhat/0000775000175000017500000000000013507752065017225 5ustar martinpmartinpmonit-5.26.0/system/packages/redhat/monit.spec0000664000175000017500000001523513507752065021235 0ustar martinpmartinpName: monit Summary: Process monitor and restart utility Version: 5.26.0 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 README CHANGES %config(noreplace) /etc/monitrc %config /etc/init.d/%{name} %{_bindir}/%{name} %{_mandir}/man1/%{name}.1.gz %changelog * 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 inital spec file - Created a sample config file and a rc startup script monit-5.26.0/system/packages/freebsd/0000775000175000017500000000000013507751326017367 5ustar martinpmartinpmonit-5.26.0/system/packages/freebsd/pkg-message0000664000175000017500000000040513507751326021514 0ustar martinpmartinp===> 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.26.0/system/packages/freebsd/files/0000775000175000017500000000000013507751326020471 5ustar martinpmartinpmonit-5.26.0/system/packages/freebsd/files/monit.sh0000664000175000017500000000144113507751326022153 0ustar martinpmartinp#!/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.26.0/system/packages/freebsd/Makefile0000664000175000017500000000441213507751326021030 0ustar martinpmartinp# New ports collection makefile for: monit # Date created: 11 Januar 2006 # Whom: Martin Pala # # $FreeBSD$ # PORTNAME= monit PORTVERSION= 4.9 CATEGORIES= sysutils MASTER_SITES= http://www.tildeslash.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.26.0/system/packages/freebsd/pkg-descr0000664000175000017500000000227013507751326021172 0ustar martinpmartinpMonit 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: http://www.tildeslash.com/monit/ monit-5.26.0/system/packages/freebsd/README.porter0000664000175000017500000000217313507751326021564 0ustar martinpmartinp############################### # To update the FreeBSD port: # ############################### 1.) prerequisites: md5 sha256 (sysutils/freebsd-sha256) 2.) modify the port: portsnap fetch portsnap update cd /usr/ports/sysutils rm -rf monit-new cp -rp monit monit-new perl -p -i -e 's/^PORTVERSION=.*/PORTVERSION= ' monit-new/Makefile make -C monit-new makesum rm -rf /tmp/monit_port mkdir /tmp/monit_port diff -ruN monit monit-new > /tmp/monit_port/monit.patch cd monit-new portlint > /tmp/monit_port/portlint.txt make check-plist > /tmp/monit_port/make_check-plist.txt make stage-qa > /tmp/monit_port/make_stage-qa.txt 3.) send the port upgrade (for example using https://bugs.freebsd.org/bugzilla/) component: Individual Port(s) summary: [MAINTAINER] sysutils/monit: Update to severity: Affects Some People Version: Latest HW: Any OS: Any Attach the following files: monit.patch (set maintainer-approval+ if you're maintainer) portlint.txt make_check-plist.txt make_stage-qa.txt monit-5.26.0/system/packages/freebsd/distinfo0000664000175000017500000000027013507751326021130 0ustar martinpmartinpMD5 (monit-4.9.tar.gz) = bcbaab776a54d1e34e3a057c925de9ca SHA256 (monit-4.9.tar.gz) = 6963046fa976b682d27ac8e78cf7107d76c6907aef27b30f725f371ce64fb4bf SIZE (monit-4.9.tar.gz) = 573711 monit-5.26.0/config/0000775000175000017500000000000013507751340014114 5ustar martinpmartinpmonit-5.26.0/config/compile0000755000175000017500000001624513507751340015500 0ustar martinpmartinp#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2014 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*) 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/*) 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 ) 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 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: monit-5.26.0/config/missing0000755000175000017500000001533013507751340015513 0ustar martinpmartinp#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2014 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=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://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 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: monit-5.26.0/config/config.sub0000755000175000017500000010645013507751340016103 0ustar martinpmartinp#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-02-22' # 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/gitweb/?p=config.git;a=blob_plain;f=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. 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-2018 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" 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 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo "$1" | sed 's/-[^-]*$//'` if [ "$basic_machine" != "$1" ] then os=`echo "$1" | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -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*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | wasm32 \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-pc os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; asmjs) basic_machine=asmjs-unknown ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2*) basic_machine=m68k-bull os=-sysv3 ;; e500v[12]) basic_machine=powerpc-unknown os=$os"spe" ;; e500v[12]-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=$os"spe" ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; nsv-tandem) basic_machine=nsv-tandem ;; nsx-tandem) basic_machine=nsx-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh5el) basic_machine=sh5le-unknown ;; simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; x64) basic_machine=x86_64-pc ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; none) basic_machine=none-none os=-none ;; # 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) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases that might get confused # with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) -es1800*) os=-ose ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ | -midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -xray | -os68k* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4*) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $basic_machine in arm*) os=-eabi ;; *) os=-elf ;; esac ;; -nacl*) ;; -ios) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; pru-*) os=-elf ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $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 ;; -mvs* | -opened*) vendor=ibm ;; -os400*) 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 basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac echo "$basic_machine$os" exit # Local variables: # eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: monit-5.26.0/config/install-sh0000755000175000017500000003546313507751340016131 0ustar martinpmartinp#!/bin/sh # install - install a program, script, or datafile scriptversion=2014-09-12.12; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) # $RANDOM is not portable (e.g. dash); use it when possible to # lower collision chance tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 # As "mkdir -p" follows symlinks and we work in /tmp possibly; so # create the $tmpdir first (and fail if unsuccessful) to make sure # that nobody tries to guess the $tmpdir name. 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;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: monit-5.26.0/config/config.guess0000755000175000017500000012637313507751340016446 0ustar martinpmartinp#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-02-24' # 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/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . 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-2018 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 trap 'exit 1' 1 2 15 # 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. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > "$dummy.c" ; for c in cc gcc c89 c99 ; do if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; 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 ; set_cc_for_build= ;' # 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) >/dev/null 2>&1 ; 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/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval "$set_cc_for_build" cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl 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". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in 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) eval "$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. echo "$machine-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) 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. echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval "$set_cc_for_build" SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; 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'. echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; 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) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # 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:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval "$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; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval "$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 echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/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 echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 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 [ -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 [ "$HP_ARCH" = "" ]; then eval "$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 [ "$HP_ARCH" = hppa2.0w ] then eval "$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 echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) eval "$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; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; 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*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; 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:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; i*86:Minix:*:*) echo "$UNAME_MACHINE"-pc-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` 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 echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) eval "$set_cc_for_build" if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) if objdump -f /bin/sh | grep -q elf32-x86-64; then echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32 else echo "$UNAME_MACHINE"-pc-linux-"$LIBC" fi exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; 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 echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" exit ;; 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 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming 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. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; 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*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval "$set_cc_for_build" if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # 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 fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *: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 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; esac 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 </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 exit 1 # Local variables: # eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: monit-5.26.0/config/ltmain.sh0000644000175000017500000117147413507751336015756 0ustar martinpmartinp#! /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-2" 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='eval 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=2014-01-07.03; # 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 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 eval $_G_hook '"$@"' # 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 done func_quote_for_eval ${1+"$@"} func_run_hooks_result=$func_quote_for_eval_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, remove any # options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # func_quote_for_eval ${1+"$@"} # my_options_prep_result=$func_quote_for_eval_result # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # # 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=: ;; # # 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 # ;; # *) set dummy "$_G_opt" "$*"; shift; break ;; # esac # done # # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # } # 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." # # func_quote_for_eval ${1+"$@"} # my_option_validation_result=$func_quote_for_eval_result # } # func_add_hook func_validate_options my_option_validation # # You'll alse 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 [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd func_options_prep ${1+"$@"} eval func_parse_options \ ${func_options_prep_result+"$func_options_prep_result"} eval func_validate_options \ ${func_parse_options_result+"$func_parse_options_result"} eval func_run_hooks func_options \ ${func_validate_options_result+"$func_validate_options_result"} # save modified positional parameters for caller func_options_result=$func_run_hooks_result } # 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 propogate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning. func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= # 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. func_run_hooks func_parse_options ${1+"$@"} # Adjust func_parse_options positional parameters to match eval set dummy "$func_run_hooks_result"; shift # Break out of the loop if we already parsed every option. test $# -gt 0 || break _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) test $# = 0 && func_missing_arg $_G_opt && break 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 ;; --) break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result } # 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 # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result } ## ----------------- ## ## 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-2 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= # 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 ;; esac # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _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; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result } 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 -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=*) 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.26.0/doc/0000775000175000017500000000000013507751355013422 5ustar martinpmartinpmonit-5.26.0/doc/monit.pod0000664000175000017500000040670113507751326015262 0ustar martinpmartinp# 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. =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. =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. =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. =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. =item status [name] Print service status information. =item summary [name] 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. 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 log file is: [date] priority : message for example: [CET Jan 5 18:49:29] 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>. =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: CLIENTPEMFILE: CACERTIFICATEFILE: CACERTIFICATEPATH: } I set the specific SSL/TLS version to use. By default Monit uses AUTO. In AUTO mode, only TLS is used, SSLv2 and SSLv3 is considered obsolete. If you have to use SSLv2 or SSLv3, you must explicitly set the version. 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. 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 cointains 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 set 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. Example: set httpd port 2812 with ssl { pemfile: /etc/ssl/certs/monit.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 therefor 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 required pam_deny.so account required pam_permit.so A C config which only allows group C authenticated via PAM to access the web interface: set httpd port 2812 allow @admin =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 Finally 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. =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' PID changed out of Monit's control o A process' 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 failed 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 5 seconds. You can rise 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. Therefor 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: } 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 | ---------------------------------------------------------------------------------- =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 IF SUCCEEDED THEN ] 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 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. =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 user or kernel space and I/O. The user/system/wait modifier is optional, if not used, the total system cpu usage is tested. 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 DISK I/O TEST Monit can test process' 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. Per-process I/O activity statistics by platform: ----------------------------------- | Platform | Operation | Byte | ----------------------------------- | AIX | x | | | DragonFlyBSD | x | | | FreeBSD | x | | | Linux | | x | | MacOS | | x | | NetBSD | x | | | OpenBSD | x | | | Solaris | x | | ----------------------------------- =head3 Read: bytes per second Syntax: IF DISK 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 process p... if disk read > 1 MB/s then alert =head3 Read: operations per second Syntax: IF DISK READ 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 rate > 500 operations/s then alert =head3 Write: bytes per second Syntax: IF DISK WRITE /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 rate > 1 MB/s then alert =head3 Write: operations per second Syntax: IF DISK WRITE 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 rate > 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 PID TEST Monit can test the process' PID. This test is implicit and 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' parent PID (PPID) for changes. This test is implicit and 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 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). The asynchronous nature of the program check allows for non-blocking behaviour in the current Monit design, but it comes with a side-effect: when the program has finished executing and is waiting for Monit to collect the result, it becomes a so-called "zombie" process. A zombie process does not consume any system resources (only the PID remains in use) and it is under Monit's control and the zombie process is removed from the system as soon as Monit collects the exit status. This means that every "check program" will be associated with either a running process or a temporary zombie. This unwanted zombie side-effect will be removed in a later release of Monit. 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 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 FAILED LINK THEN action I is a choice of "ALERT", "RESTART", "START", "STOP", "EXEC" or "UNMONITOR". The test will fail if the link/interface is down or link errors were detected. Example: check network eth0 with interface eth0 if failed link then alert 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 failed link 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 therefor 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 therefor 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 FAILED PING[4|6] [COUNT number] [SIZE 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. 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 =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. TCP/UDP port test syntax: IF FAILED [HOST string] [ADDRESS string] [IPV4 | IPV6] [TYPE ] [ [with options {...}] [CERTIFICATE CHECKSUM [MD5|SHA1] string] [CERTIFICATE VALID for number DAYS] [PROTOCOL protocol | "string",...] [TIMEOUT number SECONDS] [RETRY number] THEN action Unix socket test syntax: IF FAILED [TYPE ] [PROTOCOL protocol | "string",...] [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 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 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. 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. 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 [USERNAME string PASSWORD string] I MySQL username (maximum 16 characters). I MySQL password (special characters can be used, but for non-alphanumerics the password has to be quoted). 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 login and perform a MySQL ping test. 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 =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] 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. =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 =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-2019 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.26.0/monit.10000664000175000017500000047437513507751355014111 0ustar martinpmartinp.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" 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 .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" .\" 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.26.0" "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. .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. .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. .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. .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. .IP "status [name]" 4 .IX Item "status [name]" Print service status information. .IP "summary [name]" 4 .IX Item "summary [name]" 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. .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 log file is: .PP .Vb 1 \& [date] priority : message .Ve .PP for example: .PP .Vb 1 \& [CET Jan 5 18:49:29] 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. .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 10 \& SET [OPTIONS] { \& VERSION: \& VERIFY: \& SELFSIGNED: \& CIPHERS: \& PEMFILE: \& 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\s0 is used, SSLv2 and SSLv3 is considered obsolete. If you have to use SSLv2 or SSLv3, you must explicitly set the version. .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 \&\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 cointains 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 set 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 Example: .PP .Vb 6 \& set httpd \& port 2812 \& with ssl { \& pemfile: /etc/ssl/certs/monit.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 therefor 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 5 \& # monit: auth account password session \& auth sufficient pam_securityserver.so \& auth sufficient pam_unix.so \& auth required pam_deny.so \& account required pam_permit.so .Ve .PP A \f(CW\*(C`monitrc\*(C'\fR config which only allows group \f(CW\*(C`admin\*(C'\fR authenticated via \&\s-1PAM\s0 to access the web interface: .PP .Vb 3 \& set httpd \& port 2812 \& allow @admin .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 Finally 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. .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\*(Aq PID changed out of Monit\*(Aqs control \& o A process\*(Aq 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 failed \& 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 5 seconds. You can rise 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. Therefor 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 11 \& SET LIMITS { \& PROGRAMOUTPUT: , \& SENDEXPECTBUFFER: , \& FILECONTENTBUFFER: , \& HTTPCONTENTBUFFER: , \& NETWORKTIMEOUT: \& PROGRAMTIMEOUT: \& STOPTIMEOUT: \& STARTTIMEOUT: \& RESTARTTIMEOUT: \& } .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 | \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- .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 IF SUCCEEDED THEN ] .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" 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. .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])\fR is the percent of time the system spend in user or kernel space and I/O. The user/system/wait modifier is optional, if not used, the total system cpu usage is tested. 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 DISK I/O TEST\s0" .IX Subsection "PROCESS DISK I/O TEST" Monit can test process' 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 Per-process I/O activity statistics by platform: .PP .Vb 12 \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& | Platform | Operation | Byte | \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& | AIX | x | | \& | DragonFlyBSD | x | | \& | FreeBSD | x | | \& | Linux | | x | \& | MacOS | | x | \& | NetBSD | x | | \& | OpenBSD | x | | \& | Solaris | x | | \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- .Ve .PP \fIRead: bytes per second\fR .IX Subsection "Read: bytes per second" .PP Syntax: .PP .Vb 1 \& IF DISK 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 process p... \& if disk read > 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 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 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 DISK WRITE /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 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 DISK WRITE 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 rate > 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\fImd5sum\fI\|(1)\fR or \&\fI\fIsha1sum\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 \fIregex\fR\|(7). .PP \&\fIpath\fR is an absolute path to a file containing extended regular expression on every line. See also \fIregex\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-1PID TEST\s0" .IX Subsection "PID TEST" Monit can test the process' \s-1PID.\s0 This test is implicit and 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' parent \s-1PID\s0 (\s-1PPID\s0) for changes. This test is implicit and 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-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 3 \& 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 The asynchronous nature of the program check allows for non-blocking behaviour in the current Monit design, but it comes with a side-effect: when the program has finished executing and is waiting for Monit to collect the result, it becomes a so-called \*(L"zombie\*(R" process. A zombie process does not consume any system resources (only the \s-1PID\s0 remains in use) and it is under Monit's control and the zombie process is removed from the system as soon as Monit collects the exit status. This means that every \*(L"check program\*(R" will be associated with either a running process or a temporary zombie. This unwanted zombie side-effect will be removed in a later release of Monit. .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-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 FAILED 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 test will fail if the link/interface is down or link errors were detected. .PP Example: .PP .Vb 2 \& check network eth0 with interface eth0 \& if failed link then alert .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 failed link 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 therefor 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 therefor 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 6 \& IF FAILED PING[4|6] \& [COUNT number] \& [SIZE 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 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 .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 \&\s-1TCP/UDP\s0 port test syntax: .PP .Vb 10 \& IF FAILED \& [HOST string] \& \& [ADDRESS string] \& [IPV4 | IPV6] \& [TYPE ] \& [ [with options {...}] \& [CERTIFICATE CHECKSUM [MD5|SHA1] string] \& [CERTIFICATE VALID for number DAYS] \& [PROTOCOL protocol | "string",...] \& [TIMEOUT number SECONDS] \& [RETRY number] \& THEN action .Ve .PP Unix socket test syntax: .PP .Vb 7 \& IF FAILED \& \& [TYPE ] \& [PROTOCOL protocol | "string",...] \& [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 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-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-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 \fIregex\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. .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 [USERNAME string PASSWORD string] .Ve .PP \&\fI\s-1USERNAME\s0\fR MySQL username (maximum 16 characters). .PP \&\fI\s-1PASSWORD\s0\fR MySQL password (special characters can be used, but for non-alphanumerics the password has to be quoted). .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 login and perform a MySQL ping test. 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 \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 3 \& SET MMONIT \& [TIMEOUT SECONDS] \& [REGISTER WITHOUT CREDENTIALS] .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. .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). .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\-2019 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; \fImd5sum\fR\|(1); \fIsha1sum\fR\|(1); \fIopenssl\fR\|(1); \fIglob\fR\|(7); \&\fIregex\fR\|(7); \fIhttps://mmonit.com\fR monit-5.26.0/COPYING0000664000175000017500000010417413507751326013715 0ustar martinpmartinp GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. 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.26.0/Makefile.in0000664000175000017500000012777413507751340014736 0ustar martinpmartinp# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2017 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) 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)/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.$(OBJEXT) src/sha1.$(OBJEXT) src/signal.$(OBJEXT) \ src/socket.$(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/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/Box.$(OBJEXT) src/terminal/Color.$(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__depfiles_maybe = 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 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)` ETAGS = etags CTAGS = ctags CSCOPE = cscope 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 \ 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 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@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ 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@ 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_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 = README 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.c \ src/sha1.c \ src/signal.c \ src/socket.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/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/Box.c \ src/terminal/Color.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/tokens.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__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ 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.$(OBJEXT): src/$(am__dirstamp) src/sha1.$(OBJEXT): src/$(am__dirstamp) src/signal.$(OBJEXT): src/$(am__dirstamp) src/socket.$(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/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/Box.$(OBJEXT): src/terminal/$(am__dirstamp) src/terminal/Color.$(OBJEXT): src/terminal/$(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/notification/*.$(OBJEXT) -rm -f src/process/*.$(OBJEXT) -rm -f src/protocols/*.$(OBJEXT) -rm -f src/ssl/*.$(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: $(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-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 ;;\ 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) dvi \ && $(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 all-am: Makefile $(PROGRAMS) $(MANS) 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: 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/notification/$(am__dirstamp) -rm -f src/process/$(am__dirstamp) -rm -f src/protocols/$(am__dirstamp) -rm -f src/ssl/$(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-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ 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 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 # ------- # 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 -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 -rm -f libmonit/Makefile.in libmonit/configure libmonit/aclocal.m4 libmonit/src/xconfig.h.in -rm -f Makefile.in configure aclocal.m4 autom4te.cache src/config.h.in monit.1 -rm -rf libmonit/m4 libmonit/config -rm -rf m4 config monit.1: doc/monit.pod $(POD2MAN) $(POD2MANFLAGS) $< > $@ -rm -f pod2* # ------------- # Grammar rules # ------------- src/y.tab.c src/tokens.h: src/p.y $(YACC) $(YACCFLAGS) -o src/y.tab.c $< -mv src/y.tab.h src/tokens.h src/tokens.h: src/y.tab.c src/lex.yy.c: src/l.l $(FLEX) $(FLEXFLAGS) -o$@ $< # 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.26.0/README0000664000175000017500000001053213507751326013534 0ustar martinpmartinp MONIT - UNIX Systems Management Introduction ------------ Monit is a free 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. Monit logs to syslog or to its own log file and notifies you about error conditions via customizable alert messages. Monit can perform various TCP/IP network checks, protocol checks and can utilize SSL for such checks. Monit provides an optional http(s) interface and you can use a browser to access the Monit program. System requirements ------------------- * Memory and Disk space A minimum of 1 megabytes RAM are required and around 500KB of free disk space. You may need more RAM depending on how many services Monit should monitor. * ANSI-C Compiler and Build System You will need an ANSI-C99 compiler installed to build Monit. The GNU C compiler (GCC) from the Free Software Foundation (FSF) is recommended. In addition, your PATH must contain basic build tools such as make. Installation ------------ Monit utilize the GNU auto-tools and provided the requirements above are satisfied, building Monit is conducted via the standard; ./configure make make install This will install Monit and the Monit man-file in /usr/local/bin and /usr/local/man/man1 respectively. If you want another location than /usr/local, run configure with the prefix options, like so: ./configure --prefix= Use ./configure --help for build and install options. By default, Monit is built with SSL, PAM and large file support. You may change this with the --without- options to ./configure. E.g. --without-ssl, --without-pam or --without-largefiles. QUICK START ----------- After you have built Monit you can simply start the monit program from the build directory to test it. Monit will use the monitrc control file located in this directory for its configuration. The file is setup to start Monit's http server so you have something interesting to look at; After you have started monit, point your browser to http://127.0.0.1:2812/ and log in with the username admin and password monit. Once started, monit will run as a background process. To stop monit, use monit quit. To run monit in the foreground and in diagnostic mode, start monit with the -Iv options. In diagnostic mode, monit will print debug information to the console. Use ctrl+c to stop monit in diagnostic mode. To see all options for the program, use monit -h. Copy monitrc in the build directory to ~/.monitrc or if you plan to run Monit as root, to /etc/monitc. Use this file as a starting point to write your own configuration file for Monit. DOCUMENTATION ------------- Please use `man monit' for an in-depth documentation of the program. More documentation can be found at http://mmonit.com/monit/ Acknowledgments --------------- Thanks to the Free Software Foundation (FSF) for hosting the mailing list and to Atlassian for hosting the code repository. The design of libmonit was inspired by principles put forth by David R. Hanson in his excellent book "C Interfaces and Implementations". You can learn more about this book here http://www.cs.princeton.edu/software/cii/ Contributing ------------ You are welcome to contribute to this project. Good pull requests, patches, improvements and new features are always helpful and appreciated. Please read the contributing guidelines before working on a patch. See https://bitbucket.org/tildeslash/monit Reporting a problem ------------------- If you believe you have found a bug, please use the issue tracker to report the problem. Remember to include the necessary information that will enable us to understand and reproduce this problem. If you have found a security vulnerabilities we appreciate if you will send this information to cve@tildeslash.com. Mailing list ------------ You can subscribe to Monitʼs mailing list to be the first to hear about new releases and important information about Monit. The mailing list is read-only with very low traffic. Please go here to subscribe; https://lists.nongnu.org/mailman/listinfo/monit-announce Contact information ------------------- Monit is a product of Tildeslash Ltd. a company registered in Norway and in United Kingdom. For further information about this Software, please visit http://mmonit.com/monit/ monit-5.26.0/CHANGES0000664000175000017500000000004613507751326013646 0ustar martinpmartinpSee https://mmonit.com/monit/changes/ monit-5.26.0/CONTRIBUTORS0000664000175000017500000000126013507751326014532 0ustar martinpmartinp# 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.26.0/monitrc0000644000175000017500000003127513507751326014257 0ustar martinpmartinp############################################################################### ## 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 # } ## 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 informations 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 # # ## 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 #} ############################################################################### ## 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, unmonitor # } 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 failed link 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 # # ############################################################################### ## Includes ############################################################################### ## ## It is possible to include additional configuration parts from other files or ## directories. # # include /etc/monit.d/* # monit-5.26.0/bootstrap0000775000175000017500000000076113507751326014622 0ustar martinpmartinp#!/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 if cd libmonit && ./bootstrap then echo "Success bootstrapping Monit" exit 0; fi fi echo "Failed bootstrapping Monit" exit 1; monit-5.26.0/src/0000775000175000017500000000000013507751355013444 5ustar martinpmartinpmonit-5.26.0/src/gc.c0000664000175000017500000004632213507751326014206 0ustar martinpmartinp/* * 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 _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 _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 _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 *); /** * Release allocated memory. * * @file */ /* ------------------------------------------------------------------ Public */ void gc() { Engine_destroyAllow(); if (Run.flags & Run_ProcessEngineEnabled) ProcessTree_delete(); if (servicelist) _gc_service_list(&servicelist); if (servicegrouplist) _gc_servicegroup(&servicegrouplist); 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); } /* ----------------------------------------------------------------- Private */ static void _gcssloptions(SslOptions_T o) { FREE(o->checksum); FREE(o->pemfile); 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)->actionratelist) _gcparl(&(*s)->actionratelist); if ((*s)->sizelist) _gcso(&(*s)->sizelist); 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)->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)->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); 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; } FREE((*s)->name); FREE((*s)->name_escaped); 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); } 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 _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 _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 _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); FREE((*d)->dependant); FREE((*d)->dependant_escaped); 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 *recv) { ASSERT(recv); if ((*recv)->next) _gc_mmonit(&(*recv)->next); _gc_url(&(*recv)->url); _gcssloptions(&((*recv)->ssl)); FREE(*recv); } 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); } monit-5.26.0/src/spawn.c0000664000175000017500000002105413507751326014740 0ustar martinpmartinp/* * 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_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_WAIT_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_PWD_H #include #endif #ifdef HAVE_GRP_H #include #endif #include "event.h" #include "alert.h" #include "monit.h" #include "engine.h" // libmonit #include "util/Str.h" #include "system/Time.h" /** * Function for spawning of a process. This function fork's twice to * avoid creating any zombie processes. Inspired by code from * W. Richard Stevens book, APUE. * * @file */ /* ------------------------------------------------------------- Definitions */ /* Do not exceed 8 bits here */ enum ExitStatus_E { setgid_ERROR = 0x1, setuid_ERROR = 0x2, initgroups_ERROR = 0x4, redirect_ERROR = 0x8, fork_ERROR = 0x10, getpwuid_ERROR = 0x20 } __attribute__((__packed__)); /* ----------------------------------------------------------------- Private */ /* * Setup the environment with special MONIT_xxx variables. The program * executed may use such variable for various purposes. */ static void _setMonitEnvironment(Service_T S, command_t C, Event_T E, const char *date) { setenv("MONIT_DATE", date, 1); setenv("MONIT_SERVICE", S->name, 1); setenv("MONIT_HOST", Run.system->name, 1); setenv("MONIT_EVENT", E ? Event_get_description(E) : C == S->start ? "Started" : C == S->stop ? "Stopped" : "No Event", 1); setenv("MONIT_DESCRIPTION", E ? E->message : C == S->start ? "Started" : C == S->stop ? "Stopped" : "No Event", 1); switch (S->type) { case Service_Process: if (S->inf.process->pid > -1) putenv(Str_cat("MONIT_PROCESS_PID=%d", S->inf.process->pid)); if (S->inf.process->children > -1) putenv(Str_cat("MONIT_PROCESS_CHILDREN=%d", S->inf.process->children)); if (S->inf.process->cpu_percent > -1) putenv(Str_cat("MONIT_PROCESS_CPU_PERCENT=%.1f", S->inf.process->cpu_percent)); putenv(Str_cat("MONIT_PROCESS_MEMORY=%llu", (unsigned long long)((double)S->inf.process->mem / 1024.))); break; case Service_Program: putenv(Str_cat("MONIT_PROGRAM_STATUS=%d", S->program->exitStatus)); break; default: break; } } /* ------------------------------------------------------------------ Public */ /** * Execute the given command. If the execution fails, the wait_start() * thread in control.c should notice this and send an alert message. * @param S A Service object * @param C A Command object * @param E An optional event object. May be NULL. */ void spawn(Service_T S, command_t C, Event_T E) { pid_t pid; sigset_t mask; sigset_t save; int stat_loc = 0; int exit_status; char date[42]; ASSERT(S); ASSERT(C); if (access(C->arg[0], X_OK) != 0) { LogError("Error: Could not execute %s\n", C->arg[0]); return; } /* * Block SIGCHLD */ sigemptyset(&mask); sigaddset(&mask, SIGCHLD); pthread_sigmask(SIG_BLOCK, &mask, &save); Time_string(Time_now(), date); pid = fork(); if (pid < 0) { LogError("Cannot fork a new process -- %s\n", STRERROR); pthread_sigmask(SIG_SETMASK, &save, NULL); return; } if (pid == 0) { if (C->has_gid) { if (setgid(C->gid) != 0) { stat_loc |= setgid_ERROR; } } if (C->has_uid) { struct passwd *user = getpwuid(C->uid); if (user) { setenv("HOME", user->pw_dir, 1); if (initgroups(user->pw_name, getgid()) == 0) { if (setuid(C->uid) != 0) { stat_loc |= setuid_ERROR; } } else { stat_loc |= initgroups_ERROR; } } else { stat_loc |= getpwuid_ERROR; } } _setMonitEnvironment(S, C, E, date); if (! (Run.flags & Run_Daemon)) { for (int i = 0; i < 3; i++) if (close(i) == -1 || open("/dev/null", O_RDWR) != i) stat_loc |= redirect_ERROR; } Util_closeFds(); setsid(); pid = fork(); if (pid < 0) { stat_loc |= fork_ERROR; _exit(stat_loc); } if (pid == 0) { /* * Reset all signals, so the spawned process is *not* created * with any inherited SIG_BLOCKs */ sigemptyset(&mask); pthread_sigmask(SIG_SETMASK, &mask, NULL); signal(SIGINT, SIG_DFL); signal(SIGHUP, SIG_DFL); signal(SIGTERM, SIG_DFL); signal(SIGUSR1, SIG_DFL); signal(SIGPIPE, SIG_DFL); (void) execv(C->arg[0], C->arg); _exit(errno); } /* Exit first child and return errors to parent */ _exit(stat_loc); } /* Wait for first child - aka second parent, to exit */ if (waitpid(pid, &stat_loc, 0) != pid) { LogError("Waitpid error\n"); } exit_status = WEXITSTATUS(stat_loc); if (exit_status & setgid_ERROR) LogError("Failed to change gid to '%d' for '%s'\n", C->gid, C->arg[0]); if (exit_status & setuid_ERROR) LogError("Failed to change uid to '%d' for '%s'\n", C->uid, C->arg[0]); if (exit_status & initgroups_ERROR) LogError("initgroups for UID %d failed when executing '%s'\n", C->uid, C->arg[0]); if (exit_status & fork_ERROR) LogError("Cannot fork a new process for '%s'\n", C->arg[0]); if (exit_status & redirect_ERROR) LogError("Cannot redirect IO to /dev/null for '%s'\n", C->arg[0]); if (exit_status & getpwuid_ERROR) LogError("UID %d not found on the system when executing '%s'\n", C->uid, C->arg[0]); /* * Restore the signal mask */ pthread_sigmask(SIG_SETMASK, &save, NULL); /* * We do not need to wait for the second child since we forked twice, * the init system-process will wait for it. So we just return */ } monit-5.26.0/src/util.c0000664000175000017500000024645713507751326014605 0ustar martinpmartinp/* * 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 "ProcessTree.h" #include "event.h" #include "state.h" #include "protocol.h" // libmonit #include "io/File.h" #include "util/Fmt.h" #include "system/Time.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 char *is_str_defined(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 ) 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 boolean_t 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; } rv = pam_authenticate(pamh, PAM_SILENT); if (pam_end(pamh, rv) != PAM_SUCCESS) pamh = NULL; 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); int i = Util_countWords(*src, old); if (i) { size_t l = strlen(old); size_t d = strlen(new) - l; if (d > 0) { d *= 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; } int Util_countWords(char *s, const char *word) { int i = 0; char *p = s; ASSERT(s && word); while ((p = strstr(p, word))) { i++; p++; } return i; } void Util_handleEscapes(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 'n': *(buf + insertpos) = '\n'; editpos++; break; case 't': *(buf + insertpos) = '\t'; editpos++; break; case 'r': *(buf + insertpos) = '\r'; editpos++; break; case ' ': *(buf + insertpos) = ' '; editpos++; break; case '0': if (*(buf + editpos+2) == 'x') { if ((*(buf + editpos + 3) == '0' && *(buf + editpos + 4) == '0')) { /* 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 { *(buf + insertpos) = _x2c(&buf[editpos + 3]); editpos += 4; } } break; case '\\': *(buf + insertpos) = '\\'; editpos++; break; default: *(buf + insertpos) = *(buf + editpos); } } else { *(buf + insertpos) = *(buf + editpos); } } *(buf + insertpos) = '\0'; } 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; } char *Util_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; } boolean_t Util_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 Util_printHash(char *file) { MD_T hash; unsigned char sha1[STRLEN], md5[STRLEN]; FILE *fhandle = NULL; if (! (fhandle = file ? fopen(file, "r") : stdin) || ! Util_getStreamDigests(fhandle, sha1, md5) || (file && fclose(fhandle))) { printf("%s: %s\n", file, STRERROR); exit(1); } printf("SHA1(%s) = %s\n", file ? file : "stdin", Util_digest2Bytes(sha1, 20, hash)); printf("MD5(%s) = %s\n", file ? file : "stdin", Util_digest2Bytes(md5, 16, hash)); } boolean_t Util_getChecksum(char *file, Hash_Type hashtype, char *buf, int 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: LogError("checksum: invalid hash type: 0x%x\n", hashtype); return false; } if (File_isFile(file)) { FILE *f = fopen(file, "r"); if (f) { boolean_t fresult = false; MD_T sum; switch (hashtype) { case Hash_Md5: fresult = Util_getStreamDigests(f, NULL, sum); break; case Hash_Sha1: fresult = Util_getStreamDigests(f, sum, NULL); break; default: break; } if (fclose(f)) LogError("checksum: error closing file '%s' -- %s\n", file, STRERROR); if (! fresult) { LogError("checksum: file %s stream error (0x%x)\n", file, fresult); return false; } Util_digest2Bytes((unsigned char *)sum, hashlength, buf); return true; } else LogError("checksum: failed to open file %s -- %s\n", file, STRERROR); } else LogError("checksum: file %s is not regular file\n", file); return false; } void Util_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); } Service_T Util_getService(const char *name) { ASSERT(name); for (Service_T s = servicelist; s; s = s->next) if (IS(s->name, name)) return s; return NULL; } int Util_getNumberOfServices() { int i = 0; Service_T s; for (s = servicelist; s; s = s->next) i += 1; return i; } boolean_t Util_existService(const char *name) { ASSERT(name); return Util_getService(name) ? true : false; } void Util_printRunList() { 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 = }\n", " "); printf(" %-18s = %s\n", "On reboot", onrebootnames[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 with timeout %s", c->url->url, 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'", checksumnames[c->ssl.checksumType], c->ssl.checksum); } #endif if (Run.flags & Run_MmonitCredentials && c->url->user) printf(" with credentials"); if (c->next) printf(",\n = "); } printf("\n"); } 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'", checksumnames[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); #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 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); boolean_t sgheader = false; char buffer[STRLEN]; StringBuffer_T buf = StringBuffer_create(STRLEN); printf("%-21s = %s\n", StringBuffer_toString(StringBuffer_append(buf, "%s Name", servicetypes[s->type])), s->name); for (ServiceGroup_T o = servicegrouplist; 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", modenames[s->mode]); printf(" %-20s = %s\n", "On reboot", onrebootnames[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(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(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(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(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(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(buf, o->action, "if exit value changed"))); else printf(" %-20s = %s\n", "Status", StringBuffer_toString(Util_printRule(buf, o->action, "if exit value %s %d", operatorshortnames[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(buf, s->checksum->action, "if changed %s", checksumnames[s->checksum->type])) : StringBuffer_toString(Util_printRule(buf, s->checksum->action, "if failed %s(%s)", s->checksum->hash, checksumnames[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(buf, s->perm->action, "if changed")) : StringBuffer_toString(Util_printRule(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(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(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(buf, o->action, "if failed %s", o->attribute))); } if (s->gid && s->gid->action) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "GID", StringBuffer_toString(Util_printRule(buf, s->gid->action, "if failed %d", s->gid->gid))); } for (Icmp_T o = s->icmplist; o; o = o->next) { StringBuffer_clear(buf); const char *output = StringBuffer_toString(Util_printRule(buf, o->action, "if failed [count %d size %d with timeout %s%s%s]", o->count, o->size, Fmt_time2str(o->timeout, (char[11]){}), o->outgoing.ip ? " via address " : "", o->outgoing.ip ? o->outgoing.ip : "")); switch (o->family) { case Socket_Ip4: printf(" %-20s = %s\n", "Ping4", output); break; case Socket_Ip6: printf(" %-20s = %s\n", "Ping6", output); break; default: printf(" %-20s = %s\n", "Ping", output); break; } } for (Port_T o = s->portlist; o; o = o->next) { StringBuffer_T buf2 = StringBuffer_create(64); StringBuffer_append(buf2, "if failed [%s]:%d%s", 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); #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'", checksumnames[o->target.net.ssl.options.checksumType], o->target.net.ssl.options.checksum); } #endif StringBuffer_clear(buf); printf(" %-20s = %s\n", "Port", StringBuffer_toString(Util_printRule(buf, o->action, "%s", StringBuffer_toString(buf2)))); StringBuffer_free(&buf2); } for (Port_T o = s->socketlist; o; o = o->next) { StringBuffer_clear(buf); if (o->retry > 1) printf(" %-20s = %s\n", "Unix Socket", StringBuffer_toString(Util_printRule(buf, o->action, "if failed %s type %s protocol %s with timeout %s and retry %d times", o->target.unix.pathname, Util_portTypeDescription(o), o->protocol->name, Fmt_time2str(o->timeout, (char[11]){}), o->retry))); else printf(" %-20s = %s\n", "Unix Socket", StringBuffer_toString(Util_printRule(buf, o->action, "if failed %s type %s protocol %s with timeout %s", o->target.unix.pathname, Util_portTypeDescription(o), o->protocol->name, Fmt_time2str(o->timeout, (char[11]){})))); } for (Timestamp_T o = s->timestamplist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", timestampnames[o->type], o->test_changes ? StringBuffer_toString(Util_printRule(buf, o->action, "if changed")) : StringBuffer_toString(Util_printRule(buf, o->action, "if %s %s", operatornames[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(buf, o->action, "if changed")) : StringBuffer_toString(Util_printRule(buf, o->action, "if %s %llu byte(s)", operatornames[o->operator], o->size)) ); } for (LinkStatus_T o = s->linkstatuslist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Link status", StringBuffer_toString(Util_printRule(buf, o->action, "if failed"))); } for (LinkSpeed_T o = s->linkspeedlist; o; o = o->next) { StringBuffer_clear(buf); printf(" %-20s = %s\n", "Link capacity", StringBuffer_toString(Util_printRule(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(buf, o->action, "if %s %.1f%%", operatornames[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(buf, o->action, "if %s %s/s", operatornames[o->operator], Fmt_bytes2str(o->limit, buffer)))); } else { printf(" %-20s = %s\n", "Total upload bytes", StringBuffer_toString(Util_printRule(buf, o->action, "if %s %s in last %d %s(s)", operatornames[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(buf, o->action, "if %s %lld packets/s", operatornames[o->operator], o->limit))); } else { printf(" %-20s = %s\n", "Total upload packets", StringBuffer_toString(Util_printRule(buf, o->action, "if %s %lld packets in last %d %s(s)", operatornames[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(buf, o->action, "if %s %s/s", operatornames[o->operator], Fmt_bytes2str(o->limit, buffer)))); } else { printf(" %-20s = %s\n", "Total download bytes", StringBuffer_toString(Util_printRule(buf, o->action, "if %s %s in last %d %s(s)", operatornames[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(buf, o->action, "if %s %lld packets/s", operatornames[o->operator], o->limit))); } else { printf(" %-20s = %s\n", "Total downl. packets", StringBuffer_toString(Util_printRule(buf, o->action, "if %s %lld packets in last %d %s(s)", operatornames[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(buf, o->action, "if %s %llu second(s)", operatornames[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(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(buf, o->action, "if content %s \"%s\"", o->not ? "!=" : "=", o->match_string))); } } 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(buf, o->action, "if %s %lld", operatornames[o->operator], o->limit_absolute)) : StringBuffer_toString(Util_printRule(buf, o->action, "if %s %.1f%%", operatornames[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(buf, o->action, "if %s %lld", operatornames[o->operator], o->limit_absolute)) : StringBuffer_toString(Util_printRule(buf, o->action, "if %s %.1f%%", operatornames[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(buf, o->action, "if %s %s", operatornames[o->operator], Fmt_bytes2str(o->limit_absolute, buffer)))); } else { printf(" %-20s = %s\n", "Space usage limit", StringBuffer_toString(Util_printRule(buf, o->action, "if %s %.1f%%", operatornames[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(buf, o->action, "if %s %s", operatornames[o->operator], Fmt_bytes2str(o->limit_absolute, buffer)))); } else { printf(" %-20s = %s\n", "Space free limit", StringBuffer_toString(Util_printRule(buf, o->action, "if %s %.1f%%", operatornames[o->operator], o->limit_percent))); } } else if (o->resource == Resource_ReadBytes) { printf(" %-20s = %s\n", "Read limit", StringBuffer_toString(Util_printRule(buf, o->action, "if read %s %s/s", operatornames[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(buf, o->action, "if read %s %llu operations/s", operatornames[o->operator], o->limit_absolute))); } else if (o->resource == Resource_WriteBytes) { printf(" %-20s = %s\n", "Write limit", StringBuffer_toString(Util_printRule(buf, o->action, "if write %s %s/s", operatornames[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(buf, o->action, "if write %s %llu operations/s", operatornames[o->operator], o->limit_absolute))); } else if (o->resource == Resource_ServiceTime) { printf(" %-20s = %s\n", "Service time limit", StringBuffer_toString(Util_printRule(buf, o->action, "if service time %s %s/operation", operatornames[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 wait 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 = ", "Disk read limit"); break; case Resource_ReadOperations: printf(" %-20s = ", "Disk read limit"); break; case Resource_WriteBytes: 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_MemoryPercent: case Resource_SwapPercent: printf("%s", StringBuffer_toString(Util_printRule(buf, o->action, "if %s %.1f%%", operatornames[o->operator], o->limit))); break; case Resource_MemoryKbyte: case Resource_SwapKbyte: case Resource_MemoryKbyteTotal: printf("%s", StringBuffer_toString(Util_printRule(buf, o->action, "if %s %s", operatornames[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(buf, o->action, "if %s %.1f", operatornames[o->operator], o->limit))); break; case Resource_Threads: case Resource_Children: printf("%s", StringBuffer_toString(Util_printRule(buf, o->action, "if %s %.0f", operatornames[o->operator], o->limit))); break; case Resource_ReadBytes: case Resource_WriteBytes: printf("%s", StringBuffer_toString(Util_printRule(buf, o->action, "if %s %s/s", operatornames[o->operator], Fmt_bytes2str(o->limit, (char[10]){})))); break; case Resource_ReadOperations: case Resource_WriteOperations: printf("%s", StringBuffer_toString(Util_printRule(buf, o->action, "if %s %.0f operations/s", operatornames[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() { Service_T s; char ruler[STRLEN]; printf("The service list contains the following entries:\n\n"); for (s = servicelist_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[32] = {}; MD_T digest; System_random(buf, sizeof(buf)); md5_init(&ctx); md5_append(&ctx, (const md5_byte_t *)buf, STRLEN - 1); md5_finish(&ctx, (md5_byte_t *)digest); Util_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) { LogError("Error opening the idfile '%s' -- %s\n", idfile, STRERROR); return NULL; } fprintf(file, "%s", Util_getToken(Run.id)); LogInfo(" New Monit id: %s\n Stored in '%s'\n", Run.id, idfile); } else { if (! File_isFile(idfile)) { LogError("idfile '%s' is not a regular file\n", idfile); return NULL; } if ((file = fopen(idfile,"r")) == (FILE *)NULL) { LogError("Error opening the idfile '%s' -- %s\n", idfile, STRERROR); return NULL; } if (fscanf(file, "%64s", Run.id) != 1) { LogError("Error reading id from file '%s'\n", idfile); if (fclose(file)) LogError("Error closing file '%s' -- %s\n", idfile, STRERROR); return NULL; } } if (fclose(file)) LogError("Error closing file '%s' -- %s\n", idfile, STRERROR); return Run.id; } pid_t Util_getPid(char *pidfile) { FILE *file = NULL; int pid = -1; ASSERT(pidfile); if (! File_exist(pidfile)) { DEBUG("pidfile '%s' does not exist\n", pidfile); return 0; } if (! File_isFile(pidfile)) { DEBUG("pidfile '%s' is not a regular file\n", pidfile); return 0; } if ((file = fopen(pidfile,"r")) == (FILE *)NULL) { DEBUG("Error opening the pidfile '%s' -- %s\n", pidfile, STRERROR); return 0; } 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 0; } if (fclose(file)) DEBUG("Error closing file '%s' -- %s\n", pidfile, STRERROR); if (pid < 0) return(0); return (pid_t)pid; } boolean_t 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(char *string, boolean_t isParameterValue) { char *escaped = NULL; if (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 = ALLOC(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)) ) { LogError("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() { for (int i = 0; i < 3; i++) { if (close(i) == -1 || open("/dev/null", O_RDWR) != i) { LogError("Cannot reopen standard file descriptor (%d) -- %s\n", i, STRERROR); } } } void Util_closeFds() { for (int i = 3, descriptors = System_getDescriptorsGuarded(); 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 } boolean_t 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, '$'))) { LogError("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, '$'))) { LogError("Password not in MD5 format.\n"); return false; } *temp = '\0'; if (md5_crypt(outside, id, salt, outside_crypt, sizeof(outside_crypt)) == NULL) { LogError("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: LogError("Unknown password digestion method.\n"); return false; } if (Str_compareConstantTime(outside_crypt, c->passwd) == 0) return true; return false; } 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->flagsChanged = false; *(s->inf.filesystem->flags) = 0; s->inf.filesystem->mode = -1; s->inf.filesystem->uid = -1; s->inf.filesystem->gid = -1; _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->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->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->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->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; } } boolean_t 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); boolean_t 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; } boolean_t 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: LogError("Unknown comparison operator\n"); return false; } return false; } boolean_t 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: LogError("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(actionnames[i])) { if (IS(action, actionnames[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", actionnames[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(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 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) { 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; 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.26.0/src/socket.h0000664000175000017500000002020713507751326015104 0ustar martinpmartinp/* * 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 } __attribute__((__packed__)) Socket_Type; typedef enum { Socket_Unix = 0, Socket_Ip, // IP, version not specified (IPv4 or IPv6) Socket_Ip4, // IPv4 only Socket_Ip6 // IPv6 only } __attribute__((__packed__)) 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 */ boolean_t 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 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, 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.26.0/src/env.c0000664000175000017500000000576513507751326014413 0ustar martinpmartinp/* * 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() { 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.26.0/src/socket.c0000664000175000017500000006270713507751326015112 0ustar martinpmartinp/* * 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 } __attribute__((__packed__)) 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; } int _getPort(const struct sockaddr *addr) { if (addr->sa_family == AF_INET) return ntohs(((struct sockaddr_in *)addr)->sin_port); #ifdef HAVE_IPV6 else if (addr->sa_family == AF_INET6) return ntohs(((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", ((struct sockaddr_un *)addr)->sun_path); } else { char ip[46], port[6]; int status = getnameinfo(addr, addrlen, ip, sizeof(ip), port, sizeof(port), NI_NUMERICHOST | NI_NUMERICSERV); if (status) { LogError("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 boolean_t _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; rv = poll(fds, 1, timeout); 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; } 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, SslOptions_T options, 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; if (options->flags == SSL_Enabled) { TRY { Socket_enableSsl(S, options, host); } ELSE { Socket_free(&S); RETHROW; } END_TRY; } 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[STRLEN]){}, STRLEN), STRERROR); } THROW(IOException, "%s", error); return NULL; } 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: LogError("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) { LogError("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, options, timeout); } ELSE { snprintf(error, sizeof(error), "%s", Exception_frame.message); } END_TRY; } freeaddrinfo(result); if (! S) LogError("Cannot create socket 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) { LogError("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; } LogError("Unix socket %s connection error -- %s\n", path, error); } else { LogError("Cannot set nonblocking unix socket %s -- %s\n", path, STRERROR); } error: Net_close(s); if (type == Socket_Udp) unlink(unixsocket_client.sun_path); } else { LogError("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)->sslserver, &((*S)->ssl)); } } else #endif { int type; socklen_t length = sizeof(type); int rv = getsockopt((*S)->socket, SOL_SOCKET, SO_TYPE, &type, &length); if (rv) { LogError("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; } boolean_t 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; } 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; LogError("Cannot translate address to hostname -- %s\n", status == EAI_SYSTEM ? STRERROR : gai_strerror(status)); } else { LogError("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) { const struct sockaddr *localaddr = p->outgoing.addrlen ? (struct sockaddr *)&(p->outgoing.addr) : NULL; volatile T S = NULL; TRY { S = _createIpSocket(p->hostname, r->ai_addr, r->ai_addrlen, localaddr, p->outgoing.addrlen, r->ai_family, r->ai_socktype, r->ai_protocol, &(p->target.net.ssl.options), p->timeout); S->Port = p; TRY { p->protocol->check(S); } FINALLY { #ifdef HAVE_OPENSSL // Set the minimum valid days past the protocol check as if the connection uses STARTTLS to switch plain->SSL, we have no SSL certificate informations 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 p->target.net.ssl.certificate.validDays = Ssl_getCertificateValidDays(S->ssl); #endif } END_TRY; 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 { int64_t 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->response = (double)(Time_micro() - start) / 1000.; // Convert microseconds to milliseconds p->is_available = Connection_Ok; } ELSE { p->is_available = Connection_Failed; p->response = -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, void *b, size_t size) { ssize_t n = 0; 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 += n; size -= n; } if (n < 0) { /* No write or a partial write is an error */ return -1; } return (int)(p - 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.26.0/src/state.h0000664000175000017500000000575313507751326014745 0ustar martinpmartinp/* * 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 * overriden 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 */ boolean_t 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 */ boolean_t State_reboot(void); #endif monit-5.26.0/src/util.h0000664000175000017500000002541713507751326014601 0ustar martinpmartinp/* * 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 */ int Util_countWords(char *s, const char *word); /** * Exchanges \escape sequences in a string * @param buf A string */ void 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); /** * 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 *Util_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 */ boolean_t Util_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 Util_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 */ boolean_t Util_getChecksum(char *file, Hash_Type hashtype, char *buf, int 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 Util_hmacMD5(const unsigned char *data, int datalen, const unsigned char *key, int keylen, unsigned char *digest); /** * @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 */ boolean_t 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 0 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 */ boolean_t 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(char *string, boolean_t 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 registred 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 */ boolean_t 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 */ boolean_t 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 */ boolean_t 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 */ boolean_t 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); /* * Retun 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 buf StringBuffer * @param action An EventAction object * @param rule Rule description * @return StringBuffer reference */ StringBuffer_T Util_printRule(StringBuffer_T buf, EventAction_T action, const char *rule, ...) __attribute__((format (printf, 3, 4))); /** * 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); #endif monit-5.26.0/src/l.l0000664000175000017500000010356113507751326014060 0ustar martinpmartinp/* * 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 %{ /* * 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 "tokens.h" // libmonit #include "util/Str.h" // we don't use yyinput => do not generate it #define YY_NO_INPUT #define MAX_STACK_DEPTH 512 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 } __attribute__((__packed__)) 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, 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)?[ ]*\) 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 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 */} 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 SSL; } ssl { return SSL; } ssl[ \t]+enable { return SSL; } enable[ ]+ssl { return SSL; } 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; } saturation { return SATURATION; } speed { return SPEED; } total { return TOTAL; } clientpemfile { return CLIENTPEMFILE; } allowselfcertification { return ALLOWSELFCERTIFICATION; } selfsigned { return SELFSIGNED; } certmd5 { return CERTMD5; } pemfile { return PEMFILE; } 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; } 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 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 SSLAUTO; } inode(s)? { return INODE; } space { return SPACE; } free { return TFREE; } perm(ission)? { return PERMISSION; } exec(ute)? { return EXEC; } size { return SIZE; } uptime { return UPTIME; } 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; } 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; } credentials { return CREDENTIALS; } register { return REGISTER; } fsflag(s)? { return FSFLAG; } fips { return FIPS; } {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; } {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; } "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++; yylval.url->password = Str_ndup(yytext, strlen(yytext)-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 && *name) yylval.address->name = Str_unquote(Str_dup(yytext)); } [<>:\[\]] { // 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"); } } { {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; } . { 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); Util_handleEscapes(buf); 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), (char *)path); } static void include_file(char *pattern) { glob_t globbuf; errno = 0; if (glob(pattern, GLOB_MARK, NULL, &globbuf) == 0) { for (int 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, 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; } monit-5.26.0/src/event.h0000664000175000017500000001157313507751326014743 0ustar martinpmartinp/* * 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; char *description_failed; char *description_succeeded; char *description_changed; 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 orginated, 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, char *s, ...) __attribute__((format (printf, 5, 6))); /** * Get a textual description of actual event type. For instance if the * event type is possitive 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 possitive 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 partialy handled event queue */ void Event_queue_process(void); #endif monit-5.26.0/src/alert.h0000664000175000017500000000423313507751326014724 0ustar martinpmartinp/* * 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 registred 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.26.0/src/http/0000775000175000017500000000000013507751326014421 5ustar martinpmartinpmonit-5.26.0/src/http/engine.c0000664000175000017500000004722013507751326016037 0ustar martinpmartinp/* * 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 "net.h" #include "processor.h" #include "cervlet.h" #include "socket.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 boolean_t stopped = false; static int myServerSocketsCount = 0; static struct pollfd myServerSockets[3] = {}; static HostsAllow_T allowlist = NULL; /* ----------------------------------------------------------------- Private */ static boolean_t _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) LogWarning("Skipping 'allow %s' -- host resolved to [%s] which is present in ACL already\n", pattern, buf); else LogWarning("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 boolean_t _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 boolean_t _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 boolean_t _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 boolean_t _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 boolean_t _authenticateHost(struct sockaddr *addr) { if (addr->sa_family == AF_INET) { boolean_t 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))) LogError("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) { boolean_t allow = false; struct sockaddr_in6 *a = (struct sockaddr_in6 *)addr; if (! (allow = _isAllowed((uint32_t *)&(a->sin6_addr)))) LogError("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() { 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) { LogError("HTTP server: cannot accept connection -- %s\n", stopped ? "service stopped" : STRERROR); return NULL; } if (Net_setNonBlocking(client) < 0 || ! 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() { Engine_cleanup(); stopped = Run.flags & Run_Stopped; 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])) LogError("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_stop() { stopped = true; } void Engine_cleanup() { myServerSocketsCount = 0; if (Run.httpd.flags & Httpd_Unix) unlink(Run.httpd.socket.unix.path); } boolean_t Engine_addAllow(char *pattern) { ASSERT(pattern); if (_parseNetwork(pattern) || _parseHost(pattern)) return true; return false; } boolean_t Engine_hasAllow() { return allowlist ? true : false; } void Engine_destroyAllow() { for (HostsAllow_T current = allowlist, next = NULL; current; current = next) { next = current->next; FREE(current); } allowlist = NULL; } monit-5.26.0/src/http/httpstatus.h0000664000175000017500000000627113507751326017023 0ustar martinpmartinp/* * 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.26.0/src/http/processor.c0000664000175000017500000010014513507751326016605 0ustar martinpmartinp/* * 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 * reponse 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 asumed 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 void create_headers(HttpRequest); static void send_response(HttpRequest, HttpResponse); static boolean_t 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 boolean_t create_parameters(HttpRequest req); static void destroy_HttpResponse(HttpResponse); static HttpRequest create_HttpRequest(Socket_T); static void internal_error(Socket_T, int, char *); static HttpResponse create_HttpResponse(Socket_T); static boolean_t 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() { // Base buffer size (space for e.g. "action=") _httpPostLimit = STRLEN; // Add space for each service for (Service_T s = servicelist; s; s = s->next) _httpPostLimit += strlen("&service=") + strlen(s->name); } void 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]); } } /** * 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 LogError("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; includeSubdomains; preload"); 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; time(&now); if (strftime(result, size, DATEFMT, gmtime(&now)) <= 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 * commited, 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"); boolean_t canCompress = acceptEncoding && Str_sub(acceptEncoding, "gzip") ? true : false; #else boolean_t 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"); if (headers) Socket_print(S, "%s", headers); Socket_print(S, "\r\n"); if (bodyLength) Socket_write(S, (unsigned char *)body, bodyLength); 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); create_headers(req); if (! create_parameters(req)) { destroy_HttpRequest(req); internal_error(S, SC_BAD_REQUEST, "Cannot parse Request parameters"); 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 void create_headers(HttpRequest req) { char line[REQ_STRLEN] = {0}; while (Socket_readLine(req->S, line, sizeof(line)) && ! (Str_isEqual(line, "\r\n") || Str_isEqual(line, "\n"))) { 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; } } } /** * Create parameters for the given request. Returns false if an error * occurs. */ static boolean_t 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 *h = p; if (h->next) destroy_entry(h->next); FREE(h->name); FREE(h->value); FREE(h); } /* ----------------------------------------------------- Checkers/Validators */ static boolean_t _isCookieSeparator(int c) { return (c == ' ' || c == '\n' || c == ';' || c == ','); } static boolean_t 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) { LogError("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) { LogError("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_compareConstantTime(cookieValue, token)) { LogError("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; } } LogError("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 boolean_t basic_authenticate(HttpRequest req) { const char *credentials = get_header(req, "Authorization"); if (! (credentials && Str_startsWith(credentials, "Basic "))) { LogDebug("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) { LogDebug("HttpRequest: access denied -- client [%s]: invalid Authorization header\n", NVLSTR(Socket_getRemoteHost(req->S))); return false; } if (STR_UNDEF(uname)) { LogDebug("HttpRequest: access denied -- client [%s]: empty username\n", NVLSTR(Socket_getRemoteHost(req->S))); return false; } char *password = strchr(uname, ':'); if (STR_UNDEF(password)) { LogDebug("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)) { LogError("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)) { LogError("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, 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" "\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.26.0/src/http/client.c0000664000175000017500000002107213507751326016045 0ustar martinpmartinp/* * 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 "net.h" #include "socket.h" #include "ProcessTree.h" #include "device.h" #include "Color.h" #include "Box.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((char *)value, true); StringBuffer_append(data, "%s%s=%s", StringBuffer_length(data) ? "&" : "", name, _value); FREE(_value); } static char *_getBasicAuthHeader() { 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) { 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"); } else { // Skip HTTP headers while (Socket_readLine(S, buf, sizeof(buf))) { if (! strncmp(buf, "\r\n", sizeof(buf))) break; } } } 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); boolean_t strip = (Run.flags & Run_Batch || ! Color_support()) ? true : false; while (Socket_readLine(S, buf, sizeof(buf))) { if (strip) Color_strip(Box_strip(buf)); printf("%s", buf); } } static boolean_t _client(const char *request, StringBuffer_T data) { boolean_t status = false; if (! exist_daemon()) { LogError("Monit: the monit daemon is not running\n"); return status; } Socket_T S = NULL; if (Run.httpd.flags & Httpd_Net) { 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 { LogError("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 { LogError("%s\n", Exception_frame.message); } END_TRY; Socket_free(&S); } return status; } /* ------------------------------------------------------------------ Public */ boolean_t HttpClient_action(const char *action, List_T services) { ASSERT(services); ASSERT(action); if (Util_getAction(action) == Action_Ignored) { LogError("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); boolean_t rv = _client("/_doaction", data); StringBuffer_free(&data); return rv; } boolean_t HttpClient_report(const char *type) { StringBuffer_T data = StringBuffer_create(64); if (STR_DEF(type)) _argument(data, "type", type); boolean_t rv = _client("/_report", data); StringBuffer_free(&data); return rv; } boolean_t 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); boolean_t rv = _client("/_status", data); StringBuffer_free(&data); return rv; } boolean_t 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); boolean_t rv = _client("/_summary", data); StringBuffer_free(&data); return rv; } monit-5.26.0/src/http/engine.h0000664000175000017500000000340213507751326016036 0ustar martinpmartinp/* * 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); /** * 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 */ boolean_t 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 */ boolean_t Engine_hasAllow(void); /** * Free the host allow list */ void Engine_destroyAllow(void); #endif monit-5.26.0/src/http/xml.c0000664000175000017500000007561313507751326015401 0ustar martinpmartinp/* * 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_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 "monit.h" #include "event.h" #include "ProcessTree.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)ProcessTree_getProcessUptime(getpid()), 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" "", systeminfo.uname.sysname, systeminfo.uname.release, systeminfo.uname.version, systeminfo.uname.machine, systeminfo.cpu.count, (unsigned long long)((double)systeminfo.memory.size / 1024.), // Send as kB for backward compatibility (unsigned long long)((double)systeminfo.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 _ioStatistics(StringBuffer_T B, const char *name, IOStatistics_T statistics) { StringBuffer_append(B, "<%s>", name); if (Statistics_initialized(&(statistics->bytes))) { StringBuffer_append(B, "" "%.0lf" // bytes per second "%"PRIu64"" // bytes since boot "", Statistics_deltaNormalize(&(statistics->bytes)), Statistics_raw(&(statistics->bytes))); } if (Statistics_initialized(&(statistics->operations))) { StringBuffer_append(B, "" "%.0lf" // operations per second "%"PRIu64"" // operations since boot "", Statistics_deltaNormalize(&(statistics->operations)), Statistics_raw(&(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 == 1) 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_File: StringBuffer_append(B, "%o" "%d" "%d" "" "%"PRIu64"" "%"PRIu64"" "%"PRIu64"" "" "%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); if (S->checksum) StringBuffer_append(B, "%s", checksumnames[S->checksum->type], S->inf.file->cs_sum); break; case Service_Directory: StringBuffer_append(B, "%o" "%d" "%d" "" "%"PRIu64"" "%"PRIu64"" "%"PRIu64"" "", S->inf.directory->mode & 07777, (int)S->inf.directory->uid, (int)S->inf.directory->gid, 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" "" "%"PRIu64"" "%"PRIu64"" "%"PRIu64"" "", S->inf.fifo->mode & 07777, (int)S->inf.fifo->uid, (int)S->inf.fifo->gid, 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, 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); } _ioStatistics(B, "read", &(S->inf.filesystem->read)); _ioStatistics(B, "write", &(S->inf.filesystem->write)); boolean_t hasReadTime = Statistics_initialized(&(S->inf.filesystem->time.read)); boolean_t hasWriteTime = Statistics_initialized(&(S->inf.filesystem->time.write)); boolean_t hasWaitTime = Statistics_initialized(&(S->inf.filesystem->time.wait)); boolean_t 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" "", 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); } _ioStatistics(B, "read", &(S->inf.process->read)); _ioStatistics(B, "write", &(S->inf.process->write)); break; default: break; } for (Icmp_T i = S->icmplist; i; i = i->next) { StringBuffer_append(B, "" "%s" "%.6f" "", icmpnames[i->type], i->is_available == Connection_Ok ? i->response / 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->response / 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->response / 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" "" "" "%.1f" "%.1f" #ifdef HAVE_CPU_WAIT "%.1f" #endif "" "" "%.1f" "%llu" "" "" "%.1f" "%llu" "" "", systeminfo.loadavg[0], systeminfo.loadavg[1], systeminfo.loadavg[2], systeminfo.cpu.usage.user > 0. ? systeminfo.cpu.usage.user : 0., systeminfo.cpu.usage.system > 0. ? systeminfo.cpu.usage.system : 0., #ifdef HAVE_CPU_WAIT systeminfo.cpu.usage.wait > 0. ? systeminfo.cpu.usage.wait : 0., #endif systeminfo.memory.usage.percent, (unsigned long long)((double)systeminfo.memory.usage.bytes / 1024.), // Send as kB for backward compatibility systeminfo.swap.usage.percent, (unsigned long long)((double)systeminfo.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, "]]>"); if (E->source->token) StringBuffer_append(B, "%s", E->source->token); StringBuffer_append(B, ""); } /* ------------------------------------------------------------------ Public */ /** * Get a XML formated 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 */ void status_xml(StringBuffer_T B, Event_T E, int V, const char *myip) { Service_T S; ServiceGroup_T SG; document_head(B, V, myip); if (V == 2) StringBuffer_append(B, ""); for (S = servicelist_conf; S; S = S->next_conf) status_service(S, B, V); if (V == 2) { StringBuffer_append(B, ""); for (SG = servicegrouplist; SG; SG = SG->next) status_servicegroup(SG, B); StringBuffer_append(B, ""); } if (E) status_event(E, B); document_foot(B); } monit-5.26.0/src/http/processor.h0000664000175000017500000000634213507751326016616 0ustar martinpmartinp/* * 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 "net.h" #include "socket.h" #include "httpstatus.h" /* Server masquerade */ #define SERVER_NAME "monit" #define SERVER_VERSION VERSION #define SERVER_URL "http://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 1024 #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; boolean_t 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); void 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.26.0/src/http/cervlet.h0000664000175000017500000002031313507751326016235 0ustar martinpmartinp/* * 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.26.0/src/http/cervlet.c0000664000175000017500000044767613507751326016261 0ustar martinpmartinp/* * 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_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 "Color.h" #include "Box.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" typedef enum { TXT = 0, HTML } __attribute__((__packed__)) Output_Type; /* Private prototypes */ static boolean_t 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_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_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 deamon and programs monitored by * monit. * * @file */ /* ------------------------------------------------------------------ Public */ /** * Callback hook to the Processor module for registering this modules * doGet and doPost methods. */ void init_service() { add_Impl(doGet, doPost); } /* ----------------------------------------------------------------- Private */ 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; } static void _formatStatus(const char *name, Event_Type errorType, Output_Type type, HttpResponse res, Service_T s, boolean_t 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
                        boolean_t 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 *header, const char *name) { boolean_t hasOps = Statistics_initialized(&(io->operations)); boolean_t hasBytes = Statistics_initialized(&(io->bytes)); if (hasOps && hasBytes) { double deltaBytesPerSec = Statistics_deltaNormalize(&(io->bytes)); double deltaOpsPerSec = Statistics_deltaNormalize(&(io->operations)); _formatStatus(header, Event_Resource, type, res, s, true, "%s/s [%s total], %.1f %ss/s [%"PRIu64" %ss total]", Fmt_bytes2str(deltaBytesPerSec, (char[10]){}), Fmt_bytes2str(Statistics_raw(&(io->bytes)), (char[10]){}), deltaOpsPerSec, name, Statistics_raw(&(io->operations)), name); } else if (hasOps) { double deltaOpsPerSec = Statistics_deltaNormalize(&(io->operations)); _formatStatus(header, Event_Resource, type, res, s, true, "%.1f %ss/s [%"PRIu64" %ss total]", deltaOpsPerSec, name, Statistics_raw(&(io->operations)), name); } else if (hasBytes) { 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]){})); } } 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]", systeminfo.loadavg[0], systeminfo.loadavg[1], systeminfo.loadavg[2]); _formatStatus("cpu", Event_Resource, type, res, s, true, "%.1f%%us %.1f%%sy" #ifdef HAVE_CPU_WAIT " %.1f%%wa" #endif , systeminfo.cpu.usage.user > 0. ? systeminfo.cpu.usage.user : 0., systeminfo.cpu.usage.system > 0. ? systeminfo.cpu.usage.system : 0. #ifdef HAVE_CPU_WAIT , systeminfo.cpu.usage.wait > 0. ? systeminfo.cpu.usage.wait : 0. #endif ); _formatStatus("memory usage", Event_Resource, type, res, s, true, "%s [%.1f%%]", Fmt_bytes2str(systeminfo.memory.usage.bytes, (char[10]){}), systeminfo.memory.usage.percent); _formatStatus("swap usage", Event_Resource, type, res, s, true, "%s [%.1f%%]", Fmt_bytes2str(systeminfo.swap.usage.bytes, (char[10]){}), systeminfo.swap.usage.percent); _formatStatus("uptime", Event_Uptime, type, res, s, systeminfo.booted > 0, "%s", _getUptime(Time_now() - systeminfo.booted, (char[256]){})); _formatStatus("boot time", Event_Null, type, res, s, true, "%s", Time_string(systeminfo.booted, (char[32]){})); 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("access timestamp", Event_Timestamp, type, res, s, s->inf.file->timestamp.access > 0, "%s", Time_string(s->inf.file->timestamp.access, (char[32]){})); _formatStatus("change timestamp", Event_Timestamp, type, res, s, s->inf.file->timestamp.change > 0, "%s", Time_string(s->inf.file->timestamp.change, (char[32]){})); _formatStatus("modify timestamp", Event_Timestamp, type, res, s, s->inf.file->timestamp.modify > 0, "%s", Time_string(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, checksumnames[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("access timestamp", Event_Timestamp, type, res, s, s->inf.directory->timestamp.access > 0, "%s", Time_string(s->inf.directory->timestamp.access, (char[32]){})); _formatStatus("change timestamp", Event_Timestamp, type, res, s, s->inf.directory->timestamp.change > 0, "%s", Time_string(s->inf.directory->timestamp.change, (char[32]){})); _formatStatus("modify timestamp", Event_Timestamp, type, res, s, s->inf.directory->timestamp.modify > 0, "%s", Time_string(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("access timestamp", Event_Timestamp, type, res, s, s->inf.fifo->timestamp.access > 0, "%s", Time_string(s->inf.fifo->timestamp.access, (char[32]){})); _formatStatus("change timestamp", Event_Timestamp, type, res, s, s->inf.fifo->timestamp.change > 0, "%s", Time_string(s->inf.fifo->timestamp.change, (char[32]){})); _formatStatus("modify timestamp", Event_Timestamp, type, res, s, s->inf.fifo->timestamp.modify > 0, "%s", Time_string(s->inf.fifo->timestamp.modify, (char[32]){})); break; case Service_Net: { long long speed = Link_getSpeed(s->inf.net->stats); long long ibytes = Link_getBytesInPerSecond(s->inf.net->stats); long long obytes = Link_getBytesOutPerSecond(s->inf.net->stats); _formatStatus("link", Event_Link, type, res, s, Link_getState(s->inf.net->stats) == 1, "%d errors", Link_getErrorsInPerSecond(s->inf.net->stats) + Link_getErrorsOutPerSecond(s->inf.net->stats)); 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]){})); } _formatStatus("download packets", Event_PacketIn, type, res, s, Link_getState(s->inf.net->stats) == 1, "%lld per second", Link_getPacketsInPerSecond(s->inf.net->stats)); _formatStatus("upload packets", Event_PacketOut, type, res, s, Link_getState(s->inf.net->stats) == 1, "%lld per second", Link_getPacketsOutPerSecond(s->inf.net->stats)); } 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), "%s", s->inf.filesystem->flags); _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", "read"); _printIOStatistics(type, res, s, &(s->inf.filesystem->write), "write", "write"); boolean_t hasReadTime = Statistics_initialized(&(s->inf.filesystem->time.read)); boolean_t hasWriteTime = Statistics_initialized(&(s->inf.filesystem->time.write)); boolean_t hasWaitTime = Statistics_initialized(&(s->inf.filesystem->time.wait)); boolean_t 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, "%.3fms/operation (of which read %.3fms, write %.3fms)", 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, "%.3fms/operation (of which queue %.3fms, active %.3fms)", 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, "%.3fms/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, "%.3fms/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); #endif } _printIOStatistics(type, res, s, &(s->inf.process->read), "disk read", "read"); _printIOStatistics(type, res, s, &(s->inf.process->write), "disk 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", Event_Icmp, type, res, s, true, "connection failed"); else _formatStatus("ping response time", Event_Null, type, res, s, i->is_available != Connection_Init && i->response >= 0., "%s", Fmt_time2str(i->response, (char[11]){})); } for (Port_T p = s->portlist; p; p = p->next) { if (p->is_available == Connection_Failed) { _formatStatus("port response time", Event_Connection, 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); _formatStatus("port response time", p->target.net.ssl.certificate.validDays < p->target.net.ssl.certificate.minimumDays ? Event_Timestamp : Event_Null, type, res, s, p->is_available != Connection_Init, "%s to %s:%d%s type %s/%s %sprotocol %s", Fmt_time2str(p->response, (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", 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", Event_Null, type, res, s, p->is_available != Connection_Init, "%s to %s type %s protocol %s", Fmt_time2str(p->response, (char[11]){}), p->target.unix.pathname, Util_portTypeDescription(p), p->protocol->name); } } } _formatStatus("data collected", Event_Null, type, res, s, true, "%s", Time_string(s->collected.tv_sec, (char[32]){})); } /** * 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); } /** * 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 { 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) { LogError("Error sending favicon data -- %s\n", STRERROR); } } } static void do_head(HttpResponse res, const char *path, const char *name, int refresh) { StringBuffer_append(res->outputbuffer, ""\ ""\ ""\ "Monit: %s "\ ""\ " "\ " "\ " "\ "" \ ""\ ""\ "
" \ ""\ " "\ " "\ " "\ " "\ " "\ ""\ "
", Run.system->name, refresh, path, name, VERSION); } static void do_foot(HttpResponse res) { StringBuffer_append(res->outputbuffer, "
" ""); } static void do_home(HttpResponse res) { do_head(res, "", "", Run.polltime); StringBuffer_append(res->outputbuffer, "" " " " " " " "", Run.system->name); 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) { StringBuffer_append(res->outputbuffer, "%s", 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, "" "" ""); StringBuffer_append(res->outputbuffer, "", Run.id); StringBuffer_append(res->outputbuffer, "", Run.system->name); StringBuffer_append(res->outputbuffer, "", pid); StringBuffer_append(res->outputbuffer, "" "", Run.Env.user); StringBuffer_append(res->outputbuffer, "", Run.files.control); if (Run.files.log) StringBuffer_append(res->outputbuffer, "", Run.files.log); StringBuffer_append(res->outputbuffer, "", Run.files.pid); StringBuffer_append(res->outputbuffer, "", Run.files.state); StringBuffer_append(res->outputbuffer, "", Run.debug ? "True" : "False"); StringBuffer_append(res->outputbuffer, "", (Run.flags & Run_Log) ? "True" : "False"); StringBuffer_append(res->outputbuffer, "", (Run.flags & Run_UseSyslog) ? "True" : "False"); if (Run.eventlist_dir) { if (Run.eventlist_slots < 0) snprintf(buf, STRLEN, "unlimited"); else snprintf(buf, STRLEN, "%d", Run.eventlist_slots); StringBuffer_append(res->outputbuffer, "" "", Run.eventlist_dir, Run.eventlist_slots); } #ifdef HAVE_OPENSSL { const char *options = Ssl_printOptions(&(Run.ssl), (char[STRLEN]){}, STRLEN); if (options && *options) StringBuffer_append(res->outputbuffer, "", options); } #endif if (Run.mmonits) { StringBuffer_append(res->outputbuffer, ""); } if (Run.mailservers) { StringBuffer_append(res->outputbuffer, ""); } if (Run.MailFormat.from) { StringBuffer_append(res->outputbuffer, ""); } if (Run.MailFormat.replyto) { StringBuffer_append(res->outputbuffer, ""); } if (Run.MailFormat.subject) StringBuffer_append(res->outputbuffer, "", Run.MailFormat.subject); if (Run.MailFormat.message) StringBuffer_append(res->outputbuffer, "", Run.MailFormat.message); StringBuffer_append(res->outputbuffer, "", Fmt_bytes2str(Run.limits.sendExpectBuffer, buf)); StringBuffer_append(res->outputbuffer, "", Fmt_bytes2str(Run.limits.fileContentBuffer, buf)); StringBuffer_append(res->outputbuffer, "", Fmt_bytes2str(Run.limits.httpContentBuffer, buf)); StringBuffer_append(res->outputbuffer, "", Fmt_bytes2str(Run.limits.programOutput, buf)); StringBuffer_append(res->outputbuffer, "", Fmt_time2str(Run.limits.networkTimeout, (char[11]){})); StringBuffer_append(res->outputbuffer, "", Fmt_time2str(Run.limits.programTimeout, (char[11]){})); StringBuffer_append(res->outputbuffer, "", Fmt_time2str(Run.limits.stopTimeout, (char[11]){})); StringBuffer_append(res->outputbuffer, "", Fmt_time2str(Run.limits.startTimeout, (char[11]){})); StringBuffer_append(res->outputbuffer, "", Fmt_time2str(Run.limits.restartTimeout, (char[11]){})); StringBuffer_append(res->outputbuffer, "", onrebootnames[Run.onreboot]); StringBuffer_append(res->outputbuffer, "", Run.polltime, Run.startdelay); if (Run.httpd.flags & Httpd_Net) { StringBuffer_append(res->outputbuffer, "", Run.httpd.socket.net.address ? Run.httpd.socket.net.address : "Any/All"); StringBuffer_append(res->outputbuffer, "", Run.httpd.socket.net.port); #ifdef HAVE_OPENSSL const char *options = Ssl_printOptions(&(Run.httpd.socket.net.ssl), (char[STRLEN]){}, STRLEN); if (options && *options) StringBuffer_append(res->outputbuffer, "", options); #endif } if (Run.httpd.flags & Httpd_Unix) StringBuffer_append(res->outputbuffer, "", Run.httpd.socket.unix.path); StringBuffer_append(res->outputbuffer, "", Run.httpd.flags & Httpd_Signature ? "True" : "False"); StringBuffer_append(res->outputbuffer, "", 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
Monit ID%s
Host%s
Process id%d
Effective user running Monit%s
Controlfile%s
Logfile%s
Pidfile%s
State file%s
Debug%s
Log%s
Use syslog%s
Event queuebase directory %s with %d slots
SSL options%s
M/Monit server(s)"); for (Mmonit_T c = Run.mmonits; c; c = c->next) { StringBuffer_append(res->outputbuffer, "%s with timeout %s", c->url->url, 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 '%s'", checksumnames[c->ssl.checksumType], c->ssl.checksum); } #endif if (Run.flags & Run_MmonitCredentials && c->url->user) StringBuffer_append(res->outputbuffer, " with credentials"); if (c->next) StringBuffer_append(res->outputbuffer, "
 "); } StringBuffer_append(res->outputbuffer, "
Mail server(s)"); for (MailServer_T mta = Run.mailservers; mta; mta = mta->next) { StringBuffer_append(res->outputbuffer, "%s:%d", mta->host, mta->port); #ifdef HAVE_OPENSSL if (mta->ssl.flags) { StringBuffer_append(res->outputbuffer, " using TLS"); const char *options = Ssl_printOptions(&mta->ssl, (char[STRLEN]){}, 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 '%s'", checksumnames[mta->ssl.checksumType], mta->ssl.checksum); } #endif if (mta->next) StringBuffer_append(res->outputbuffer, "
 "); } StringBuffer_append(res->outputbuffer, "
Default mail from"); if (Run.MailFormat.from->name) StringBuffer_append(res->outputbuffer, "%s <%s>", Run.MailFormat.from->name, Run.MailFormat.from->address); else StringBuffer_append(res->outputbuffer, "%s", Run.MailFormat.from->address); StringBuffer_append(res->outputbuffer, "
Default mail reply to"); if (Run.MailFormat.replyto->name) StringBuffer_append(res->outputbuffer, "%s <%s>", Run.MailFormat.replyto->name, Run.MailFormat.replyto->address); else StringBuffer_append(res->outputbuffer, "%s", Run.MailFormat.replyto->address); StringBuffer_append(res->outputbuffer, "
Default mail subject%s
Default mail message%s
Limit for Send/Expect buffer%s
Limit for file content buffer%s
Limit for HTTP content buffer%s
Limit for program output%s
Limit for network timeout%s
Limit for check program timeout%s
Limit for service stop timeout%s
Limit for service start timeout%s
Limit for service restart timeout%s
On reboot%s
Poll time%d seconds with start delay %d seconds
httpd bind address%s
httpd portnumber%d
httpd encryption%s
httpd unix socket%s
httpd signature%s
httpd auth. style%s
"); 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; 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); } 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; } Service_T s = Util_getService(++name); if (! s) { send_error(req, res, SC_NOT_FOUND, "There is no service named \"%s\"", name); return; } 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; } Action_Type doaction = Util_getAction(action); if (doaction == Action_Ignored) { send_error(req, res, SC_BAD_REQUEST, "Invalid action \"%s\"", action); return; } s->doaction = doaction; const char *token = get_parameter(req, "token"); if (token) { FREE(s->token); s->token = Str_dup(token); } LogInfo("'%s' %s on user request\n", s->name, action); Run.flags |= Run_ActionPending; /* set the global flag */ do_wakeupcall(); } do_service(req, res, s); } static void handle_doaction(HttpRequest req, HttpResponse res) { Service_T s; Action_Type doaction = Action_Ignored; const char *action = get_parameter(req, "action"); const char *token = get_parameter(req, "token"); if (action) { if (is_readonly(req)) { send_error(req, res, SC_FORBIDDEN, "You do not have sufficient privileges to access this page"); return; } if ((doaction = Util_getAction(action)) == Action_Ignored) { send_error(req, res, SC_BAD_REQUEST, "Invalid action \"%s\"", action); return; } for (HttpParameter p = req->params; p; p = p->next) { if (IS(p->name, "service")) { s = Util_getService(p->value); if (! s) { send_error(req, res, SC_BAD_REQUEST, "There is no service named \"%s\"", p->value ? p->value : ""); return; } s->doaction = doaction; LogInfo("'%s' %s on user request\n", s->name, action); } } /* Set token for last service only so we'll get it back after all services were handled */ if (token) { Service_T q = NULL; for (s = servicelist; s; s = s->next) if (s->doaction == doaction) q = s; if (q) { FREE(q->token); q->token = Str_dup(token); } } 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")) { LogInfo("The Monit http server woke up on user request\n"); do_wakeupcall(); } else if (IS(action, "stop")) { LogInfo("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) { char buf[STRLEN]; ASSERT(s); do_head(res, s->name_escaped, s->name, Run.polltime); StringBuffer_append(res->outputbuffer, "

%s status

" "" "" "" "" "" "" "" "" "", servicetypes[s->type], s->name); if (s->type == Service_Process) StringBuffer_append(res->outputbuffer, "", s->matchlist ? "Match" : "Pid file", s->path); else if (s->type == Service_Host) StringBuffer_append(res->outputbuffer, "", s->path); else if (s->type == Service_Net) StringBuffer_append(res->outputbuffer, "", s->path); else if (s->type != Service_System) StringBuffer_append(res->outputbuffer, "", s->path); StringBuffer_append(res->outputbuffer, "", get_service_status(HTML, s, buf, sizeof(buf))); for (ServiceGroup_T sg = servicegrouplist; sg; sg = sg->next) for (list_t m = sg->members->head; m; m = m->next) if (m->e == s) StringBuffer_append(res->outputbuffer, "", sg->name); StringBuffer_append(res->outputbuffer, "", get_monitoring_status(HTML, s, buf, sizeof(buf))); StringBuffer_append(res->outputbuffer, "", modenames[s->mode]); StringBuffer_append(res->outputbuffer, "", onrebootnames[s->onreboot]); for (Dependant_T d = s->dependantlist; d; d = d->next) { if (d->dependant != NULL) { StringBuffer_append(res->outputbuffer, "", d->dependant_escaped, d->dependant); } } if (s->start) { StringBuffer_append(res->outputbuffer, ""); } if (s->stop) { StringBuffer_append(res->outputbuffer, ""); } if (s->restart) { StringBuffer_append(res->outputbuffer, ""); } if (s->every.type != Every_Cycle) { StringBuffer_append(res->outputbuffer, ""); } _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_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_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
Name%s
%s%s
Address%s
Interface%s
Path%s
Status%s
Group%s
Monitoring status%s
Monitoring mode%s
On reboot%s
Depends on service %s
Start program'%s'", Util_commandDescription(s->start, (char[STRLEN]){})); if (s->start->has_uid) StringBuffer_append(res->outputbuffer, " as uid %d", s->start->uid); if (s->start->has_gid) StringBuffer_append(res->outputbuffer, " as gid %d", s->start->gid); StringBuffer_append(res->outputbuffer, " timeout %s", Fmt_time2str(s->start->timeout, (char[11]){})); StringBuffer_append(res->outputbuffer, "
Stop program'%s'", Util_commandDescription(s->stop, (char[STRLEN]){})); if (s->stop->has_uid) StringBuffer_append(res->outputbuffer, " as uid %d", s->stop->uid); if (s->stop->has_gid) StringBuffer_append(res->outputbuffer, " as gid %d", s->stop->gid); StringBuffer_append(res->outputbuffer, " timeout %s", Fmt_time2str(s->stop->timeout, (char[11]){})); StringBuffer_append(res->outputbuffer, "
Restart program'%s'", Util_commandDescription(s->restart, (char[STRLEN]){})); if (s->restart->has_uid) StringBuffer_append(res->outputbuffer, " as uid %d", s->restart->uid); if (s->restart->has_gid) StringBuffer_append(res->outputbuffer, " as gid %d", s->restart->gid); StringBuffer_append(res->outputbuffer, " timeout %s", Fmt_time2str(s->restart->timeout, (char[11]){})); StringBuffer_append(res->outputbuffer, "
Check service"); if (s->every.type == Every_SkipCycles) StringBuffer_append(res->outputbuffer, "every %d cycle", s->every.spec.cycle.number); else if (s->every.type == Every_Cron) StringBuffer_append(res->outputbuffer, "every \"%s\"", s->every.spec.cron); else if (s->every.type == Every_NotInCron) StringBuffer_append(res->outputbuffer, "not every \"%s\"", s->every.spec.cron); StringBuffer_append(res->outputbuffer, "
"); 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, "" "" "" "" "" "" "" "" "" "" "" "" "" "", s->name_escaped, s->name, get_service_status(HTML, s, buf, sizeof(buf)), systeminfo.loadavg[0], systeminfo.loadavg[1], systeminfo.loadavg[2], systeminfo.cpu.usage.user > 0. ? systeminfo.cpu.usage.user : 0., systeminfo.cpu.usage.system > 0. ? systeminfo.cpu.usage.system : 0. #ifdef HAVE_CPU_WAIT , systeminfo.cpu.usage.wait > 0. ? systeminfo.cpu.usage.wait : 0. #endif ); StringBuffer_append(res->outputbuffer, "", systeminfo.memory.usage.percent, Fmt_bytes2str(systeminfo.memory.usage.bytes, buf)); StringBuffer_append(res->outputbuffer, "", systeminfo.swap.usage.percent, Fmt_bytes2str(systeminfo.swap.usage.bytes, buf)); StringBuffer_append(res->outputbuffer, "" "
SystemStatusLoadCPUMemorySwap
%s%s[%.2f] [%.2f] [%.2f]" "%.1f%%us, %.1f%%sy" #ifdef HAVE_CPU_WAIT ", %.1f%%wa" #endif "%.1f%% [%s]%.1f%% [%s]
"); } static void do_home_process(HttpResponse res) { char buf[STRLEN]; boolean_t on = true; boolean_t header = true; for (Service_T s = servicelist_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_escaped, s->name, 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)); } boolean_t hasReadBytes = Statistics_initialized(&(s->inf.process->read.bytes)); boolean_t 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))); } boolean_t hasWriteBytes = Statistics_initialized(&(s->inf.process->write.bytes)); boolean_t 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]; boolean_t on = true; boolean_t header = true; for (Service_T s = servicelist_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_escaped, s->name, 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_fmt((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]; boolean_t on = true; boolean_t header = true; for (Service_T s = servicelist_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_escaped, s->name, 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]; boolean_t on = true; boolean_t header = true; for (Service_T s = servicelist_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_escaped, s->name, 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]; boolean_t on = true; boolean_t header = true; for (Service_T s = servicelist_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_escaped, s->name, 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]; boolean_t on = true; boolean_t header = true; for (Service_T s = servicelist_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_escaped, s->name, 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]; boolean_t on = true; boolean_t header = true; for (Service_T s = servicelist_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_escaped, s->name, 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]; boolean_t on = true; boolean_t header = true; for (Service_T s = servicelist_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_escaped, s->name, 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) { StringBuffer_append(res->outputbuffer, "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) { StringBuffer_append(res->outputbuffer, "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_escaped, res->token); /* Stop program */ if (s->stop) StringBuffer_append(res->outputbuffer, "", s->name_escaped, res->token); /* Restart program */ if ((s->start && s->stop) || s->restart) StringBuffer_append(res->outputbuffer, "", s->name_escaped, res->token); /* (un)monitor */ StringBuffer_append(res->outputbuffer, "", s->name_escaped, 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_append(res->outputbuffer, "TimeoutIf restarted %d times within %d cycle(s) then ", ar->count, ar->cycle); Util_printAction(ar->action->failed, res->outputbuffer); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_nonexistence(HttpResponse res, Service_T s) { for (NonExist_T l = s->nonexistlist; l; l = l->next) { StringBuffer_append(res->outputbuffer, "Existence"); Util_printRule(res->outputbuffer, l->action, "If doesn't exist"); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_existence(HttpResponse res, Service_T s) { for (Exist_T l = s->existlist; l; l = l->next) { StringBuffer_append(res->outputbuffer, "Non-Existence"); Util_printRule(res->outputbuffer, l->action, "If exist"); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_port(HttpResponse res, Service_T s) { for (Port_T p = s->portlist; p; p = p->next) { StringBuffer_append(res->outputbuffer, "Port"); StringBuffer_T buf = StringBuffer_create(64); StringBuffer_append(buf, "If failed [%s]:%d%s", 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); #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'", checksumnames[p->target.net.ssl.options.checksumType], p->target.net.ssl.options.checksum); } #endif Util_printRule(res->outputbuffer, p->action, "%s", StringBuffer_toString(buf)); StringBuffer_free(&buf); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_socket(HttpResponse res, Service_T s) { for (Port_T p = s->socketlist; p; p = p->next) { StringBuffer_append(res->outputbuffer, "Unix Socket"); if (p->retry > 1) Util_printRule(res->outputbuffer, p->action, "If failed %s type %s protocol %s with timeout %s and retry %d time(s)", p->target.unix.pathname, Util_portTypeDescription(p), p->protocol->name, Fmt_time2str(p->timeout, (char[11]){}), p->retry); else Util_printRule(res->outputbuffer, p->action, "If failed %s type %s protocol %s with timeout %s", p->target.unix.pathname, Util_portTypeDescription(p), p->protocol->name, Fmt_time2str(p->timeout, (char[11]){})); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_icmp(HttpResponse res, Service_T s) { for (Icmp_T i = s->icmplist; i; i = i->next) { switch (i->family) { case Socket_Ip4: StringBuffer_append(res->outputbuffer, "Ping4"); break; case Socket_Ip6: StringBuffer_append(res->outputbuffer, "Ping6"); break; default: StringBuffer_append(res->outputbuffer, "Ping"); break; } Util_printRule(res->outputbuffer, i->action, "If failed [count %d size %d with timeout %s%s%s]", i->count, i->size, Fmt_time2str(i->timeout, (char[11]){}), i->outgoing.ip ? " via address " : "", i->outgoing.ip ? i->outgoing.ip : ""); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_perm(HttpResponse res, Service_T s) { if (s->perm) { StringBuffer_append(res->outputbuffer, "Permissions"); if (s->perm->test_changes) Util_printRule(res->outputbuffer, s->perm->action, "If changed"); else Util_printRule(res->outputbuffer, s->perm->action, "If failed %o", s->perm->perm); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_uid(HttpResponse res, Service_T s) { if (s->uid) { StringBuffer_append(res->outputbuffer, "UID"); Util_printRule(res->outputbuffer, s->uid->action, "If failed %d", s->uid->uid); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_euid(HttpResponse res, Service_T s) { if (s->euid) { StringBuffer_append(res->outputbuffer, "EUID"); Util_printRule(res->outputbuffer, s->euid->action, "If failed %d", s->euid->uid); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_secattr(HttpResponse res, Service_T s) { for (SecurityAttribute_T a = s->secattrlist; a; a = a->next) { StringBuffer_append(res->outputbuffer, "Security attribute"); Util_printRule(res->outputbuffer, a->action, "If failed %s", a->attribute); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_gid(HttpResponse res, Service_T s) { if (s->gid) { StringBuffer_append(res->outputbuffer, "GID"); Util_printRule(res->outputbuffer, s->gid->action, "If failed %d", s->gid->gid); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_timestamp(HttpResponse res, Service_T s) { for (Timestamp_T t = s->timestamplist; t; t = t->next) { StringBuffer_append(res->outputbuffer, "%c%s", toupper(timestampnames[t->type][0]), timestampnames[t->type] + 1); if (t->test_changes) Util_printRule(res->outputbuffer, t->action, "If changed"); else Util_printRule(res->outputbuffer, t->action, "If %s %s", operatornames[t->operator], Fmt_time2str(t->time * 1000., (char[11]){})); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_fsflags(HttpResponse res, Service_T s) { for (FsFlag_T l = s->fsflaglist; l; l = l->next) { StringBuffer_append(res->outputbuffer, "Filesystem flags"); Util_printRule(res->outputbuffer, l->action, "If changed"); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_filesystem(HttpResponse res, Service_T s) { for (FileSystem_T dl = s->filesystemlist; dl; dl = dl->next) { if (dl->resource == Resource_Inode) { StringBuffer_append(res->outputbuffer, "Inodes usage limit"); if (dl->limit_absolute > -1) Util_printRule(res->outputbuffer, dl->action, "If %s %lld", operatornames[dl->operator], dl->limit_absolute); else Util_printRule(res->outputbuffer, dl->action, "If %s %.1f%%", operatornames[dl->operator], dl->limit_percent); StringBuffer_append(res->outputbuffer, ""); } else if (dl->resource == Resource_InodeFree) { StringBuffer_append(res->outputbuffer, "Inodes free limit"); if (dl->limit_absolute > -1) Util_printRule(res->outputbuffer, dl->action, "If %s %lld", operatornames[dl->operator], dl->limit_absolute); else Util_printRule(res->outputbuffer, dl->action, "If %s %.1f%%", operatornames[dl->operator], dl->limit_percent); StringBuffer_append(res->outputbuffer, ""); } else if (dl->resource == Resource_Space) { StringBuffer_append(res->outputbuffer, "Space usage limit"); if (dl->limit_absolute > -1) { Util_printRule(res->outputbuffer, dl->action, "If %s %s", operatornames[dl->operator], Fmt_bytes2str(dl->limit_absolute, (char[10]){})); } else { Util_printRule(res->outputbuffer, dl->action, "If %s %.1f%%", operatornames[dl->operator], dl->limit_percent); } StringBuffer_append(res->outputbuffer, ""); } else if (dl->resource == Resource_SpaceFree) { StringBuffer_append(res->outputbuffer, "Space free limit"); if (dl->limit_absolute > -1) { Util_printRule(res->outputbuffer, dl->action, "If %s %s", operatornames[dl->operator], Fmt_bytes2str(dl->limit_absolute, (char[10]){})); } else { Util_printRule(res->outputbuffer, dl->action, "If %s %.1f%%", operatornames[dl->operator], dl->limit_percent); } StringBuffer_append(res->outputbuffer, ""); } else if (dl->resource == Resource_ReadBytes) { StringBuffer_append(res->outputbuffer, "Read limit"); Util_printRule(res->outputbuffer, dl->action, "If read %s %s/s", operatornames[dl->operator], Fmt_bytes2str(dl->limit_absolute, (char[10]){})); StringBuffer_append(res->outputbuffer, ""); } else if (dl->resource == Resource_ReadOperations) { StringBuffer_append(res->outputbuffer, "Read limit"); Util_printRule(res->outputbuffer, dl->action, "If read %s %llu operations/s", operatornames[dl->operator], dl->limit_absolute); StringBuffer_append(res->outputbuffer, ""); } else if (dl->resource == Resource_WriteBytes) { StringBuffer_append(res->outputbuffer, "Write limit"); Util_printRule(res->outputbuffer, dl->action, "If write %s %s/s", operatornames[dl->operator], Fmt_bytes2str(dl->limit_absolute, (char[10]){})); StringBuffer_append(res->outputbuffer, ""); } else if (dl->resource == Resource_WriteOperations) { StringBuffer_append(res->outputbuffer, "Write limit"); Util_printRule(res->outputbuffer, dl->action, "If write %s %llu operations/s", operatornames[dl->operator], dl->limit_absolute); StringBuffer_append(res->outputbuffer, ""); } else if (dl->resource == Resource_ServiceTime) { StringBuffer_append(res->outputbuffer, "Service time limit"); Util_printRule(res->outputbuffer, dl->action, "If service time %s %s/operation", operatornames[dl->operator], Fmt_time2str(dl->limit_absolute, (char[11]){})); StringBuffer_append(res->outputbuffer, ""); } } } static void print_service_rules_size(HttpResponse res, Service_T s) { for (Size_T sl = s->sizelist; sl; sl = sl->next) { StringBuffer_append(res->outputbuffer, "Size"); if (sl->test_changes) Util_printRule(res->outputbuffer, sl->action, "If changed"); else Util_printRule(res->outputbuffer, sl->action, "If %s %llu byte(s)", operatornames[sl->operator], sl->size); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_linkstatus(HttpResponse res, Service_T s) { for (LinkStatus_T l = s->linkstatuslist; l; l = l->next) { StringBuffer_append(res->outputbuffer, "Link status"); Util_printRule(res->outputbuffer, l->action, "If failed"); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_linkspeed(HttpResponse res, Service_T s) { for (LinkSpeed_T l = s->linkspeedlist; l; l = l->next) { StringBuffer_append(res->outputbuffer, "Link capacity"); Util_printRule(res->outputbuffer, l->action, "If changed"); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_linksaturation(HttpResponse res, Service_T s) { for (LinkSaturation_T l = s->linksaturationlist; l; l = l->next) { StringBuffer_append(res->outputbuffer, "Link saturation"); Util_printRule(res->outputbuffer, l->action, "If %s %.1f%%", operatornames[l->operator], l->limit); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_uploadbytes(HttpResponse res, Service_T s) { for (Bandwidth_T bl = s->uploadbyteslist; bl; bl = bl->next) { if (bl->range == Time_Second) { StringBuffer_append(res->outputbuffer, "Upload bytes"); Util_printRule(res->outputbuffer, bl->action, "If %s %s/s", operatornames[bl->operator], Fmt_bytes2str(bl->limit, (char[10]){})); } else { StringBuffer_append(res->outputbuffer, "Total upload bytes"); Util_printRule(res->outputbuffer, bl->action, "If %s %s in last %d %s(s)", operatornames[bl->operator], Fmt_bytes2str(bl->limit, (char[10]){}), bl->rangecount, Util_timestr(bl->range)); } StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_uploadpackets(HttpResponse res, Service_T s) { for (Bandwidth_T bl = s->uploadpacketslist; bl; bl = bl->next) { if (bl->range == Time_Second) { StringBuffer_append(res->outputbuffer, "Upload packets"); Util_printRule(res->outputbuffer, bl->action, "If %s %lld packets/s", operatornames[bl->operator], bl->limit); } else { StringBuffer_append(res->outputbuffer, "Total upload packets"); Util_printRule(res->outputbuffer, bl->action, "If %s %lld packets in last %d %s(s)", operatornames[bl->operator], bl->limit, bl->rangecount, Util_timestr(bl->range)); } StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_downloadbytes(HttpResponse res, Service_T s) { for (Bandwidth_T bl = s->downloadbyteslist; bl; bl = bl->next) { if (bl->range == Time_Second) { StringBuffer_append(res->outputbuffer, "Download bytes"); Util_printRule(res->outputbuffer, bl->action, "If %s %s/s", operatornames[bl->operator], Fmt_bytes2str(bl->limit, (char[10]){})); } else { StringBuffer_append(res->outputbuffer, "Total download bytes"); Util_printRule(res->outputbuffer, bl->action, "If %s %s in last %d %s(s)", operatornames[bl->operator], Fmt_bytes2str(bl->limit, (char[10]){}), bl->rangecount, Util_timestr(bl->range)); } StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_downloadpackets(HttpResponse res, Service_T s) { for (Bandwidth_T bl = s->downloadpacketslist; bl; bl = bl->next) { if (bl->range == Time_Second) { StringBuffer_append(res->outputbuffer, "Download packets"); Util_printRule(res->outputbuffer, bl->action, "If %s %lld packets/s", operatornames[bl->operator], bl->limit); } else { StringBuffer_append(res->outputbuffer, "Total download packets"); Util_printRule(res->outputbuffer, bl->action, "If %s %lld packets in last %d %s(s)", operatornames[bl->operator], bl->limit, bl->rangecount, Util_timestr(bl->range)); } StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_uptime(HttpResponse res, Service_T s) { for (Uptime_T ul = s->uptimelist; ul; ul = ul->next) { StringBuffer_append(res->outputbuffer, "Uptime"); Util_printRule(res->outputbuffer, ul->action, "If %s %s", operatornames[ul->operator], _getUptime(ul->uptime, (char[256]){})); StringBuffer_append(res->outputbuffer, ""); } } 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_append(res->outputbuffer, "Ignore content"); Util_printRule(res->outputbuffer, ml->action, "If content %s \"%s\"", ml->not ? "!=" : "=", ml->match_string); StringBuffer_append(res->outputbuffer, ""); } for (Match_T ml = s->matchlist; ml; ml = ml->next) { StringBuffer_append(res->outputbuffer, "Content match"); Util_printRule(res->outputbuffer, ml->action, "If content %s \"%s\"", ml->not ? "!=" : "=", ml->match_string); StringBuffer_append(res->outputbuffer, ""); } } } static void print_service_rules_checksum(HttpResponse res, Service_T s) { if (s->checksum) { StringBuffer_append(res->outputbuffer, "Checksum"); if (s->checksum->test_changes) Util_printRule(res->outputbuffer, s->checksum->action, "If changed %s", checksumnames[s->checksum->type]); else Util_printRule(res->outputbuffer, s->checksum->action, "If failed %s(%s)", s->checksum->hash, checksumnames[s->checksum->type]); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_pid(HttpResponse res, Service_T s) { for (Pid_T l = s->pidlist; l; l = l->next) { StringBuffer_append(res->outputbuffer, "PID"); Util_printRule(res->outputbuffer, l->action, "If changed"); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_ppid(HttpResponse res, Service_T s) { for (Pid_T l = s->ppidlist; l; l = l->next) { StringBuffer_append(res->outputbuffer, "PPID"); Util_printRule(res->outputbuffer, l->action, "If changed"); StringBuffer_append(res->outputbuffer, ""); } } static void print_service_rules_program(HttpResponse res, Service_T s) { if (s->type == Service_Program) { StringBuffer_append(res->outputbuffer, "Program timeoutTerminate 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_append(res->outputbuffer, "Test Exit value"); if (status->operator == Operator_Changed) Util_printRule(res->outputbuffer, status->action, "If exit value changed"); else Util_printRule(res->outputbuffer, status->action, "If exit value %s %d", operatorshortnames[status->operator], status->return_value); StringBuffer_append(res->outputbuffer, ""); } } } static void print_service_rules_resource(HttpResponse res, Service_T s) { char buf[STRLEN]; for (Resource_T q = s->resourcelist; q; q = q->next) { StringBuffer_append(res->outputbuffer, ""); switch (q->resource_id) { case Resource_CpuPercent: StringBuffer_append(res->outputbuffer, "CPU usage limit"); break; case Resource_CpuPercentTotal: StringBuffer_append(res->outputbuffer, "CPU usage limit (incl. children)"); break; case Resource_CpuUser: StringBuffer_append(res->outputbuffer, "CPU user limit"); break; case Resource_CpuSystem: StringBuffer_append(res->outputbuffer, "CPU system limit"); break; case Resource_CpuWait: StringBuffer_append(res->outputbuffer, "CPU wait limit"); break; case Resource_MemoryPercent: StringBuffer_append(res->outputbuffer, "Memory usage limit"); break; case Resource_MemoryKbyte: StringBuffer_append(res->outputbuffer, "Memory amount limit"); break; case Resource_SwapPercent: StringBuffer_append(res->outputbuffer, "Swap usage limit"); break; case Resource_SwapKbyte: StringBuffer_append(res->outputbuffer, "Swap amount limit"); break; case Resource_LoadAverage1m: StringBuffer_append(res->outputbuffer, "Load average (1m)"); break; case Resource_LoadAverage5m: StringBuffer_append(res->outputbuffer, "Load average (5m)"); break; case Resource_LoadAverage15m: StringBuffer_append(res->outputbuffer, "Load average (15m)"); break; case Resource_LoadAveragePerCore1m: StringBuffer_append(res->outputbuffer, "Load average per core (1m)"); break; case Resource_LoadAveragePerCore5m: StringBuffer_append(res->outputbuffer, "Load average per core (5m)"); break; case Resource_LoadAveragePerCore15m: StringBuffer_append(res->outputbuffer, "Load average per core (15m)"); break; case Resource_Threads: StringBuffer_append(res->outputbuffer, "Threads"); break; case Resource_Children: StringBuffer_append(res->outputbuffer, "Children"); break; case Resource_MemoryKbyteTotal: StringBuffer_append(res->outputbuffer, "Memory amount limit (incl. children)"); break; case Resource_MemoryPercentTotal: StringBuffer_append(res->outputbuffer, "Memory usage limit (incl. children)"); break; case Resource_ReadBytes: StringBuffer_append(res->outputbuffer, "Disk read limit"); break; case Resource_ReadOperations: StringBuffer_append(res->outputbuffer, "Disk read limit"); break; case Resource_WriteBytes: StringBuffer_append(res->outputbuffer, "Disk write limit"); break; case Resource_WriteOperations: StringBuffer_append(res->outputbuffer, "Disk write limit"); break; default: break; } StringBuffer_append(res->outputbuffer, ""); switch (q->resource_id) { case Resource_CpuPercent: case Resource_CpuPercentTotal: case Resource_MemoryPercentTotal: case Resource_CpuUser: case Resource_CpuSystem: case Resource_CpuWait: case Resource_MemoryPercent: case Resource_SwapPercent: Util_printRule(res->outputbuffer, q->action, "If %s %.1f%%", operatornames[q->operator], q->limit); break; case Resource_MemoryKbyte: case Resource_SwapKbyte: case Resource_MemoryKbyteTotal: Util_printRule(res->outputbuffer, q->action, "If %s %s", operatornames[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(res->outputbuffer, q->action, "If %s %.1f", operatornames[q->operator], q->limit); break; case Resource_Threads: case Resource_Children: Util_printRule(res->outputbuffer, q->action, "If %s %.0f", operatornames[q->operator], q->limit); break; case Resource_ReadBytes: case Resource_WriteBytes: Util_printRule(res->outputbuffer, q->action, "if %s %s", operatornames[q->operator], Fmt_bytes2str(q->limit, (char[10]){})); break; case Resource_ReadOperations: case Resource_WriteOperations: Util_printRule(res->outputbuffer, q->action, "if %s %.0f operations/s", operatornames[q->operator], q->limit); break; default: break; } StringBuffer_append(res->outputbuffer, ""); } } static boolean_t is_readonly(HttpRequest req) { 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))); 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]){})); int found = 0; 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 = servicegrouplist; 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); found++; } break; } } } else { for (Service_T s = servicelist_conf; s; s = s->next_conf) { if (! stringService || IS(stringService, s->name)) { status_service_txt(s, res); found++; } } } if (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 _printServiceSummary(Box_T t, Service_T s) { Box_setColumn(t, 1, "%s", s->name); Box_setColumn(t, 2, "%s", get_service_status(TXT, s, (char[STRLEN]){}, STRLEN)); Box_setColumn(t, 3, "%s", servicetypes[s->type]); Box_printRow(t); } static int _printServiceSummaryByType(Box_T t, Service_Type type) { int found = 0; for (Service_T s = servicelist_conf; s; s = s->next_conf) { if (s->type == type) { _printServiceSummary(t, s); found++; } } return 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]){})); int found = 0; const char *stringGroup = Util_urlDecode((char *)get_parameter(req, "group")); const char *stringService = Util_urlDecode((char *)get_parameter(req, "service")); Box_T t = Box_new(res->outputbuffer, 3, (BoxColumn_T []){ {.name = "Service Name", .width = 31, .wrap = false, .align = BoxAlign_Left}, {.name = "Status", .width = 26, .wrap = false, .align = BoxAlign_Left}, {.name = "Type", .width = 13, .wrap = false, .align = BoxAlign_Left} }, true); if (stringGroup) { for (ServiceGroup_T sg = servicegrouplist; sg; sg = sg->next) { if (IS(stringGroup, sg->name)) { for (list_t m = sg->members->head; m; m = m->next) { _printServiceSummary(t, m->e); found++; } break; } } } else if (stringService) { for (Service_T s = servicelist_conf; s; s = s->next_conf) { if (IS(stringService, s->name)) { _printServiceSummary(t, s); found++; } } } else { found += _printServiceSummaryByType(t, Service_System); found += _printServiceSummaryByType(t, Service_Process); found += _printServiceSummaryByType(t, Service_File); found += _printServiceSummaryByType(t, Service_Fifo); found += _printServiceSummaryByType(t, Service_Directory); found += _printServiceSummaryByType(t, Service_Filesystem); found += _printServiceSummaryByType(t, Service_Host); found += _printServiceSummaryByType(t, Service_Net); found += _printServiceSummaryByType(t, Service_Program); } Box_free(&t); if (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 _printReport(HttpRequest req, HttpResponse res) { set_content_type(res, "text/plain"); const char *type = get_parameter(req, "type"); int count = 0; if (! type) { float up = 0, down = 0, init = 0, unmonitored = 0, total = 0; for (Service_T s = servicelist; s; s = s->next) { if (s->monitor == Monitor_Not) unmonitored++; else if (s->monitor & Monitor_Init) init++; else if (s->error) down++; else up++; total++; } 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, up, 100. * up / total, 3, down, 100. * down / total, 3, init, 100. * init / total, 3, unmonitored, 100. * unmonitored / total, 3, total); } else if (Str_isEqual(type, "up")) { for (Service_T s = servicelist; s; s = s->next) if (s->monitor != Monitor_Not && ! (s->monitor & Monitor_Init) && ! s->error) count++; StringBuffer_append(res->outputbuffer, "%d\n", count); } else if (Str_isEqual(type, "down")) { for (Service_T s = servicelist; s; s = s->next) if (s->monitor != Monitor_Not && ! (s->monitor & Monitor_Init) && s->error) count++; StringBuffer_append(res->outputbuffer, "%d\n", count); } else if (Str_startsWith(type, "initiali")) { // allow 'initiali(s|z)ing' for (Service_T s = servicelist; s; s = s->next) if (s->monitor & Monitor_Init) count++; StringBuffer_append(res->outputbuffer, "%d\n", count); } else if (Str_isEqual(type, "unmonitored")) { for (Service_T s = servicelist; s; s = s->next) if (s->monitor == Monitor_Not) count++; StringBuffer_append(res->outputbuffer, "%d\n", count); } else if (Str_isEqual(type, "total")) { for (Service_T s = servicelist; s; s = s->next) count++; StringBuffer_append(res->outputbuffer, "%d\n", count); } 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", servicetypes[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", modenames[s->mode]); StringBuffer_append(res->outputbuffer, " %-28s %s\n", "on reboot", onrebootnames[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, Color_lightYellow("Not monitored")); } else if (s->monitor & Monitor_Waiting) { if (type == HTML) snprintf(buf, buflen, "Waiting"); else snprintf(buf, buflen, Color_white("Waiting")); } else if (s->monitor & Monitor_Init) { if (type == HTML) snprintf(buf, buflen, "Initializing"); else snprintf(buf, buflen, Color_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" : Color_lightGreen("OK")); } else { // In the case that the service has actualy 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) { 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), Color_lightYellow("%s", (*et).description_changed)); } else { if (type == HTML) p += snprintf(p, buflen - (p - buf), "%s", (*et).description_failed); else p += snprintf(p, buflen - (p - buf), Color_lightRed("%s", (*et).description_failed)); } } et++; } } if (s->doaction) snprintf(buf + strlen(buf), buflen - strlen(buf) - 1, " - %s pending", actionnames[s->doaction]); return buf; } monit-5.26.0/src/http/base64.c0000664000175000017500000001271313507751326015655 0ustar martinpmartinp/* * 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 boolean_t 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 (int 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 recieve 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.26.0/src/http/client.h0000664000175000017500000000357713507751326016064 0ustar martinpmartinp/* * 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 */ boolean_t HttpClient_action(const char *action, List_T services); /** * Print service report * @param type Report type or NULL * @return true if succeeded otherwise false */ boolean_t HttpClient_report(const char *type); /** * Print service status * @param group Service group or NULL * @param service Service name or NULL * @return true if succeeded otherwise false */ boolean_t 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 */ boolean_t HttpClient_summary(const char *group, const char *service); #endif monit-5.26.0/src/http/base64.h0000664000175000017500000000226113507751326015657 0ustar martinpmartinp/* * 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.26.0/src/y.tab.c0000664000175000017500000121574313507751355014642 0ustar martinpmartinp/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015 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. */ /* 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. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Copy the first part of user declarations. */ #line 26 "src/p.y" /* yacc.c:339 */ /* * 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 #include "net.h" #include "monit.h" #include "protocol.h" #include "engine.h" #include "alert.h" #include "ProcessTree.h" #include "device.h" #include "processor.h" // libmonit #include "io/File.h" #include "util/Str.h" #include "thread/Thread.h" /* ------------------------------------------------------------- Definitions */ struct precedence_t { boolean_t daemon; boolean_t logfile; boolean_t pidfile; }; struct rate_t { unsigned count; unsigned cycles; }; /* yacc interface */ void yyerror(const char *,...); void yyerror2(const char *,...); void yywarning(const char *,...); void yywarning2(const char *,...); /* 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 Uptime_T uptimeset = {}; 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}; 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 repeat = 0; static unsigned repeat1 = 0; static unsigned repeat2 = 0; static Digest_Type digesttype = Digest_Cleartext; #define BITMAP_MAX (sizeof(long long) * 8) /* -------------------------------------------------------------- Prototypes */ static void preparse(void); static void postparse(void); static boolean_t _parseOutgoingAddress(const 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 addport(Port_T *, Port_T); static void addhttpheader(Port_T, const char *); static void addresource(Resource_T); static void addtimestamp(Timestamp_T); static void addactionrate(ActionRate_T); static void addsize(Size_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 boolean_t addcredentials(char *, char *, Digest_Type, boolean_t); #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 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 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_uptimeset(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, boolean_t isFile); static void _setSSLOptions(SslOptions_T options); static void addsecurityattribute(char *, Action_Type, Action_Type); #line 350 "src/y.tab.c" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus # define YY_NULLPTR nullptr # else # define YY_NULLPTR 0 # endif # endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* In a future release of Bison, this section will be replaced by #include "y.tab.h". */ #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 type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { IF = 258, ELSE = 259, THEN = 260, FAILED = 261, SET = 262, LOGFILE = 263, FACILITY = 264, DAEMON = 265, SYSLOG = 266, MAILSERVER = 267, HTTPD = 268, ALLOW = 269, REJECTOPT = 270, ADDRESS = 271, INIT = 272, TERMINAL = 273, BATCH = 274, READONLY = 275, CLEARTEXT = 276, MD5HASH = 277, SHA1HASH = 278, CRYPT = 279, DELAY = 280, PEMFILE = 281, ENABLE = 282, DISABLE = 283, SSL = 284, CIPHER = 285, CLIENTPEMFILE = 286, ALLOWSELFCERTIFICATION = 287, SELFSIGNED = 288, VERIFY = 289, CERTIFICATE = 290, CACERTIFICATEFILE = 291, CACERTIFICATEPATH = 292, VALID = 293, INTERFACE = 294, LINK = 295, PACKET = 296, BYTEIN = 297, BYTEOUT = 298, PACKETIN = 299, PACKETOUT = 300, SPEED = 301, SATURATION = 302, UPLOAD = 303, DOWNLOAD = 304, TOTAL = 305, IDFILE = 306, STATEFILE = 307, SEND = 308, EXPECT = 309, CYCLE = 310, COUNT = 311, REMINDER = 312, REPEAT = 313, LIMITS = 314, SENDEXPECTBUFFER = 315, EXPECTBUFFER = 316, FILECONTENTBUFFER = 317, HTTPCONTENTBUFFER = 318, PROGRAMOUTPUT = 319, NETWORKTIMEOUT = 320, PROGRAMTIMEOUT = 321, STARTTIMEOUT = 322, STOPTIMEOUT = 323, RESTARTTIMEOUT = 324, PIDFILE = 325, START = 326, STOP = 327, PATHTOK = 328, HOST = 329, HOSTNAME = 330, PORT = 331, IPV4 = 332, IPV6 = 333, TYPE = 334, UDP = 335, TCP = 336, TCPSSL = 337, PROTOCOL = 338, CONNECTION = 339, ALERT = 340, NOALERT = 341, MAILFORMAT = 342, UNIXSOCKET = 343, SIGNATURE = 344, TIMEOUT = 345, RETRY = 346, RESTART = 347, CHECKSUM = 348, EVERY = 349, NOTEVERY = 350, DEFAULT = 351, HTTP = 352, HTTPS = 353, APACHESTATUS = 354, FTP = 355, SMTP = 356, SMTPS = 357, POP = 358, POPS = 359, IMAP = 360, IMAPS = 361, CLAMAV = 362, NNTP = 363, NTP3 = 364, MYSQL = 365, DNS = 366, WEBSOCKET = 367, MQTT = 368, SSH = 369, DWP = 370, LDAP2 = 371, LDAP3 = 372, RDATE = 373, RSYNC = 374, TNS = 375, PGSQL = 376, POSTFIXPOLICY = 377, SIP = 378, LMTP = 379, GPS = 380, RADIUS = 381, MEMCACHE = 382, REDIS = 383, MONGODB = 384, SIEVE = 385, SPAMASSASSIN = 386, FAIL2BAN = 387, STRING = 388, PATH = 389, MAILADDR = 390, MAILFROM = 391, MAILREPLYTO = 392, MAILSUBJECT = 393, MAILBODY = 394, SERVICENAME = 395, STRINGNAME = 396, NUMBER = 397, PERCENT = 398, LOGLIMIT = 399, CLOSELIMIT = 400, DNSLIMIT = 401, KEEPALIVELIMIT = 402, REPLYLIMIT = 403, REQUESTLIMIT = 404, STARTLIMIT = 405, WAITLIMIT = 406, GRACEFULLIMIT = 407, CLEANUPLIMIT = 408, REAL = 409, CHECKPROC = 410, CHECKFILESYS = 411, CHECKFILE = 412, CHECKDIR = 413, CHECKHOST = 414, CHECKSYSTEM = 415, CHECKFIFO = 416, CHECKPROGRAM = 417, CHECKNET = 418, THREADS = 419, CHILDREN = 420, METHOD = 421, GET = 422, HEAD = 423, STATUS = 424, ORIGIN = 425, VERSIONOPT = 426, READ = 427, WRITE = 428, OPERATION = 429, SERVICETIME = 430, DISK = 431, RESOURCE = 432, MEMORY = 433, TOTALMEMORY = 434, LOADAVG1 = 435, LOADAVG5 = 436, LOADAVG15 = 437, SWAP = 438, MODE = 439, ACTIVE = 440, PASSIVE = 441, MANUAL = 442, ONREBOOT = 443, NOSTART = 444, LASTSTATE = 445, CORE = 446, CPU = 447, TOTALCPU = 448, CPUUSER = 449, CPUSYSTEM = 450, CPUWAIT = 451, GROUP = 452, REQUEST = 453, DEPENDS = 454, BASEDIR = 455, SLOT = 456, EVENTQUEUE = 457, SECRET = 458, HOSTHEADER = 459, UID = 460, EUID = 461, GID = 462, MMONIT = 463, INSTANCE = 464, USERNAME = 465, PASSWORD = 466, TIME = 467, ATIME = 468, CTIME = 469, MTIME = 470, CHANGED = 471, MILLISECOND = 472, SECOND = 473, MINUTE = 474, HOUR = 475, DAY = 476, MONTH = 477, SSLAUTO = 478, SSLV2 = 479, SSLV3 = 480, TLSV1 = 481, TLSV11 = 482, TLSV12 = 483, TLSV13 = 484, CERTMD5 = 485, AUTO = 486, BYTE = 487, KILOBYTE = 488, MEGABYTE = 489, GIGABYTE = 490, INODE = 491, SPACE = 492, TFREE = 493, PERMISSION = 494, SIZE = 495, MATCH = 496, NOT = 497, IGNORE = 498, ACTION = 499, UPTIME = 500, EXEC = 501, UNMONITOR = 502, PING = 503, PING4 = 504, PING6 = 505, ICMP = 506, ICMPECHO = 507, NONEXIST = 508, EXIST = 509, INVALID = 510, DATA = 511, RECOVERED = 512, PASSED = 513, SUCCEEDED = 514, URL = 515, CONTENT = 516, PID = 517, PPID = 518, FSFLAG = 519, REGISTER = 520, CREDENTIALS = 521, URLOBJECT = 522, ADDRESSOBJECT = 523, TARGET = 524, TIMESPEC = 525, HTTPHEADER = 526, MAXFORWARD = 527, FIPS = 528, SECURITY = 529, ATTRIBUTE = 530, GREATER = 531, GREATEROREQUAL = 532, LESS = 533, LESSOREQUAL = 534, EQUAL = 535, NOTEQUAL = 536 }; #endif /* Tokens. */ #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 ENABLE 282 #define DISABLE 283 #define SSL 284 #define CIPHER 285 #define CLIENTPEMFILE 286 #define ALLOWSELFCERTIFICATION 287 #define SELFSIGNED 288 #define VERIFY 289 #define CERTIFICATE 290 #define CACERTIFICATEFILE 291 #define CACERTIFICATEPATH 292 #define VALID 293 #define INTERFACE 294 #define LINK 295 #define PACKET 296 #define BYTEIN 297 #define BYTEOUT 298 #define PACKETIN 299 #define PACKETOUT 300 #define SPEED 301 #define SATURATION 302 #define UPLOAD 303 #define DOWNLOAD 304 #define TOTAL 305 #define IDFILE 306 #define STATEFILE 307 #define SEND 308 #define EXPECT 309 #define CYCLE 310 #define COUNT 311 #define REMINDER 312 #define REPEAT 313 #define LIMITS 314 #define SENDEXPECTBUFFER 315 #define EXPECTBUFFER 316 #define FILECONTENTBUFFER 317 #define HTTPCONTENTBUFFER 318 #define PROGRAMOUTPUT 319 #define NETWORKTIMEOUT 320 #define PROGRAMTIMEOUT 321 #define STARTTIMEOUT 322 #define STOPTIMEOUT 323 #define RESTARTTIMEOUT 324 #define PIDFILE 325 #define START 326 #define STOP 327 #define PATHTOK 328 #define HOST 329 #define HOSTNAME 330 #define PORT 331 #define IPV4 332 #define IPV6 333 #define TYPE 334 #define UDP 335 #define TCP 336 #define TCPSSL 337 #define PROTOCOL 338 #define CONNECTION 339 #define ALERT 340 #define NOALERT 341 #define MAILFORMAT 342 #define UNIXSOCKET 343 #define SIGNATURE 344 #define TIMEOUT 345 #define RETRY 346 #define RESTART 347 #define CHECKSUM 348 #define EVERY 349 #define NOTEVERY 350 #define DEFAULT 351 #define HTTP 352 #define HTTPS 353 #define APACHESTATUS 354 #define FTP 355 #define SMTP 356 #define SMTPS 357 #define POP 358 #define POPS 359 #define IMAP 360 #define IMAPS 361 #define CLAMAV 362 #define NNTP 363 #define NTP3 364 #define MYSQL 365 #define DNS 366 #define WEBSOCKET 367 #define MQTT 368 #define SSH 369 #define DWP 370 #define LDAP2 371 #define LDAP3 372 #define RDATE 373 #define RSYNC 374 #define TNS 375 #define PGSQL 376 #define POSTFIXPOLICY 377 #define SIP 378 #define LMTP 379 #define GPS 380 #define RADIUS 381 #define MEMCACHE 382 #define REDIS 383 #define MONGODB 384 #define SIEVE 385 #define SPAMASSASSIN 386 #define FAIL2BAN 387 #define STRING 388 #define PATH 389 #define MAILADDR 390 #define MAILFROM 391 #define MAILREPLYTO 392 #define MAILSUBJECT 393 #define MAILBODY 394 #define SERVICENAME 395 #define STRINGNAME 396 #define NUMBER 397 #define PERCENT 398 #define LOGLIMIT 399 #define CLOSELIMIT 400 #define DNSLIMIT 401 #define KEEPALIVELIMIT 402 #define REPLYLIMIT 403 #define REQUESTLIMIT 404 #define STARTLIMIT 405 #define WAITLIMIT 406 #define GRACEFULLIMIT 407 #define CLEANUPLIMIT 408 #define REAL 409 #define CHECKPROC 410 #define CHECKFILESYS 411 #define CHECKFILE 412 #define CHECKDIR 413 #define CHECKHOST 414 #define CHECKSYSTEM 415 #define CHECKFIFO 416 #define CHECKPROGRAM 417 #define CHECKNET 418 #define THREADS 419 #define CHILDREN 420 #define METHOD 421 #define GET 422 #define HEAD 423 #define STATUS 424 #define ORIGIN 425 #define VERSIONOPT 426 #define READ 427 #define WRITE 428 #define OPERATION 429 #define SERVICETIME 430 #define DISK 431 #define RESOURCE 432 #define MEMORY 433 #define TOTALMEMORY 434 #define LOADAVG1 435 #define LOADAVG5 436 #define LOADAVG15 437 #define SWAP 438 #define MODE 439 #define ACTIVE 440 #define PASSIVE 441 #define MANUAL 442 #define ONREBOOT 443 #define NOSTART 444 #define LASTSTATE 445 #define CORE 446 #define CPU 447 #define TOTALCPU 448 #define CPUUSER 449 #define CPUSYSTEM 450 #define CPUWAIT 451 #define GROUP 452 #define REQUEST 453 #define DEPENDS 454 #define BASEDIR 455 #define SLOT 456 #define EVENTQUEUE 457 #define SECRET 458 #define HOSTHEADER 459 #define UID 460 #define EUID 461 #define GID 462 #define MMONIT 463 #define INSTANCE 464 #define USERNAME 465 #define PASSWORD 466 #define TIME 467 #define ATIME 468 #define CTIME 469 #define MTIME 470 #define CHANGED 471 #define MILLISECOND 472 #define SECOND 473 #define MINUTE 474 #define HOUR 475 #define DAY 476 #define MONTH 477 #define SSLAUTO 478 #define SSLV2 479 #define SSLV3 480 #define TLSV1 481 #define TLSV11 482 #define TLSV12 483 #define TLSV13 484 #define CERTMD5 485 #define AUTO 486 #define BYTE 487 #define KILOBYTE 488 #define MEGABYTE 489 #define GIGABYTE 490 #define INODE 491 #define SPACE 492 #define TFREE 493 #define PERMISSION 494 #define SIZE 495 #define MATCH 496 #define NOT 497 #define IGNORE 498 #define ACTION 499 #define UPTIME 500 #define EXEC 501 #define UNMONITOR 502 #define PING 503 #define PING4 504 #define PING6 505 #define ICMP 506 #define ICMPECHO 507 #define NONEXIST 508 #define EXIST 509 #define INVALID 510 #define DATA 511 #define RECOVERED 512 #define PASSED 513 #define SUCCEEDED 514 #define URL 515 #define CONTENT 516 #define PID 517 #define PPID 518 #define FSFLAG 519 #define REGISTER 520 #define CREDENTIALS 521 #define URLOBJECT 522 #define ADDRESSOBJECT 523 #define TARGET 524 #define TIMESPEC 525 #define HTTPHEADER 526 #define MAXFORWARD 527 #define FIPS 528 #define SECURITY 529 #define ATTRIBUTE 530 #define GREATER 531 #define GREATEROREQUAL 532 #define LESS 533 #define LESSOREQUAL 534 #define EQUAL 535 #define NOTEQUAL 536 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { #line 310 "src/p.y" /* yacc.c:355 */ URL_T url; Address_T address; float real; int number; char *string; #line 960 "src/y.tab.c" /* yacc.c:355 */ }; 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 */ /* Copy the second part of user declarations. */ #line 977 "src/y.tab.c" /* yacc.c:358 */ #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #else typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #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 # if (defined __GNUC__ \ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C # define YY_ATTRIBUTE(Spec) __attribute__(Spec) # else # define YY_ATTRIBUTE(Spec) /* empty */ # endif #endif #ifndef YY_ATTRIBUTE_PURE # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) #endif #ifndef YY_ATTRIBUTE_UNUSED # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) #endif #if !defined _Noreturn \ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) # if defined _MSC_VER && 1200 <= _MSC_VER # define _Noreturn __declspec (noreturn) # else # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(E) ((void) (E)) #else # define YYUSE(E) /* empty */ #endif #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") # 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 yyoverflow || YYERROR_VERBOSE /* 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 || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (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 \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*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, (Count) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ YYSIZE_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 1697 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 288 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 241 /* YYNRULES -- Number of rules. */ #define YYNRULES 783 /* YYNSTATES -- Number of states. */ #define YYNSTATES 1460 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 536 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM as returned by yylex, without out-of-bounds checking. */ static const yytype_uint16 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, 284, 2, 2, 2, 2, 2, 285, 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, 286, 2, 287, 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, 282, 2, 283, 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 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 361, 361, 362, 365, 366, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 399, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 426, 427, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 450, 451, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 476, 477, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 497, 498, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 516, 517, 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, 555, 556, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 576, 577, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 593, 597, 600, 606, 616, 621, 624, 629, 634, 637, 640, 645, 651, 654, 655, 658, 661, 664, 667, 670, 673, 676, 679, 682, 685, 688, 691, 694, 697, 702, 707, 715, 718, 723, 726, 730, 736, 741, 746, 754, 757, 758, 761, 767, 768, 771, 774, 775, 776, 777, 780, 781, 786, 791, 794, 797, 798, 801, 805, 809, 813, 817, 820, 824, 827, 830, 833, 838, 844, 845, 848, 862, 869, 878, 879, 882, 886, 890, 894, 902, 910, 919, 923, 929, 938, 945, 960, 961, 964, 973, 984, 985, 988, 991, 994, 995, 996, 997, 1000, 1017, 1018, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1033, 1039, 1045, 1051, 1057, 1063, 1064, 1067, 1072, 1077, 1081, 1085, 1091, 1092, 1095, 1096, 1099, 1102, 1107, 1112, 1115, 1123, 1127, 1131, 1135, 1139, 1139, 1146, 1146, 1153, 1153, 1160, 1160, 1167, 1174, 1175, 1178, 1184, 1187, 1192, 1195, 1198, 1205, 1214, 1219, 1222, 1227, 1232, 1237, 1245, 1251, 1266, 1271, 1279, 1289, 1292, 1297, 1300, 1306, 1309, 1314, 1315, 1318, 1319, 1322, 1325, 1330, 1334, 1338, 1341, 1346, 1349, 1354, 1359, 1362, 1367, 1376, 1377, 1380, 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1393, 1400, 1401, 1404, 1405, 1406, 1407, 1408, 1409, 1412, 1418, 1419, 1422, 1423, 1424, 1425, 1426, 1429, 1435, 1440, 1445, 1452, 1453, 1456, 1457, 1458, 1459, 1462, 1465, 1470, 1475, 1481, 1484, 1489, 1492, 1496, 1501, 1502, 1505, 1506, 1509, 1514, 1517, 1520, 1523, 1526, 1529, 1532, 1535, 1540, 1543, 1548, 1551, 1554, 1557, 1560, 1563, 1566, 1569, 1572, 1576, 1579, 1582, 1587, 1590, 1593, 1598, 1601, 1604, 1607, 1610, 1613, 1616, 1619, 1622, 1625, 1628, 1631, 1636, 1644, 1654, 1655, 1658, 1661, 1664, 1667, 1672, 1673, 1676, 1679, 1684, 1685, 1688, 1691, 1696, 1697, 1700, 1708, 1713, 1716, 1721, 1726, 1727, 1730, 1733, 1738, 1739, 1742, 1745, 1748, 1749, 1750, 1751, 1752, 1753, 1756, 1766, 1769, 1774, 1778, 1784, 1789, 1795, 1796, 1801, 1806, 1807, 1810, 1815, 1816, 1819, 1822, 1825, 1828, 1832, 1836, 1840, 1844, 1848, 1852, 1856, 1860, 1864, 1870, 1874, 1881, 1887, 1893, 1900, 1905, 1915, 1920, 1925, 1928, 1933, 1936, 1941, 1944, 1949, 1952, 1957, 1960, 1965, 1970, 1975, 1981, 1989, 1995, 1996, 1999, 2003, 2006, 2010, 2015, 2018, 2021, 2022, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 2057, 2058, 2061, 2062, 2065, 2066, 2067, 2068, 2071, 2075, 2079, 2085, 2088, 2091, 2097, 2100, 2104, 2109, 2116, 2119, 2120, 2123, 2126, 2133, 2142, 2148, 2149, 2152, 2153, 2154, 2155, 2156, 2157, 2158, 2161, 2167, 2168, 2171, 2172, 2173, 2174, 2177, 2182, 2189, 2196, 2197, 2198, 2199, 2202, 2207, 2214, 2219, 2224, 2229, 2236, 2241, 2248, 2255, 2262, 2282, 2283, 2284, 2287, 2288, 2292, 2297, 2304, 2309, 2316, 2317, 2320, 2321, 2322, 2323, 2326, 2333, 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2348, 2351, 2352, 2353, 2354, 2355, 2356, 2359, 2360, 2361, 2363, 2364, 2366, 2369, 2372, 2380, 2383, 2386, 2390, 2393, 2396, 2399, 2404, 2415, 2426, 2436, 2448, 2449, 2454, 2461, 2462, 2467, 2474, 2477, 2480, 2483, 2488, 2492, 2499, 2505, 2506, 2507, 2510, 2517, 2524, 2531, 2540, 2547, 2554, 2561, 2570, 2577, 2586, 2593, 2602, 2609, 2618, 2624, 2625, 2626, 2627, 2628, 2631, 2636, 2643, 2651, 2658, 2666, 2674, 2681, 2687, 2694, 2702, 2705, 2711, 2717, 2724, 2730, 2737, 2743, 2750, 2753, 2758, 2764, 2771, 2777, 2782, 2790, 2798, 2806, 2814, 2822, 2830, 2840, 2848, 2856, 2864, 2872, 2880, 2890, 2893, 2894, 2895 }; #endif #if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "IF", "ELSE", "THEN", "FAILED", "SET", "LOGFILE", "FACILITY", "DAEMON", "SYSLOG", "MAILSERVER", "HTTPD", "ALLOW", "REJECTOPT", "ADDRESS", "INIT", "TERMINAL", "BATCH", "READONLY", "CLEARTEXT", "MD5HASH", "SHA1HASH", "CRYPT", "DELAY", "PEMFILE", "ENABLE", "DISABLE", "SSL", "CIPHER", "CLIENTPEMFILE", "ALLOWSELFCERTIFICATION", "SELFSIGNED", "VERIFY", "CERTIFICATE", "CACERTIFICATEFILE", "CACERTIFICATEPATH", "VALID", "INTERFACE", "LINK", "PACKET", "BYTEIN", "BYTEOUT", "PACKETIN", "PACKETOUT", "SPEED", "SATURATION", "UPLOAD", "DOWNLOAD", "TOTAL", "IDFILE", "STATEFILE", "SEND", "EXPECT", "CYCLE", "COUNT", "REMINDER", "REPEAT", "LIMITS", "SENDEXPECTBUFFER", "EXPECTBUFFER", "FILECONTENTBUFFER", "HTTPCONTENTBUFFER", "PROGRAMOUTPUT", "NETWORKTIMEOUT", "PROGRAMTIMEOUT", "STARTTIMEOUT", "STOPTIMEOUT", "RESTARTTIMEOUT", "PIDFILE", "START", "STOP", "PATHTOK", "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", "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", "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", "GROUP", "REQUEST", "DEPENDS", "BASEDIR", "SLOT", "EVENTQUEUE", "SECRET", "HOSTHEADER", "UID", "EUID", "GID", "MMONIT", "INSTANCE", "USERNAME", "PASSWORD", "TIME", "ATIME", "CTIME", "MTIME", "CHANGED", "MILLISECOND", "SECOND", "MINUTE", "HOUR", "DAY", "MONTH", "SSLAUTO", "SSLV2", "SSLV3", "TLSV1", "TLSV11", "TLSV12", "TLSV13", "CERTMD5", "AUTO", "BYTE", "KILOBYTE", "MEGABYTE", "GIGABYTE", "INODE", "SPACE", "TFREE", "PERMISSION", "SIZE", "MATCH", "NOT", "IGNORE", "ACTION", "UPTIME", "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", "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", "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", "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", "target", "maxforward", "siplist", "sip", "httplist", "http", "status", "method", "request", "responsesum", "hostheader", "httpheaderlist", "secret", "radiuslist", "radius", "apache_stat_list", "apache_stat", "exist", "pid", "ppid", "uptime", "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", "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", "repeat", "action", "action1", "action2", "rateXcycles", "rateXYcycles", "rate1", "rate2", "recovery", "checksum", "hashtype", "inode", "space", "read", "write", "servicetime", "fsflag", "unit", "permission", "match", "matchflagnot", "size", "uid", "euid", "secattr", "gid", "linkstatus", "linkspeed", "linksaturation", "upload", "download", "icmptype", "reminder", YY_NULLPTR }; #endif # ifdef YYPRINT /* YYTOKNUM[NUM] -- (External) token number corresponding to the (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 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, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 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, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 123, 125, 58, 64, 91, 93 }; # endif #define YYPACT_NINF -751 #define yypact_value_is_default(Yystate) \ (!!((Yystate) == (-751))) #define YYTABLE_NINF -708 #define yytable_value_is_error(Yytable_value) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int16 yypact[] = { 542, 82, -61, -20, 44, 107, 120, 126, 138, 143, 184, 365, 542, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 111, -39, 91, -751, -751, 291, 86, 251, 268, 136, 302, 334, 336, 200, 103, -151, 238, -751, -41, 46, 437, 452, 460, 519, -751, 506, 512, 142, -751, -751, 553, 398, 1168, 1187, 1346, 1351, 1363, 1187, 1379, 529, -751, 518, 517, -12, -751, 991, -751, -751, -751, -751, -751, 490, -751, -751, 706, -751, -751, -751, 420, 461, -751, 238, 345, 331, 358, 1152, 603, 524, 528, 15, 427, 533, 535, 545, 562, 465, 554, 580, 249, 465, 465, 585, 465, -81, 468, 464, 186, 590, 611, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -30, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 106, -78, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 153, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 167, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 37, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 34, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 776, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -56, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 642, 757, -751, 636, 250, 654, -751, 732, 3, 681, 685, 734, 736, 539, 693, -751, 705, 722, 595, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 11, 170, -751, -751, -751, -751, -751, 586, 593, -751, -751, -7, -751, 667, -751, 405, 345, 600, -751, 706, 1152, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 831, -751, 728, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 410, -751, -751, -751, 22, 793, 753, 753, 471, 753, 753, -751, -751, -751, 753, 753, 419, 645, 753, 761, 1135, -751, -751, -751, -751, -751, -751, 738, -751, -751, 447, 450, -751, 478, 870, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 611, -751, 649, 1152, 603, 92, -751, -751, -751, -751, 351, 753, 645, 409, 753, 686, -751, 409, 704, 84, 753, 753, 753, -146, 852, 924, 625, -40, 903, 753, 753, 753, 658, 915, 753, 753, -751, -751, -751, -751, 1113, -751, -751, 753, -751, -751, -751, 753, 806, -751, 837, -751, 888, 378, 856, -751, -751, -751, -751, -751, -751, -751, 871, -751, -751, -751, -751, -751, -751, -751, -751, 788, 877, -751, 890, 901, 905, 758, 908, 911, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 766, 768, 770, 772, 777, 785, 790, 794, -751, -751, 799, 804, 805, 807, 812, 823, 828, 834, 853, -751, -751, -751, -751, -751, -751, 895, 918, -751, -751, -751, -751, -751, -751, -751, 383, 904, 985, -751, 1084, 999, 20, 52, 8, -751, -751, -751, 1009, 1011, 62, 284, 375, 880, 876, 1076, -751, 1012, -751, -751, -751, -751, -751, -751, -751, 1014, 1019, 753, 753, 158, 158, 158, 158, 761, 761, 761, 1021, 14, -751, -751, 1148, -751, 1164, -751, 753, 1030, 67, -751, 1033, 110, -751, 1035, 187, -751, -751, -751, 1152, 969, -751, -751, -751, 1037, 1087, 761, 761, 761, 1089, 1041, -751, -751, 609, 1042, 612, 634, 652, 261, 278, 301, 761, 753, 310, 753, 158, -751, -751, -751, 1106, 761, 1044, 1046, 1047, 753, 753, 761, 158, 158, -751, 1186, 158, 1051, 761, -751, 250, 6, -751, -751, -751, -751, -751, -751, 1073, 1074, 1077, 1078, 1079, 1196, 71, 199, 1083, 1085, 1092, 802, 824, 1093, 1094, 874, 1095, 1096, 1099, 1101, 1102, 1104, 1105, 1108, 1109, -751, 1001, -751, 985, 603, -751, 1003, -751, -751, -751, -751, -751, -751, -751, -751, 761, 761, 761, 761, 761, 761, -751, 696, 1114, -751, 883, 1174, -751, -751, 312, 343, -751, -751, 373, 483, 1091, 1118, 1230, 1243, 1269, 720, -751, 1220, 83, 83, 158, 1058, -751, 1060, -751, 1062, -751, 1080, 985, 761, 0, 1278, 1279, 1281, 761, 490, 761, 761, 720, 761, 761, -751, -751, -751, -751, 1116, 490, 1123, 490, 1071, 1086, 1293, 347, 65, 1158, 158, 494, 35, 35, 35, 1050, -751, 1298, 1163, 105, 124, 1170, 1176, 1305, 571, 578, 83, 1179, 761, 1318, 1052, 1052, -751, 1197, 1079, 1079, 1079, 1196, -751, 1079, -751, -751, -751, -751, 385, 413, 1195, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 490, 490, 490, 490, 665, 679, 688, 692, 702, -751, 603, -751, -751, 1333, 1334, 1335, 1340, 1341, 1342, -3, 761, 761, -751, 190, 1215, 1217, 778, 1542, 1209, 1211, -751, -751, -751, -751, -751, -751, 1350, 1353, 1188, 490, 1194, 490, -751, -751, -751, -751, -751, -751, 83, 83, 83, -751, -751, -751, -751, -751, 761, -751, -751, -751, -751, -751, 465, -751, -751, 1356, 1356, -751, -751, -751, -751, 985, 603, 1364, 1237, 1367, 83, 83, 83, 1368, 761, 1369, 1371, 761, 1372, 1373, 761, 1161, 761, 1161, 761, 761, 83, 65, 1238, 1375, 761, 601, 761, 761, 1250, 1245, 1246, 1247, -751, -751, -751, -751, -751, 1380, 1385, 1388, -751, 35, 83, 761, 1161, 1161, 1161, 1161, 164, 224, 83, -751, -751, -751, -751, 1356, -751, 1389, 83, 1262, 1266, -751, 1079, 1079, 1079, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 83, 83, 83, 83, 83, 83, 42, 409, -751, -751, -751, -751, -751, -751, -751, 1395, 1396, 1397, 1271, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 1404, -751, -751, -751, -751, -751, -751, -751, -751, 742, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 1, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 1193, -751, 83, 55, -751, 1161, -751, 1161, -751, -751, 1356, 1405, 329, 1409, -751, -751, 603, -751, 83, 761, 83, 1356, -751, -751, 83, 1414, 83, 83, 1415, 83, 83, 1416, -751, 761, 1419, 761, 1420, 1421, -751, 1422, 761, 83, 1423, 761, 761, 1424, 1425, -751, -751, 1221, -751, 83, 83, 83, 1428, 1356, 1437, 761, 761, 761, 761, 191, 203, 356, 400, 1356, -751, 83, -751, -751, -751, 1356, 1356, 1356, 1356, 1356, 1356, 1171, 1311, 83, 83, 83, -751, 83, 1252, -60, -60, 1322, 753, 753, 753, 753, 753, 753, 753, 753, 753, 753, -751, -751, 742, -751, 712, 712, 712, 1326, 1327, 1319, 1328, 1, -751, 712, 72, 1260, -751, 1356, -751, -751, -751, -751, -751, 83, 1374, -27, -751, 676, -751, 1356, 1461, 1356, -751, -751, 83, -751, -751, 83, -751, -751, 83, 1462, 83, 1464, 83, 83, 83, 1465, 1356, 83, 1467, 1487, 83, 83, -751, 1356, 1356, 1356, 83, -751, 83, 1488, 1489, 1490, 1491, 744, -751, -751, -751, 761, 744, 761, 744, 761, 744, 761, -751, 1356, -751, -751, -751, -751, -751, -751, -751, 1358, -751, 1356, 1356, 1356, 1356, -751, -751, -751, 1370, 749, 753, 827, 1381, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 1359, 1376, 1377, 1387, 1390, 1391, 1394, 1398, 1399, 1400, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 481, 1402, -751, -751, -751, 1382, -751, -751, -751, 1356, 19, -751, 761, 761, 761, -751, 83, -751, 1356, 1356, 1356, 83, 1356, 83, 1356, 1356, 1356, 83, -751, 1356, 83, 83, 1356, 1356, -751, -751, -751, 1356, 1356, 83, 83, 83, 83, 761, 1508, 761, 1526, 761, 1532, 761, 1533, -751, 1325, -751, -751, -751, -751, -751, -751, -751, 1407, -751, -751, -751, 40, 1418, 1434, 1436, 1438, 1439, 1440, 1441, 1442, 1453, 1454, -751, -751, -751, -751, -751, -751, 1509, -751, -751, 1560, 1561, 1575, 1356, -751, -751, -751, 1356, -751, 1356, -751, -751, -751, 1356, -751, 1356, 1356, -751, -751, -751, -751, 1356, 1356, 1356, 1356, 1593, 83, 1594, 83, 1595, 83, 1596, 83, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 83, 83, 83, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 83, 1356, 83, 1356, 83, 1356, 83, 1356, -751, -751, -751, -751, 1356, -751, 1356, -751, 1356, -751, 1356, -751, -751, -751, -751, -751 }; /* 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_uint16 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, 57, 77, 99, 116, 131, 148, 162, 179, 0, 0, 0, 291, 199, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 221, 598, 0, 0, 0, 0, 0, 352, 0, 0, 0, 1, 5, 24, 25, 26, 27, 28, 32, 29, 30, 31, 223, 222, 197, 282, 551, 278, 290, 196, 247, 228, 229, 205, 738, 230, 564, 0, 200, 201, 202, 0, 0, 235, 231, 242, 0, 0, 0, 781, 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, 46, 47, 48, 38, 39, 40, 45, 49, 50, 598, 563, 51, 52, 53, 54, 55, 56, 41, 42, 43, 44, 753, 753, 58, 59, 60, 61, 62, 64, 66, 65, 73, 74, 75, 76, 63, 70, 67, 72, 71, 68, 69, 0, 78, 79, 80, 81, 82, 83, 85, 84, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 86, 87, 88, 0, 100, 101, 102, 103, 104, 106, 108, 107, 112, 113, 114, 115, 105, 109, 110, 111, 0, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 0, 132, 133, 134, 135, 141, 145, 142, 143, 144, 146, 147, 136, 137, 138, 139, 140, 0, 149, 150, 151, 152, 161, 153, 154, 155, 156, 157, 158, 159, 160, 163, 164, 165, 166, 167, 169, 171, 170, 175, 176, 177, 178, 168, 172, 173, 174, 0, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 0, 0, 195, 0, 280, 0, 279, 375, 0, 0, 0, 0, 0, 245, 0, 304, 0, 0, 0, 293, 292, 294, 295, 296, 300, 301, 318, 319, 297, 298, 299, 0, 0, 739, 740, 741, 742, 203, 0, 0, 604, 605, 0, 600, 225, 227, 234, 242, 0, 232, 0, 0, 582, 569, 570, 584, 585, 592, 590, 572, 594, 571, 593, 589, 596, 578, 580, 595, 586, 591, 568, 597, 575, 579, 583, 576, 581, 574, 573, 587, 588, 577, 0, 566, 0, 192, 341, 342, 343, 344, 347, 346, 345, 348, 349, 353, 366, 367, 549, 362, 350, 351, 418, 0, 674, 674, 0, 674, 674, 657, 658, 659, 674, 674, 0, 0, 674, 707, 707, 623, 625, 626, 627, 628, 629, 660, 630, 631, 545, 543, 565, 547, 0, 607, 608, 609, 610, 611, 612, 613, 614, 615, 619, 616, 617, 0, 0, 781, 720, 668, 669, 670, 671, 720, 674, 754, 0, 674, 0, 754, 0, 0, 0, 674, 674, 674, 0, 674, 674, 0, 418, 0, 674, 674, 674, 0, 0, 674, 674, 645, 642, 643, 644, 707, 633, 638, 674, 636, 637, 635, 674, 0, 224, 0, 282, 0, 0, 0, 273, 267, 268, 269, 270, 271, 272, 0, 274, 286, 287, 288, 289, 283, 284, 285, 0, 0, 276, 0, 0, 0, 335, 323, 0, 320, 302, 315, 317, 247, 303, 305, 307, 314, 316, 0, 0, 0, 0, 0, 0, 0, 0, 244, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 204, 206, 602, 603, 277, 601, 0, 0, 236, 238, 239, 240, 241, 233, 243, 0, 0, 598, 567, 782, 0, 0, 0, 549, 363, 364, 354, 0, 0, 0, 0, 0, 0, 0, 0, 401, 0, 681, 675, 676, 677, 678, 679, 680, 0, 0, 674, 674, 0, 0, 0, 0, 707, 707, 707, 0, 0, 708, 709, 0, 624, 0, 661, 674, 0, 545, 356, 0, 543, 358, 0, 547, 360, 606, 618, 0, 0, 560, 721, 722, 0, 0, 707, 707, 707, 0, 0, 558, 559, 0, 0, 0, 0, 0, 0, 0, 0, 707, 674, 0, 674, 0, 412, 412, 412, 0, 707, 0, 0, 0, 674, 674, 707, 0, 0, 634, 0, 0, 0, 707, 198, 281, 265, 373, 372, 374, 275, 552, 376, 324, 325, 326, 0, 0, 339, 0, 306, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 226, 0, 599, 598, 781, 783, 0, 368, 370, 369, 371, 365, 355, 419, 421, 707, 707, 707, 707, 707, 707, 392, 0, 0, 378, 707, 0, 654, 655, 0, 0, 667, 666, 738, 738, 0, 0, 0, 0, 0, 682, 705, 0, 0, 0, 0, 0, 357, 0, 359, 0, 361, 0, 598, 707, 707, 0, 0, 0, 707, 738, 707, 707, 682, 707, 707, 748, 747, 752, 751, 667, 738, 667, 738, 667, 0, 0, 0, 667, 0, 0, 738, 707, 707, 707, 0, 412, 0, 0, 738, 738, 0, 0, 0, 738, 738, 0, 0, 707, 0, 265, 265, 266, 0, 0, 0, 0, 339, 338, 328, 336, 340, 322, 246, 0, 0, 0, 308, 255, 254, 256, 251, 252, 249, 250, 257, 258, 253, 738, 738, 738, 738, 0, 0, 0, 0, 0, 237, 781, 193, 550, 0, 0, 0, 0, 0, 0, 707, 707, 707, 420, 707, 0, 0, 0, 0, 0, 0, 402, 403, 404, 405, 406, 407, 0, 0, 667, 738, 667, 738, 649, 648, 651, 650, 639, 640, 0, 0, 0, 683, 684, 685, 686, 687, 707, 706, 700, 701, 696, 699, 0, 702, 703, 713, 713, 656, 546, 544, 548, 598, 781, 0, 0, 0, 0, 0, 0, 0, 707, 0, 0, 707, 0, 0, 707, 691, 707, 691, 707, 707, 0, 667, 0, 0, 707, 738, 707, 707, 0, 0, 0, 0, 413, 414, 415, 416, 417, 0, 0, 0, 780, 707, 0, 707, 691, 691, 691, 691, 738, 738, 0, 647, 646, 653, 652, 713, 641, 0, 0, 0, 0, 262, 330, 332, 334, 321, 337, 309, 311, 310, 312, 313, 207, 208, 209, 210, 211, 212, 213, 214, 217, 218, 215, 216, 219, 220, 194, 0, 0, 0, 0, 0, 0, 0, 0, 397, 399, 398, 393, 395, 396, 394, 0, 0, 0, 0, 422, 423, 388, 390, 389, 379, 380, 381, 386, 382, 383, 385, 387, 384, 0, 469, 470, 426, 424, 427, 433, 496, 496, 0, 437, 477, 477, 452, 453, 440, 441, 442, 449, 450, 485, 434, 0, 481, 458, 435, 443, 444, 459, 461, 462, 463, 451, 492, 464, 465, 516, 467, 460, 445, 454, 457, 436, 0, 554, 0, 0, 663, 691, 665, 691, 536, 537, 713, 0, 693, 0, 535, 622, 781, 561, 0, 707, 0, 713, 756, 673, 0, 0, 0, 0, 0, 0, 0, 0, 692, 707, 0, 707, 0, 0, 737, 0, 707, 0, 0, 707, 707, 0, 0, 542, 539, 0, 540, 0, 0, 0, 0, 713, 0, 707, 707, 707, 707, 0, 0, 0, 0, 713, 632, 0, 621, 263, 264, 713, 713, 713, 713, 713, 713, 260, 0, 0, 0, 0, 431, 0, 425, 438, 439, 0, 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, 521, 522, 432, 519, 455, 456, 447, 0, 0, 0, 0, 468, 471, 446, 448, 466, 553, 713, 556, 555, 662, 664, 534, 0, 0, 693, 697, 0, 562, 713, 0, 713, 744, 719, 0, 746, 745, 0, 750, 749, 0, 0, 0, 0, 0, 0, 0, 0, 713, 0, 0, 0, 0, 0, 541, 713, 713, 713, 0, 765, 0, 0, 0, 0, 0, 0, 688, 689, 690, 707, 0, 707, 0, 707, 0, 707, 766, 713, 757, 758, 759, 760, 763, 764, 261, 0, 557, 713, 713, 713, 713, 429, 430, 428, 0, 0, 674, 0, 0, 513, 498, 499, 497, 502, 503, 500, 501, 504, 523, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 520, 479, 480, 478, 487, 488, 486, 475, 473, 476, 474, 472, 483, 484, 482, 0, 0, 494, 495, 493, 0, 518, 517, 400, 713, 0, 698, 710, 710, 710, 743, 0, 717, 713, 713, 713, 0, 713, 0, 713, 713, 713, 0, 723, 713, 0, 0, 713, 713, 409, 410, 411, 713, 713, 0, 0, 0, 0, 707, 0, 707, 0, 707, 0, 707, 0, 620, 0, 391, 761, 762, 377, 511, 507, 508, 0, 510, 509, 512, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 490, 489, 491, 515, 538, 694, 0, 711, 712, 0, 0, 0, 713, 755, 672, 732, 713, 734, 713, 735, 736, 725, 713, 724, 713, 713, 728, 727, 408, 767, 713, 713, 713, 713, 0, 0, 0, 0, 0, 0, 0, 0, 259, 506, 514, 505, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 695, 0, 0, 0, 718, 731, 733, 726, 730, 729, 771, 768, 777, 774, 0, 713, 0, 713, 0, 713, 0, 713, 704, 714, 715, 716, 713, 772, 713, 769, 713, 778, 713, 775, 773, 770, 779, 776 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -751, -751, -751, 1615, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 1527, -751, -751, 1291, -751, -77, 1115, -751, 783, -751, -317, 189, -335, -334, -751, -751, -751, 1549, 1147, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 201, -737, 832, -751, -751, -751, -751, -751, -751, -751, -751, -751, 1192, 1412, 1433, -107, -398, -383, -555, -592, -313, -751, 1600, -751, -751, 1601, -751, -751, -751, -751, -751, -751, -586, -751, -751, -751, -751, -751, 789, -751, -751, -751, 830, 833, -751, 510, 651, -751, -751, -751, -751, -751, -751, -751, -751, -751, 657, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, -751, 523, 602, -751, -751, 1606, -751, -751, -751, -751, 1075, 1081, 1082, 1119, -751, -677, -459, 1449, 839, -432, 1480, 1686, -751, -319, -355, -140, 1349, -293, 1496, 1516, 1531, 1539, 1547, -751, 1257, -751, -751, -751, 1283, -751, -751, 1219, -751, -751, -751, -751, -751, -751, -751, -751, -217, -751, -751, -751, -751, 861, -82, 454, -391, 934, -635, -750, 514, -397, -538, -426, -257, -169, -408, -312, -333, -751, 1251, -751, -751, -751, -751, -751, -751, -37, 50, -751, 1541, -751, 661, -751, -751, 699, -751, -751, -751, -751, -751, -751, -429 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 11, 12, 13, 71, 130, 72, 157, 73, 177, 74, 199, 75, 216, 76, 231, 77, 248, 78, 261, 79, 278, 14, 15, 16, 292, 17, 18, 19, 20, 322, 543, 21, 22, 23, 24, 25, 26, 27, 102, 103, 336, 550, 339, 28, 497, 321, 532, 992, 1242, 498, 799, 499, 500, 29, 30, 84, 85, 294, 501, 31, 86, 310, 311, 312, 313, 314, 315, 678, 813, 316, 317, 318, 319, 320, 675, 800, 801, 802, 805, 806, 808, 32, 33, 34, 35, 36, 37, 38, 39, 40, 131, 132, 133, 388, 565, 389, 567, 502, 503, 506, 134, 847, 1007, 135, 843, 994, 136, 721, 854, 222, 778, 928, 576, 720, 577, 1008, 855, 1143, 1250, 1010, 856, 857, 1168, 1169, 1161, 1279, 1170, 1290, 1163, 1282, 1293, 1294, 1171, 1295, 1144, 1259, 1260, 1261, 1262, 1263, 1264, 1355, 1297, 1172, 1298, 1159, 1160, 137, 138, 139, 140, 929, 930, 931, 932, 611, 608, 614, 568, 297, 858, 859, 141, 997, 631, 142, 143, 144, 372, 373, 107, 332, 333, 145, 146, 147, 148, 149, 433, 434, 289, 150, 408, 409, 260, 473, 474, 410, 475, 476, 477, 411, 478, 412, 413, 414, 415, 605, 416, 417, 729, 447, 169, 586, 880, 1226, 1092, 1183, 888, 889, 1445, 599, 600, 601, 1375, 1073, 170, 623, 189, 190, 191, 192, 193, 194, 327, 171, 172, 448, 173, 151, 152, 153, 154, 242, 243, 244, 245, 246, 782, 375 }; /* 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[] = { 603, 553, 554, 437, 587, 566, 590, 591, 619, 309, 707, 592, 593, 418, 419, 597, 421, 560, 634, 552, 607, 610, 558, 613, 507, 508, 303, 509, 796, 797, 479, 1181, 989, 1251, 569, 566, 566, 523, 566, 547, 461, 524, 525, 460, 526, 527, 104, 528, 529, 99, 100, 924, 707, 628, 898, 707, 632, 104, 707, 779, 780, 422, 636, 637, 638, 658, 641, 643, 962, 737, -707, 649, 650, 651, 1371, 1164, 655, 656, 295, 60, 1136, 462, 463, 464, 465, 659, 393, 852, 853, 660, 41, 925, 42, 624, 43, 44, 569, 523, 562, 45, 46, 524, 525, 82, 526, 527, 1252, 528, 529, 1253, 570, 47, 438, 480, 620, 621, 108, 618, 639, 109, 61, 83, 80, 195, 212, 926, 882, 883, 274, 328, 329, 330, 331, 48, 49, 664, 510, 511, 1254, 598, 884, 50, 598, 51, 1255, 1175, 940, 885, 378, 379, 486, 487, 52, 703, 882, 883, 738, 606, 117, 452, 481, 1372, 704, 1094, 449, 942, 995, 53, 884, 54, 1013, 1165, 1166, 452, 96, 885, 393, 598, 563, 393, 564, 118, 530, 450, 62, 705, 733, 734, 735, 423, 1116, 1117, 1118, 1119, 706, 711, 937, 725, 726, 1167, 609, 105, 890, 560, 712, 1120, 1001, 598, 644, 645, 646, 647, 435, 563, 741, 564, 752, 753, 754, 303, 574, 962, 962, 962, 83, 989, 1256, 571, 572, 573, 533, 772, 534, 535, 536, 537, 538, 539, 540, 541, 783, 106, 530, 848, 849, 81, 789, 63, 393, 773, 466, 776, 436, 795, 951, 392, 479, 428, 990, 551, 64, 787, 788, 560, 547, 1122, 65, 1002, 1003, 850, 55, 835, 563, 851, 564, 927, 546, 612, 66, 303, 852, 853, 574, 67, 56, 485, 798, 110, 512, 571, 57, 573, 97, 98, 531, 393, 575, 571, 748, 573, 727, 886, 887, 837, 838, 839, 840, 841, 842, 393, 87, 1410, 728, 860, 1177, 563, 1178, 564, 439, 440, 441, 442, 443, 622, 68, 453, 454, 1411, 455, 886, 887, 622, 598, 1222, 1067, 1068, 1069, 323, 324, 325, 326, 1291, 897, 899, 1292, 1227, 444, 903, 445, 905, 906, 823, 908, 909, 809, 58, 323, 324, 325, 326, 407, 626, 1080, 1081, 1082, 69, 919, 446, 88, 456, 933, 934, 935, 620, 621, 429, 430, 626, 1097, 439, 440, 441, 442, 459, 996, 89, 953, 1181, 1014, 457, 458, 393, 563, 560, 564, 405, 323, 324, 325, 326, 1114, 155, 90, 766, 810, 982, 811, 407, 1124, 405, 1223, 1224, 1225, 394, 395, 728, 1127, 713, 91, 700, 768, 407, 1223, 1224, 1225, 396, 714, 397, 398, 399, 400, 401, 728, 1157, 303, 998, 999, 1000, 812, 1016, 485, 402, 403, 770, 92, 1130, 1131, 1132, 1133, 1134, 1135, 990, 774, 542, 862, 728, 323, 324, 325, 326, 486, 487, 386, 387, 728, 404, 728, 1076, 93, 120, 121, 94, 1070, 488, 489, 490, 491, 492, 493, 494, 495, 496, 95, 53, 122, 864, 1228, 1230, 1232, 917, 123, 405, 124, 125, 406, 549, 1084, 728, 1229, 1087, 562, 728, 1090, 407, 1093, 101, 1095, 1096, 715, 1098, 111, 665, 1101, 666, 1104, 1105, 866, 716, 963, 328, 329, 330, 331, 1174, 1176, 112, 993, 964, 211, 1113, 1006, 1115, 273, 113, 563, 114, 564, 606, 290, 1186, 609, 1188, 1231, 386, 387, 1190, 965, 1192, 1193, 1, 1195, 1196, 1257, 1257, 334, 966, 119, 1074, 1137, 834, 380, 381, 1205, 439, 440, 441, 442, 1157, 612, 1277, 1277, 1280, 1212, 1213, 1214, 1223, 1224, 1225, 1288, 115, 386, 387, 126, 386, 387, 116, 127, 1334, 1234, 291, 624, 625, 1336, 293, 1338, 128, 1340, 129, 386, 387, 1244, 1245, 1246, 335, 1247, 323, 324, 325, 326, 896, 338, 386, 387, 340, 1366, 563, 1367, 564, 1125, 1223, 1224, 1225, 521, 522, 120, 121, 868, 707, 488, 489, 490, 491, 492, 493, 494, 495, 496, 922, 53, 122, 341, 156, 1300, 588, 589, 123, 1185, 124, 125, 425, 426, 427, 563, 1309, 564, 563, 1310, 564, 376, 1311, 374, 1313, 377, 1315, 1316, 1317, 698, 382, 1320, 383, 1187, 1323, 1324, 1182, 161, 181, 203, 1328, 384, 1329, 265, 594, 595, 563, 1198, 564, 1200, 390, 566, 629, 630, 1204, 867, 869, 1207, 1208, 385, 2, 3, 4, 5, 6, 7, 8, 9, 10, 652, 653, 1218, 1219, 1220, 1221, 1158, 391, 947, 323, 324, 325, 326, 904, 420, 949, 323, 324, 325, 326, 323, 324, 325, 326, 911, 431, 913, 174, 196, 213, 1179, 126, 424, 275, 923, 127, 757, 758, 1102, 760, 761, 1189, 941, 943, 128, 432, 129, 948, 950, 1075, 1266, 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 991, 762, 763, 1378, 1004, 175, 197, 214, 1382, 482, 1384, 276, 484, 1071, 1388, 1216, 483, 1390, 1391, 764, 765, 968, 969, 970, 971, 1233, 1396, 1397, 1398, 1399, 504, 1235, 1236, 1237, 1238, 1239, 1240, 323, 324, 325, 326, 505, 1248, 1249, 323, 324, 325, 326, 513, 1146, 817, 818, 1335, 514, 1337, 517, 1339, 515, 1341, 516, 1064, 518, 1066, 844, 845, 1258, 1258, 323, 324, 325, 326, 439, 440, 441, 442, 1299, 328, 329, 330, 331, 1158, 519, 1278, 1278, 1281, 819, 820, 1306, 544, 1308, 520, 1289, 1019, 1020, 1021, 545, 1351, 1437, 624, 1439, 556, 1441, 548, 1443, 561, 342, 1319, 343, 344, 345, 346, 347, 348, 1325, 1326, 1327, 972, 973, 1103, 578, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 974, 975, 1448, 596, 1450, 1342, 1452, 598, 1454, 976, 977, 1121, 1123, 978, 979, 1344, 1345, 1346, 1347, 349, 1349, 1350, 393, 980, 981, 350, 486, 487, 351, 615, 1400, 633, 1402, 604, 1404, 617, 1406, 1303, 1304, 1305, 848, 849, 875, 876, 877, 878, 879, 648, 342, 635, 343, 344, 345, 346, 347, 348, 486, 487, 467, 654, 399, 400, 401, 468, 1352, 1353, 850, 1223, 1224, 1225, 851, 1370, 469, 579, 470, 471, 472, 852, 853, 661, 1379, 1380, 1381, 662, 1383, 664, 1385, 1386, 1387, 955, 956, 1389, 349, 667, 1392, 1393, 1376, 1377, 350, 1394, 1395, 351, 1446, 1447, 352, 958, 959, 960, 668, 298, 669, 299, 353, 342, 670, 343, 344, 345, 346, 347, 348, 300, 301, 302, 303, 406, 304, 305, 671, 598, 1444, 1444, 1444, 580, 581, 582, 583, 584, 585, 672, 354, 696, 355, 673, 356, -327, 674, 357, 676, 1426, 1373, 1373, 1373, 1427, 679, 1428, 680, 349, 681, 1429, 682, 1430, 1431, 350, 697, 683, 351, 1432, 1433, 1434, 1435, 306, 579, 684, 358, 359, 104, 352, 685, 360, 361, 362, 686, 307, 308, 353, 363, 687, 364, 365, 366, 367, 688, 689, 640, 690, 368, 369, 370, 371, 691, 488, 489, 490, 491, 492, 493, 494, 1449, 496, 1451, 692, 1453, 354, 1455, 355, 693, 356, 559, 1456, 357, 1457, 694, 1458, 342, 1459, 343, 344, 345, 346, 347, 348, 580, 581, 582, 583, 584, 585, 1374, 1374, 1374, 695, 352, 701, 579, 702, 709, 358, 359, 710, 353, 717, 360, 361, 362, 718, 719, 739, 722, 363, 723, 364, 365, 366, 367, 724, 642, 736, 349, 368, 369, 370, 371, 740, 350, 176, 742, 351, 354, 744, 355, 746, 356, 750, 751, 357, 755, 756, 759, 781, 784, 699, 785, 786, 198, 792, 342, 794, 343, 344, 345, 346, 347, 348, 580, 581, 582, 583, 584, 585, -329, -331, 358, 359, -333, 803, 804, 360, 361, 362, 807, 814, 815, 833, 363, 836, 364, 365, 366, 367, 816, 821, 822, 861, 368, 369, 370, 371, 870, 872, 349, 824, 825, 120, 121, 826, 350, 827, 828, 351, 829, 830, 873, 352, 831, 832, 749, 53, 122, 598, 846, 353, 120, 121, 123, 871, 124, 125, 158, 178, 200, 217, 232, 249, 262, 279, 53, 122, 874, 881, 892, 598, 893, 123, 894, 124, 125, 900, 901, 354, 902, 355, 914, 356, 910, 467, 357, 399, 400, 401, 468, 912, 916, 394, 395, 920, 936, 938, 915, 469, 939, 470, 471, 472, 946, 396, 944, 397, 398, 399, 400, 401, 945, 358, 359, 352, 952, 954, 360, 361, 362, 402, 403, 353, 957, 363, 798, 364, 365, 366, 367, 967, 983, 984, 985, 368, 369, 370, 371, 986, 987, 988, 1017, 215, 1018, 1059, 126, 1060, 230, 1061, 127, 354, 1062, 355, 1072, 356, 1063, 895, 357, 128, 247, 129, 1065, 1077, 1078, 126, 1079, 1083, 1085, 127, 1086, 1088, 1089, 1091, 1100, 1099, 277, 1106, 128, 1110, 129, 1107, 1108, 1109, 1111, 358, 359, 1112, 1126, 1128, 360, 361, 362, 1129, 1138, 1139, 1140, 363, 1141, 364, 365, 366, 367, 1142, 1180, 1173, 1184, 368, 369, 370, 371, 120, 121, 1191, 1194, 1197, 120, 121, 1199, 1201, 1202, 1203, 1206, 1209, 1210, 53, 122, 1215, 120, 121, 53, 122, 123, 1211, 124, 125, 1217, 123, 1243, 124, 125, 1241, 53, 122, 120, 121, 730, 731, 732, 123, 1265, 124, 125, 1283, 1284, 1285, 1286, 1296, 53, 122, 1307, 1312, 1301, 1314, 1318, 123, 1321, 124, 125, 488, 489, 490, 491, 492, 493, 494, 495, 496, 159, 179, 201, 218, 233, 250, 263, 280, 1322, 1330, 1331, 1332, 1333, 767, 769, 771, 1343, 1356, 775, 1348, 777, 160, 180, 202, 219, 234, 251, 264, 281, 1401, 1354, 1369, 790, 791, 1357, 1358, 793, 162, 182, 204, 223, 235, 253, 266, 282, 1359, 126, 1403, 1360, 1361, 127, 126, 1362, 1405, 1407, 127, 1363, 1364, 1365, 128, 1368, 129, 1408, 126, 128, 1409, 129, 127, 163, 183, 205, 224, 236, 254, 267, 283, 128, 1412, 129, 126, 1422, 1423, 1424, 127, 164, 184, 206, 225, 237, 255, 268, 284, 128, 1413, 129, 1414, 1425, 1415, 1416, 1417, 1418, 1419, 863, 865, 165, 185, 207, 226, 238, 256, 269, 285, 1420, 1421, 1436, 1438, 1440, 1442, 891, 166, 186, 208, 227, 239, 257, 270, 286, 167, 187, 209, 228, 240, 258, 271, 287, 168, 188, 210, 229, 241, 259, 272, 288, 70, 555, 337, 1005, 663, 677, 296, 918, 961, 1009, 921, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 220, 221, 1011, 1287, 1162, 1012, 1145, 1276, 252, 708, 745, 1015, 59, 743, 557, 616, 602, 657, 907, 627, 747, 1302, 451 }; static const yytype_uint16 yycheck[] = { 408, 336, 336, 143, 395, 388, 397, 398, 437, 86, 565, 402, 403, 120, 121, 406, 123, 372, 450, 336, 418, 419, 341, 421, 21, 22, 29, 24, 22, 23, 247, 58, 35, 93, 74, 418, 419, 26, 421, 332, 6, 30, 31, 6, 33, 34, 87, 36, 37, 200, 201, 16, 607, 444, 54, 610, 447, 87, 613, 645, 646, 142, 453, 454, 455, 473, 457, 458, 805, 55, 5, 462, 463, 464, 55, 74, 467, 468, 90, 140, 38, 47, 48, 49, 50, 476, 142, 90, 91, 480, 8, 56, 10, 239, 12, 13, 74, 26, 90, 17, 18, 30, 31, 142, 33, 34, 166, 36, 37, 169, 88, 29, 6, 169, 22, 23, 70, 436, 264, 73, 140, 133, 11, 73, 74, 90, 71, 72, 78, 136, 137, 138, 139, 51, 52, 93, 133, 134, 198, 142, 85, 59, 142, 61, 204, 90, 41, 92, 133, 134, 210, 211, 70, 133, 71, 72, 142, 90, 16, 6, 216, 142, 142, 913, 242, 41, 843, 85, 85, 87, 847, 170, 171, 6, 71, 92, 142, 142, 205, 142, 207, 39, 171, 261, 140, 133, 594, 595, 596, 270, 940, 941, 942, 943, 142, 133, 782, 588, 589, 198, 90, 242, 740, 558, 142, 41, 16, 142, 248, 249, 250, 251, 242, 205, 605, 207, 624, 625, 626, 29, 260, 958, 959, 960, 133, 35, 286, 205, 206, 207, 60, 639, 62, 63, 64, 65, 66, 67, 68, 69, 648, 282, 171, 53, 54, 134, 654, 140, 142, 640, 216, 642, 282, 661, 792, 6, 473, 71, 261, 336, 140, 652, 653, 618, 557, 41, 140, 77, 78, 79, 188, 700, 205, 83, 207, 240, 283, 90, 140, 29, 90, 91, 260, 140, 202, 35, 280, 241, 285, 205, 208, 207, 189, 190, 283, 142, 274, 205, 617, 207, 142, 246, 247, 711, 712, 713, 714, 715, 716, 142, 19, 271, 154, 721, 1064, 205, 1066, 207, 212, 213, 214, 215, 216, 239, 140, 172, 173, 287, 175, 246, 247, 239, 142, 142, 872, 873, 874, 232, 233, 234, 235, 269, 750, 751, 272, 142, 240, 755, 242, 757, 758, 686, 760, 761, 283, 273, 232, 233, 234, 235, 254, 443, 900, 901, 902, 0, 774, 261, 282, 216, 778, 779, 780, 22, 23, 189, 190, 459, 916, 212, 213, 214, 215, 216, 843, 134, 794, 58, 847, 236, 237, 142, 205, 748, 207, 242, 232, 233, 234, 235, 938, 3, 134, 142, 205, 834, 207, 254, 946, 242, 219, 220, 221, 164, 165, 154, 954, 133, 282, 559, 142, 254, 219, 220, 221, 176, 142, 178, 179, 180, 181, 182, 154, 1025, 29, 843, 844, 845, 239, 847, 35, 192, 193, 142, 142, 983, 984, 985, 986, 987, 988, 261, 142, 283, 142, 154, 232, 233, 234, 235, 210, 211, 133, 134, 154, 216, 154, 896, 134, 71, 72, 135, 880, 223, 224, 225, 226, 227, 228, 229, 230, 231, 282, 85, 86, 142, 1121, 1122, 1123, 142, 92, 242, 94, 95, 245, 90, 904, 154, 142, 907, 90, 154, 910, 254, 912, 267, 914, 915, 133, 917, 73, 133, 920, 135, 922, 923, 143, 142, 133, 136, 137, 138, 139, 1061, 1062, 73, 843, 142, 74, 937, 847, 939, 78, 73, 205, 16, 207, 90, 9, 1077, 90, 1079, 142, 133, 134, 1083, 133, 1085, 1086, 7, 1088, 1089, 1144, 1145, 134, 142, 3, 890, 990, 699, 133, 134, 1100, 212, 213, 214, 215, 1159, 90, 1161, 1162, 1163, 1110, 1111, 1112, 219, 220, 221, 1170, 73, 133, 134, 184, 133, 134, 73, 188, 1222, 1126, 71, 239, 240, 1227, 76, 1229, 197, 1231, 199, 133, 134, 1138, 1139, 1140, 142, 1142, 232, 233, 234, 235, 749, 265, 133, 134, 282, 133, 205, 135, 207, 951, 219, 220, 221, 27, 28, 71, 72, 143, 1182, 223, 224, 225, 226, 227, 228, 229, 230, 231, 143, 85, 86, 282, 243, 1180, 172, 173, 92, 1075, 94, 95, 185, 186, 187, 205, 1191, 207, 205, 1194, 207, 134, 1197, 57, 1199, 134, 1201, 1202, 1203, 283, 134, 1206, 134, 1078, 1209, 1210, 1071, 72, 73, 74, 1215, 133, 1217, 78, 262, 263, 205, 1092, 207, 1094, 133, 1071, 280, 281, 1099, 729, 730, 1102, 1103, 134, 155, 156, 157, 158, 159, 160, 161, 162, 163, 48, 49, 1116, 1117, 1118, 1119, 1025, 133, 143, 232, 233, 234, 235, 756, 135, 143, 232, 233, 234, 235, 232, 233, 234, 235, 767, 141, 769, 72, 73, 74, 1069, 184, 270, 78, 777, 188, 133, 134, 143, 133, 134, 1080, 785, 786, 197, 140, 199, 790, 791, 895, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1156, 843, 133, 134, 1307, 847, 72, 73, 74, 1312, 133, 1314, 78, 142, 886, 1318, 1114, 25, 1321, 1322, 133, 134, 824, 825, 826, 827, 1124, 1330, 1331, 1332, 1333, 142, 1130, 1131, 1132, 1133, 1134, 1135, 232, 233, 234, 235, 75, 1143, 1143, 232, 233, 234, 235, 133, 73, 14, 15, 1226, 134, 1228, 282, 1230, 89, 1232, 89, 863, 134, 865, 133, 134, 1144, 1145, 232, 233, 234, 235, 212, 213, 214, 215, 1174, 136, 137, 138, 139, 1159, 142, 1161, 1162, 1163, 27, 28, 1186, 268, 1188, 134, 1170, 80, 81, 82, 268, 1253, 1401, 239, 1403, 266, 1405, 201, 1407, 142, 40, 1205, 42, 43, 44, 45, 46, 47, 1212, 1213, 1214, 217, 218, 921, 92, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 217, 218, 1436, 254, 1438, 1234, 1440, 142, 1442, 217, 218, 944, 945, 217, 218, 1244, 1245, 1246, 1247, 84, 167, 168, 142, 217, 218, 90, 210, 211, 93, 55, 1334, 241, 1336, 191, 1338, 282, 1340, 257, 258, 259, 53, 54, 218, 219, 220, 221, 222, 40, 40, 241, 42, 43, 44, 45, 46, 47, 210, 211, 178, 40, 180, 181, 182, 183, 133, 134, 79, 219, 220, 221, 83, 1300, 192, 216, 194, 195, 196, 90, 91, 169, 1309, 1310, 1311, 142, 1313, 93, 1315, 1316, 1317, 796, 797, 1320, 84, 133, 1323, 1324, 1304, 1305, 90, 1328, 1329, 93, 1424, 1425, 169, 800, 801, 802, 133, 14, 218, 16, 177, 40, 133, 42, 43, 44, 45, 46, 47, 26, 27, 28, 29, 245, 31, 32, 134, 142, 1423, 1424, 1425, 276, 277, 278, 279, 280, 281, 134, 205, 142, 207, 134, 209, 133, 284, 212, 133, 1378, 1303, 1304, 1305, 1382, 284, 1384, 284, 84, 284, 1388, 284, 1390, 1391, 90, 142, 284, 93, 1396, 1397, 1398, 1399, 76, 216, 284, 239, 240, 87, 169, 284, 244, 245, 246, 284, 88, 89, 177, 251, 284, 253, 254, 255, 256, 284, 284, 238, 284, 261, 262, 263, 264, 284, 223, 224, 225, 226, 227, 228, 229, 1437, 231, 1439, 284, 1441, 205, 1443, 207, 284, 209, 283, 1448, 212, 1450, 284, 1452, 40, 1454, 42, 43, 44, 45, 46, 47, 276, 277, 278, 279, 280, 281, 1303, 1304, 1305, 284, 169, 55, 216, 142, 133, 239, 240, 134, 177, 267, 244, 245, 246, 275, 76, 5, 142, 251, 142, 253, 254, 255, 256, 142, 238, 142, 84, 261, 262, 263, 264, 5, 90, 3, 142, 93, 205, 142, 207, 142, 209, 142, 93, 212, 93, 142, 142, 79, 142, 283, 142, 142, 3, 5, 40, 142, 42, 43, 44, 45, 46, 47, 276, 277, 278, 279, 280, 281, 133, 133, 239, 240, 133, 133, 133, 244, 245, 246, 20, 134, 133, 218, 251, 218, 253, 254, 255, 256, 134, 134, 134, 55, 261, 262, 263, 264, 143, 5, 84, 142, 142, 71, 72, 142, 90, 142, 142, 93, 142, 142, 5, 169, 142, 142, 283, 85, 86, 142, 142, 177, 71, 72, 92, 143, 94, 95, 72, 73, 74, 75, 76, 77, 78, 79, 85, 86, 5, 55, 218, 142, 218, 92, 218, 94, 95, 5, 5, 205, 5, 207, 217, 209, 174, 178, 212, 180, 181, 182, 183, 174, 5, 164, 165, 143, 252, 5, 218, 192, 143, 194, 195, 196, 5, 176, 142, 178, 179, 180, 181, 182, 142, 239, 240, 169, 143, 5, 244, 245, 246, 192, 193, 177, 133, 251, 280, 253, 254, 255, 256, 142, 5, 5, 5, 261, 262, 263, 264, 5, 5, 5, 133, 3, 133, 142, 184, 142, 3, 5, 188, 205, 5, 207, 4, 209, 174, 283, 212, 197, 3, 199, 174, 5, 133, 184, 5, 5, 5, 188, 5, 5, 5, 218, 5, 143, 3, 133, 197, 5, 199, 142, 142, 142, 5, 239, 240, 5, 5, 133, 244, 245, 246, 133, 5, 5, 5, 251, 133, 253, 254, 255, 256, 5, 5, 218, 3, 261, 262, 263, 264, 71, 72, 5, 5, 5, 71, 72, 5, 5, 5, 5, 5, 5, 5, 85, 86, 5, 71, 72, 85, 86, 92, 218, 94, 95, 5, 92, 133, 94, 95, 276, 85, 86, 71, 72, 591, 592, 593, 92, 134, 94, 95, 133, 133, 142, 134, 203, 85, 86, 5, 5, 94, 5, 5, 92, 5, 94, 95, 223, 224, 225, 226, 227, 228, 229, 230, 231, 72, 73, 74, 75, 76, 77, 78, 79, 5, 5, 5, 5, 5, 636, 637, 638, 142, 142, 641, 133, 643, 72, 73, 74, 75, 76, 77, 78, 79, 5, 133, 133, 655, 656, 142, 142, 659, 72, 73, 74, 75, 76, 77, 78, 79, 142, 184, 5, 142, 142, 188, 184, 142, 5, 5, 188, 142, 142, 142, 197, 142, 199, 221, 184, 197, 142, 199, 188, 72, 73, 74, 75, 76, 77, 78, 79, 197, 143, 199, 184, 55, 5, 5, 188, 72, 73, 74, 75, 76, 77, 78, 79, 197, 143, 199, 143, 5, 143, 143, 143, 143, 143, 725, 726, 72, 73, 74, 75, 76, 77, 78, 79, 143, 143, 5, 5, 5, 5, 741, 72, 73, 74, 75, 76, 77, 78, 79, 72, 73, 74, 75, 76, 77, 78, 79, 72, 73, 74, 75, 76, 77, 78, 79, 12, 337, 102, 847, 484, 517, 84, 773, 803, 847, 776, 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, 75, 75, 847, 1168, 1028, 847, 1024, 1159, 77, 565, 610, 847, 1, 607, 340, 433, 408, 473, 759, 443, 613, 1182, 156 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { 0, 7, 155, 156, 157, 158, 159, 160, 161, 162, 163, 289, 290, 291, 310, 311, 312, 314, 315, 316, 317, 320, 321, 322, 323, 324, 325, 326, 332, 342, 343, 348, 370, 371, 372, 373, 374, 375, 376, 377, 378, 8, 10, 12, 13, 17, 18, 29, 51, 52, 59, 61, 70, 85, 87, 188, 202, 208, 273, 455, 140, 140, 140, 140, 140, 140, 140, 140, 140, 0, 291, 292, 294, 296, 298, 300, 302, 304, 306, 308, 11, 134, 142, 133, 344, 345, 349, 19, 282, 134, 134, 282, 142, 134, 135, 282, 71, 189, 190, 200, 201, 267, 327, 328, 87, 242, 282, 459, 70, 73, 241, 73, 73, 73, 16, 73, 73, 16, 39, 3, 71, 72, 86, 92, 94, 95, 184, 188, 197, 199, 293, 379, 380, 381, 389, 392, 395, 436, 437, 438, 439, 451, 454, 455, 456, 462, 463, 464, 465, 466, 470, 518, 519, 520, 521, 3, 243, 295, 379, 380, 381, 436, 451, 454, 462, 463, 464, 465, 466, 491, 505, 514, 515, 517, 518, 521, 3, 297, 379, 380, 381, 436, 451, 454, 462, 463, 464, 465, 466, 507, 508, 509, 510, 511, 512, 514, 518, 521, 3, 299, 379, 380, 381, 436, 451, 454, 462, 463, 464, 465, 466, 491, 514, 518, 521, 3, 301, 379, 380, 381, 389, 392, 398, 451, 454, 462, 463, 464, 465, 466, 3, 303, 379, 380, 381, 451, 454, 462, 463, 464, 465, 466, 522, 523, 524, 525, 526, 3, 305, 379, 380, 381, 439, 451, 454, 462, 463, 464, 465, 466, 473, 307, 379, 380, 381, 436, 451, 454, 462, 463, 464, 465, 466, 491, 514, 518, 521, 3, 309, 379, 380, 381, 451, 454, 462, 463, 464, 465, 466, 469, 9, 71, 313, 76, 346, 90, 345, 448, 14, 16, 26, 27, 28, 29, 31, 32, 76, 88, 89, 333, 350, 351, 352, 353, 354, 355, 358, 359, 360, 361, 362, 334, 318, 232, 233, 234, 235, 513, 136, 137, 138, 139, 460, 461, 134, 142, 329, 328, 265, 331, 282, 282, 40, 42, 43, 44, 45, 46, 47, 84, 90, 93, 169, 177, 205, 207, 209, 212, 239, 240, 244, 245, 246, 251, 253, 254, 255, 256, 261, 262, 263, 264, 457, 458, 57, 528, 134, 134, 133, 134, 133, 134, 134, 134, 133, 134, 133, 134, 382, 384, 133, 133, 6, 142, 164, 165, 176, 178, 179, 180, 181, 182, 192, 193, 216, 242, 245, 254, 471, 472, 476, 480, 482, 483, 484, 485, 487, 488, 382, 382, 135, 382, 142, 270, 270, 185, 186, 187, 71, 189, 190, 141, 140, 467, 468, 242, 282, 459, 6, 212, 213, 214, 215, 216, 240, 242, 261, 490, 516, 242, 261, 516, 6, 172, 173, 175, 216, 236, 237, 216, 6, 6, 47, 48, 49, 50, 216, 178, 183, 192, 194, 195, 196, 474, 475, 477, 478, 479, 481, 484, 169, 216, 133, 25, 142, 35, 210, 211, 223, 224, 225, 226, 227, 228, 229, 230, 231, 333, 338, 340, 341, 347, 386, 387, 142, 75, 388, 21, 22, 24, 133, 134, 285, 133, 134, 89, 89, 282, 134, 142, 134, 27, 28, 26, 30, 31, 33, 34, 36, 37, 171, 283, 335, 60, 62, 63, 64, 65, 66, 67, 68, 69, 283, 319, 268, 268, 283, 461, 201, 90, 330, 333, 338, 340, 341, 331, 266, 460, 457, 283, 458, 142, 90, 205, 207, 383, 384, 385, 447, 74, 88, 205, 206, 207, 260, 274, 401, 403, 92, 216, 276, 277, 278, 279, 280, 281, 492, 492, 172, 173, 492, 492, 492, 492, 262, 263, 254, 492, 142, 500, 501, 502, 472, 502, 191, 486, 90, 383, 445, 90, 383, 444, 90, 383, 446, 55, 468, 282, 457, 528, 22, 23, 239, 506, 239, 240, 490, 506, 492, 280, 281, 453, 492, 241, 453, 241, 492, 492, 492, 264, 238, 492, 238, 492, 248, 249, 250, 251, 40, 492, 492, 492, 48, 49, 40, 492, 492, 475, 502, 492, 492, 169, 142, 346, 93, 133, 135, 133, 133, 218, 133, 134, 134, 134, 284, 363, 133, 334, 356, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, 142, 142, 283, 283, 459, 55, 142, 133, 142, 133, 142, 385, 447, 133, 134, 133, 142, 133, 142, 133, 142, 267, 275, 76, 402, 396, 142, 142, 142, 492, 492, 142, 154, 489, 489, 489, 489, 502, 502, 502, 142, 55, 142, 5, 5, 492, 142, 445, 142, 444, 142, 446, 457, 283, 142, 93, 502, 502, 502, 93, 142, 133, 134, 142, 133, 134, 133, 134, 133, 134, 142, 489, 142, 489, 142, 489, 502, 492, 142, 489, 492, 489, 399, 399, 399, 79, 527, 502, 142, 142, 142, 492, 492, 502, 489, 489, 5, 489, 142, 502, 22, 23, 280, 339, 364, 365, 366, 133, 133, 367, 368, 20, 369, 283, 205, 207, 239, 357, 134, 133, 134, 14, 15, 27, 28, 134, 134, 340, 142, 142, 142, 142, 142, 142, 142, 142, 142, 218, 459, 528, 218, 502, 502, 502, 502, 502, 502, 393, 133, 134, 142, 390, 53, 54, 79, 83, 90, 91, 397, 405, 409, 410, 449, 450, 502, 55, 142, 489, 142, 489, 143, 513, 143, 513, 143, 143, 5, 5, 5, 218, 219, 220, 221, 222, 493, 55, 71, 72, 85, 92, 246, 247, 497, 498, 498, 489, 218, 218, 218, 283, 459, 502, 54, 502, 5, 5, 5, 502, 513, 502, 502, 493, 502, 502, 174, 513, 174, 513, 217, 218, 5, 142, 489, 502, 143, 489, 143, 513, 16, 56, 90, 240, 400, 440, 441, 442, 443, 502, 502, 502, 252, 399, 5, 143, 41, 513, 41, 513, 142, 142, 5, 143, 513, 143, 513, 498, 143, 502, 5, 339, 339, 133, 367, 367, 367, 369, 368, 133, 142, 133, 142, 142, 513, 513, 513, 513, 217, 218, 217, 218, 217, 218, 217, 218, 217, 218, 528, 5, 5, 5, 5, 5, 5, 35, 261, 333, 336, 338, 394, 449, 450, 452, 502, 502, 502, 16, 77, 78, 333, 336, 338, 391, 404, 405, 408, 409, 410, 449, 450, 452, 502, 133, 133, 80, 81, 82, 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, 142, 142, 5, 5, 174, 513, 174, 513, 498, 498, 498, 502, 382, 4, 504, 504, 459, 528, 5, 133, 5, 498, 498, 498, 5, 502, 5, 5, 502, 5, 5, 502, 218, 495, 502, 495, 502, 502, 498, 502, 143, 5, 502, 143, 513, 502, 502, 133, 142, 142, 142, 5, 5, 5, 502, 498, 502, 495, 495, 495, 495, 41, 513, 41, 513, 498, 504, 5, 498, 133, 133, 498, 498, 498, 498, 498, 498, 38, 453, 5, 5, 5, 133, 5, 406, 423, 423, 73, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 386, 387, 434, 435, 413, 413, 417, 74, 170, 171, 198, 411, 412, 415, 421, 432, 218, 498, 90, 498, 495, 495, 504, 5, 58, 383, 496, 3, 528, 498, 502, 498, 504, 498, 5, 498, 498, 5, 498, 498, 5, 502, 5, 502, 5, 5, 5, 502, 498, 5, 502, 502, 5, 5, 218, 498, 498, 498, 5, 504, 5, 502, 502, 502, 502, 142, 219, 220, 221, 494, 142, 494, 142, 494, 142, 494, 504, 498, 504, 504, 504, 504, 504, 504, 276, 337, 133, 498, 498, 498, 498, 340, 341, 407, 93, 166, 169, 198, 204, 286, 386, 387, 424, 425, 426, 427, 428, 429, 134, 492, 492, 492, 492, 492, 492, 492, 492, 492, 492, 435, 386, 387, 414, 386, 387, 418, 133, 133, 142, 134, 412, 386, 387, 416, 269, 272, 419, 420, 422, 203, 431, 433, 504, 498, 94, 496, 257, 258, 259, 504, 5, 504, 498, 498, 498, 5, 498, 5, 498, 498, 498, 5, 504, 498, 5, 5, 498, 498, 504, 504, 504, 498, 498, 5, 5, 5, 5, 494, 502, 494, 502, 494, 502, 494, 502, 504, 142, 504, 504, 504, 504, 133, 167, 168, 492, 133, 134, 133, 430, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 133, 135, 142, 133, 504, 55, 142, 500, 501, 503, 503, 503, 498, 504, 504, 504, 498, 504, 498, 504, 504, 504, 498, 504, 498, 498, 504, 504, 504, 504, 498, 498, 498, 498, 502, 5, 502, 5, 502, 5, 502, 5, 221, 142, 271, 287, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 55, 5, 5, 5, 504, 504, 504, 504, 504, 504, 504, 504, 504, 504, 5, 498, 5, 498, 5, 498, 5, 498, 497, 499, 499, 499, 498, 504, 498, 504, 498, 504, 498, 504, 504, 504, 504, 504 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { 0, 288, 289, 289, 290, 290, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 292, 292, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 294, 294, 295, 295, 295, 295, 295, 295, 295, 295, 295, 295, 295, 295, 295, 295, 295, 295, 295, 295, 296, 296, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 297, 298, 298, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 300, 300, 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, 302, 302, 303, 303, 303, 303, 303, 303, 303, 303, 303, 303, 303, 303, 303, 303, 303, 304, 304, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 306, 306, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 308, 308, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 310, 310, 310, 311, 312, 313, 313, 314, 315, 315, 315, 316, 317, 318, 318, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 320, 321, 321, 321, 322, 322, 322, 323, 324, 325, 326, 327, 327, 328, 329, 329, 330, 330, 330, 330, 330, 331, 331, 332, 333, 333, 334, 334, 335, 335, 335, 335, 335, 335, 335, 335, 335, 335, 336, 337, 337, 338, 338, 338, 339, 339, 340, 340, 340, 340, 340, 340, 340, 340, 341, 342, 343, 344, 344, 345, 345, 346, 346, 347, 347, 347, 347, 347, 347, 348, 349, 349, 350, 350, 350, 350, 350, 350, 350, 350, 350, 351, 352, 353, 354, 355, 356, 356, 357, 357, 357, 357, 357, 358, 358, 359, 359, 360, 360, 361, 362, 362, 362, 362, 362, 362, 363, 362, 364, 362, 365, 362, 366, 362, 362, 367, 367, 368, 369, 369, 370, 370, 370, 370, 371, 372, 372, 373, 374, 375, 375, 376, 377, 378, 378, 379, 379, 380, 380, 381, 381, 382, 382, 383, 383, 384, 384, 385, 385, 385, 385, 386, 386, 387, 388, 388, 389, 390, 390, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 392, 393, 393, 394, 394, 394, 394, 394, 394, 395, 396, 396, 397, 397, 397, 397, 397, 398, 398, 398, 398, 399, 399, 400, 400, 400, 400, 401, 401, 402, 403, 404, 404, 405, 405, 405, 406, 406, 407, 407, 408, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 409, 410, 410, 411, 411, 412, 412, 412, 412, 413, 413, 414, 414, 415, 415, 416, 416, 417, 417, 418, 418, 419, 419, 420, 421, 421, 422, 422, 423, 423, 424, 424, 424, 424, 424, 424, 424, 424, 425, 426, 426, 427, 427, 428, 429, 430, 430, 431, 432, 432, 433, 434, 434, 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, 435, 436, 436, 437, 438, 439, 440, 441, 442, 443, 444, 444, 445, 445, 446, 446, 447, 447, 448, 448, 449, 450, 451, 451, 452, 453, 453, 454, 454, 454, 454, 455, 456, 457, 457, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 458, 459, 459, 460, 460, 461, 461, 461, 461, 462, 462, 462, 463, 463, 463, 464, 464, 464, 465, 466, 467, 467, 468, 469, 469, 470, 471, 471, 472, 472, 472, 472, 472, 472, 472, 473, 474, 474, 475, 475, 475, 475, 476, 476, 477, 478, 478, 478, 478, 479, 479, 480, 480, 480, 480, 481, 481, 482, 483, 484, 485, 485, 485, 486, 486, 487, 487, 488, 488, 489, 489, 490, 490, 490, 490, 491, 491, 492, 492, 492, 492, 492, 492, 492, 492, 493, 493, 493, 493, 493, 493, 494, 494, 494, 495, 495, 496, 496, 496, 497, 497, 497, 497, 497, 497, 497, 498, 499, 500, 501, 502, 502, 502, 503, 503, 503, 504, 504, 504, 504, 505, 505, 505, 506, 506, 506, 507, 507, 507, 507, 508, 508, 508, 508, 509, 509, 510, 510, 511, 511, 512, 513, 513, 513, 513, 513, 514, 514, 515, 515, 515, 515, 515, 515, 515, 515, 516, 516, 517, 517, 518, 518, 519, 519, 520, 520, 521, 521, 522, 523, 524, 525, 525, 525, 525, 525, 525, 526, 526, 526, 526, 526, 526, 527, 528, 528, 528 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 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, 0, 2, 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, 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, 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, 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, 2, 3, 3, 5, 4, 6, 4, 3, 3, 3, 3, 2, 3, 2, 0, 2, 3, 1, 1, 1, 1, 0, 2, 5, 1, 4, 0, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 0, 1, 4, 5, 5, 0, 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, 2, 3, 0, 2, 2, 2, 2, 2, 2, 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, 0, 2, 9, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 0, 2, 1, 1, 1, 1, 1, 1, 8, 0, 2, 1, 1, 1, 1, 1, 9, 8, 8, 8, 0, 2, 1, 1, 1, 1, 0, 2, 2, 2, 1, 1, 2, 3, 2, 0, 2, 1, 1, 2, 3, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 3, 2, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, 1, 2, 2, 2, 2, 2, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 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, 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, 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, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 4, 1, 1, 1, 0, 1, 6, 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, 4, 1, 3, 4, 1, 1, 1, 1, 1, 1, 2, 3, 0, 1, 1, 0, 1, 1, 0, 6, 6, 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, 4, 4, 7, 7, 4, 4, 0, 1, 9, 6, 8, 8, 8, 8, 9, 9, 8, 8, 7, 7, 9, 10, 11, 12, 10, 11, 12, 10, 11, 12, 10, 11, 12, 2, 0, 2, 3 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab #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) /* Error token number */ #define YYTERROR 1 #define YYERRCODE 256 /* 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) /* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*----------------------------------------. | Print this symbol's value on YYOUTPUT. | `----------------------------------------*/ static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) { FILE *yyo = yyoutput; YYUSE (yyo); if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # endif YYUSE (yytype); } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) { YYFPRINTF (yyoutput, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *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 (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) { unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yystos[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) # define YY_SYMBOL_PRINT(Title, Type, 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 #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ static YYSIZE_T yystrlen (const char *yystr) { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * yystpcpy (char *yydest, const char *yysrc) { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytname[yyx]; { YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } { YYSIZE_T yysize1 = yysize + yystrlen (yyformat); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YYUSE (yytype); YY_IGNORE_MAYBE_UNINITIALIZED_END } /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ int yyparse (void) { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: 'yyss': related to states. 'yyvs': related to semantic values. Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #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; yyssp = yyss = yyssa; yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; 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: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef 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. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* 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 * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 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 YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = yylex (); } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } 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); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; YY_IGNORE_MAYBE_UNINITIALIZED_END 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 192: #line 593 "src/p.y" /* yacc.c:1646 */ { mailset.events = Event_All; addmail((yyvsp[-2].string), &mailset, &Run.maillist); } #line 3249 "src/y.tab.c" /* yacc.c:1646 */ break; case 193: #line 597 "src/p.y" /* yacc.c:1646 */ { addmail((yyvsp[-5].string), &mailset, &Run.maillist); } #line 3257 "src/y.tab.c" /* yacc.c:1646 */ break; case 194: #line 600 "src/p.y" /* yacc.c:1646 */ { mailset.events = ~mailset.events; addmail((yyvsp[-6].string), &mailset, &Run.maillist); } #line 3266 "src/y.tab.c" /* yacc.c:1646 */ break; case 195: #line 606 "src/p.y" /* yacc.c:1646 */ { if (! (Run.flags & Run_Daemon) || ihp.daemon) { ihp.daemon = true; Run.flags |= Run_Daemon; Run.polltime = (yyvsp[-1].number); Run.startdelay = (yyvsp[0].number); } } #line 3279 "src/y.tab.c" /* yacc.c:1646 */ break; case 196: #line 616 "src/p.y" /* yacc.c:1646 */ { Run.flags |= Run_Batch; } #line 3287 "src/y.tab.c" /* yacc.c:1646 */ break; case 197: #line 621 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = 0; } #line 3295 "src/y.tab.c" /* yacc.c:1646 */ break; case 198: #line 624 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = (yyvsp[0].number); } #line 3303 "src/y.tab.c" /* yacc.c:1646 */ break; case 199: #line 629 "src/p.y" /* yacc.c:1646 */ { Run.flags |= Run_Foreground; } #line 3311 "src/y.tab.c" /* yacc.c:1646 */ break; case 200: #line 634 "src/p.y" /* yacc.c:1646 */ { Run.onreboot = Onreboot_Start; } #line 3319 "src/y.tab.c" /* yacc.c:1646 */ break; case 201: #line 637 "src/p.y" /* yacc.c:1646 */ { Run.onreboot = Onreboot_Nostart; } #line 3327 "src/y.tab.c" /* yacc.c:1646 */ break; case 202: #line 640 "src/p.y" /* yacc.c:1646 */ { Run.onreboot = Onreboot_Laststate; } #line 3335 "src/y.tab.c" /* yacc.c:1646 */ break; case 203: #line 645 "src/p.y" /* yacc.c:1646 */ { // Note: deprecated (replaced by "set limits" statement's "sendExpectBuffer" option) Run.limits.sendExpectBuffer = (yyvsp[-1].number) * (yyvsp[0].number); } #line 3344 "src/y.tab.c" /* yacc.c:1646 */ break; case 207: #line 658 "src/p.y" /* yacc.c:1646 */ { Run.limits.sendExpectBuffer = (yyvsp[-1].number) * (yyvsp[0].number); } #line 3352 "src/y.tab.c" /* yacc.c:1646 */ break; case 208: #line 661 "src/p.y" /* yacc.c:1646 */ { Run.limits.fileContentBuffer = (yyvsp[-1].number) * (yyvsp[0].number); } #line 3360 "src/y.tab.c" /* yacc.c:1646 */ break; case 209: #line 664 "src/p.y" /* yacc.c:1646 */ { Run.limits.httpContentBuffer = (yyvsp[-1].number) * (yyvsp[0].number); } #line 3368 "src/y.tab.c" /* yacc.c:1646 */ break; case 210: #line 667 "src/p.y" /* yacc.c:1646 */ { Run.limits.programOutput = (yyvsp[-1].number) * (yyvsp[0].number); } #line 3376 "src/y.tab.c" /* yacc.c:1646 */ break; case 211: #line 670 "src/p.y" /* yacc.c:1646 */ { Run.limits.networkTimeout = (yyvsp[-1].number); } #line 3384 "src/y.tab.c" /* yacc.c:1646 */ break; case 212: #line 673 "src/p.y" /* yacc.c:1646 */ { Run.limits.networkTimeout = (yyvsp[-1].number) * 1000; } #line 3392 "src/y.tab.c" /* yacc.c:1646 */ break; case 213: #line 676 "src/p.y" /* yacc.c:1646 */ { Run.limits.programTimeout = (yyvsp[-1].number); } #line 3400 "src/y.tab.c" /* yacc.c:1646 */ break; case 214: #line 679 "src/p.y" /* yacc.c:1646 */ { Run.limits.programTimeout = (yyvsp[-1].number) * 1000; } #line 3408 "src/y.tab.c" /* yacc.c:1646 */ break; case 215: #line 682 "src/p.y" /* yacc.c:1646 */ { Run.limits.stopTimeout = (yyvsp[-1].number); } #line 3416 "src/y.tab.c" /* yacc.c:1646 */ break; case 216: #line 685 "src/p.y" /* yacc.c:1646 */ { Run.limits.stopTimeout = (yyvsp[-1].number) * 1000; } #line 3424 "src/y.tab.c" /* yacc.c:1646 */ break; case 217: #line 688 "src/p.y" /* yacc.c:1646 */ { Run.limits.startTimeout = (yyvsp[-1].number); } #line 3432 "src/y.tab.c" /* yacc.c:1646 */ break; case 218: #line 691 "src/p.y" /* yacc.c:1646 */ { Run.limits.startTimeout = (yyvsp[-1].number) * 1000; } #line 3440 "src/y.tab.c" /* yacc.c:1646 */ break; case 219: #line 694 "src/p.y" /* yacc.c:1646 */ { Run.limits.restartTimeout = (yyvsp[-1].number); } #line 3448 "src/y.tab.c" /* yacc.c:1646 */ break; case 220: #line 697 "src/p.y" /* yacc.c:1646 */ { Run.limits.restartTimeout = (yyvsp[-1].number) * 1000; } #line 3456 "src/y.tab.c" /* yacc.c:1646 */ break; case 221: #line 702 "src/p.y" /* yacc.c:1646 */ { Run.flags |= Run_FipsEnabled; } #line 3464 "src/y.tab.c" /* yacc.c:1646 */ break; case 222: #line 707 "src/p.y" /* yacc.c:1646 */ { if (! Run.files.log || ihp.logfile) { ihp.logfile = true; setlogfile((yyvsp[0].string)); Run.flags &= ~Run_UseSyslog; Run.flags |= Run_Log; } } #line 3477 "src/y.tab.c" /* yacc.c:1646 */ break; case 223: #line 715 "src/p.y" /* yacc.c:1646 */ { setsyslog(NULL); } #line 3485 "src/y.tab.c" /* yacc.c:1646 */ break; case 224: #line 718 "src/p.y" /* yacc.c:1646 */ { setsyslog((yyvsp[0].string)); FREE((yyvsp[0].string)); } #line 3493 "src/y.tab.c" /* yacc.c:1646 */ break; case 225: #line 723 "src/p.y" /* yacc.c:1646 */ { Run.eventlist_dir = (yyvsp[0].string); } #line 3501 "src/y.tab.c" /* yacc.c:1646 */ break; case 226: #line 726 "src/p.y" /* yacc.c:1646 */ { Run.eventlist_dir = (yyvsp[-2].string); Run.eventlist_slots = (yyvsp[0].number); } #line 3510 "src/y.tab.c" /* yacc.c:1646 */ break; case 227: #line 730 "src/p.y" /* yacc.c:1646 */ { Run.eventlist_dir = Str_dup(MYEVENTLISTBASE); Run.eventlist_slots = (yyvsp[0].number); } #line 3519 "src/y.tab.c" /* yacc.c:1646 */ break; case 228: #line 736 "src/p.y" /* yacc.c:1646 */ { Run.files.id = (yyvsp[0].string); } #line 3527 "src/y.tab.c" /* yacc.c:1646 */ break; case 229: #line 741 "src/p.y" /* yacc.c:1646 */ { Run.files.state = (yyvsp[0].string); } #line 3535 "src/y.tab.c" /* yacc.c:1646 */ break; case 230: #line 746 "src/p.y" /* yacc.c:1646 */ { if (! Run.files.pid || ihp.pidfile) { ihp.pidfile = true; setpidfile((yyvsp[0].string)); } } #line 3546 "src/y.tab.c" /* yacc.c:1646 */ break; case 234: #line 761 "src/p.y" /* yacc.c:1646 */ { mmonitset.url = (yyvsp[-1].url); addmmonit(&mmonitset); } #line 3555 "src/y.tab.c" /* yacc.c:1646 */ break; case 237: #line 771 "src/p.y" /* yacc.c:1646 */ { mmonitset.timeout = (yyvsp[-1].number) * 1000; // net timeout is in milliseconds internally } #line 3563 "src/y.tab.c" /* yacc.c:1646 */ break; case 243: #line 781 "src/p.y" /* yacc.c:1646 */ { Run.flags &= ~Run_MmonitCredentials; } #line 3571 "src/y.tab.c" /* yacc.c:1646 */ break; case 244: #line 786 "src/p.y" /* yacc.c:1646 */ { _setSSLOptions(&(Run.ssl)); } #line 3579 "src/y.tab.c" /* yacc.c:1646 */ break; case 245: #line 791 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; } #line 3587 "src/y.tab.c" /* yacc.c:1646 */ break; case 249: #line 801 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; sslset.verify = true; } #line 3596 "src/y.tab.c" /* yacc.c:1646 */ break; case 250: #line 805 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; sslset.verify = false; } #line 3605 "src/y.tab.c" /* yacc.c:1646 */ break; case 251: #line 809 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; sslset.allowSelfSigned = true; } #line 3614 "src/y.tab.c" /* yacc.c:1646 */ break; case 252: #line 813 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; sslset.allowSelfSigned = false; } #line 3623 "src/y.tab.c" /* yacc.c:1646 */ break; case 253: #line 817 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; } #line 3631 "src/y.tab.c" /* yacc.c:1646 */ break; case 254: #line 820 "src/p.y" /* yacc.c:1646 */ { FREE(sslset.ciphers); sslset.ciphers = (yyvsp[0].string); } #line 3640 "src/y.tab.c" /* yacc.c:1646 */ break; case 255: #line 824 "src/p.y" /* yacc.c:1646 */ { _setPEM(&(sslset.pemfile), (yyvsp[0].string), "SSL server PEM file", true); } #line 3648 "src/y.tab.c" /* yacc.c:1646 */ break; case 256: #line 827 "src/p.y" /* yacc.c:1646 */ { _setPEM(&(sslset.clientpemfile), (yyvsp[0].string), "SSL client PEM file", true); } #line 3656 "src/y.tab.c" /* yacc.c:1646 */ break; case 257: #line 830 "src/p.y" /* yacc.c:1646 */ { _setPEM(&(sslset.CACertificateFile), (yyvsp[0].string), "SSL CA certificates file", true); } #line 3664 "src/y.tab.c" /* yacc.c:1646 */ break; case 258: #line 833 "src/p.y" /* yacc.c:1646 */ { _setPEM(&(sslset.CACertificatePath), (yyvsp[0].string), "SSL CA certificates directory", false); } #line 3672 "src/y.tab.c" /* yacc.c:1646 */ break; case 259: #line 838 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; portset.target.net.ssl.certificate.minimumDays = (yyvsp[-1].number); } #line 3681 "src/y.tab.c" /* yacc.c:1646 */ break; case 262: #line 848 "src/p.y" /* yacc.c:1646 */ { 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 3700 "src/y.tab.c" /* yacc.c:1646 */ break; case 263: #line 862 "src/p.y" /* yacc.c:1646 */ { 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 3712 "src/y.tab.c" /* yacc.c:1646 */ break; case 264: #line 869 "src/p.y" /* yacc.c:1646 */ { 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 3724 "src/y.tab.c" /* yacc.c:1646 */ break; case 267: #line 882 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; sslset.version = SSL_V2; } #line 3733 "src/y.tab.c" /* yacc.c:1646 */ break; case 268: #line 886 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; sslset.version = SSL_V3; } #line 3742 "src/y.tab.c" /* yacc.c:1646 */ break; case 269: #line 890 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; sslset.version = SSL_TLSV1; } #line 3751 "src/y.tab.c" /* yacc.c:1646 */ break; case 270: #line 895 "src/p.y" /* yacc.c:1646 */ { #ifndef HAVE_TLSV1_1 yyerror("Your SSL Library does not support TLS version 1.1"); #endif sslset.flags = SSL_Enabled; sslset.version = SSL_TLSV11; } #line 3763 "src/y.tab.c" /* yacc.c:1646 */ break; case 271: #line 903 "src/p.y" /* yacc.c:1646 */ { #ifndef HAVE_TLSV1_2 yyerror("Your SSL Library does not support TLS version 1.2"); #endif sslset.flags = SSL_Enabled; sslset.version = SSL_TLSV12; } #line 3775 "src/y.tab.c" /* yacc.c:1646 */ break; case 272: #line 911 "src/p.y" /* yacc.c:1646 */ { #ifndef HAVE_TLSV1_3 yyerror("Your SSL Library does not support TLS version 1.3"); #endif sslset.flags = SSL_Enabled; sslset.version = SSL_TLSV13; } #line 3787 "src/y.tab.c" /* yacc.c:1646 */ break; case 273: #line 919 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; sslset.version = SSL_Auto; } #line 3796 "src/y.tab.c" /* yacc.c:1646 */ break; case 274: #line 923 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; sslset.version = SSL_Auto; } #line 3805 "src/y.tab.c" /* yacc.c:1646 */ break; case 275: #line 929 "src/p.y" /* yacc.c:1646 */ { // 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 3817 "src/y.tab.c" /* yacc.c:1646 */ break; case 276: #line 938 "src/p.y" /* yacc.c:1646 */ { if (((yyvsp[-1].number)) > SMTP_TIMEOUT) Run.mailserver_timeout = (yyvsp[-1].number); Run.mail_hostname = (yyvsp[0].string); } #line 3827 "src/y.tab.c" /* yacc.c:1646 */ break; case 277: #line 945 "src/p.y" /* yacc.c:1646 */ { 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 3845 "src/y.tab.c" /* yacc.c:1646 */ break; case 280: #line 964 "src/p.y" /* yacc.c:1646 */ { /* Restore the current text overriden by lookahead */ FREE(argyytext); argyytext = Str_dup((yyvsp[-1].string)); mailserverset.host = (yyvsp[-1].string); mailserverset.port = PORT_SMTP; addmailserver(&mailserverset); } #line 3859 "src/y.tab.c" /* yacc.c:1646 */ break; case 281: #line 973 "src/p.y" /* yacc.c:1646 */ { /* Restore the current text overriden by lookahead */ FREE(argyytext); argyytext = Str_dup((yyvsp[-3].string)); mailserverset.host = (yyvsp[-3].string); mailserverset.port = (yyvsp[-1].number); addmailserver(&mailserverset); } #line 3873 "src/y.tab.c" /* yacc.c:1646 */ break; case 284: #line 988 "src/p.y" /* yacc.c:1646 */ { mailserverset.username = (yyvsp[0].string); } #line 3881 "src/y.tab.c" /* yacc.c:1646 */ break; case 285: #line 991 "src/p.y" /* yacc.c:1646 */ { mailserverset.password = (yyvsp[0].string); } #line 3889 "src/y.tab.c" /* yacc.c:1646 */ break; case 290: #line 1000 "src/p.y" /* yacc.c:1646 */ { if (sslset.flags & SSL_Enabled) { #ifdef HAVE_OPENSSL if (! sslset.pemfile) { yyerror("SSL server PEM file is required (please use ssl pemfile option)"); } else if (! file_checkStat(sslset.pemfile, "SSL server PEM file", S_IRWXU)) { yyerror("SSL server PEM file permissions check failed"); } else { _setSSLOptions(&(Run.httpd.socket.net.ssl)); } #else yyerror("SSL is not supported"); #endif } } #line 3909 "src/y.tab.c" /* yacc.c:1646 */ break; case 302: #line 1033 "src/p.y" /* yacc.c:1646 */ { _setPEM(&(sslset.pemfile), (yyvsp[0].string), "SSL server PEM file", true); } #line 3917 "src/y.tab.c" /* yacc.c:1646 */ break; case 303: #line 1039 "src/p.y" /* yacc.c:1646 */ { _setPEM(&(sslset.clientpemfile), (yyvsp[0].string), "SSL client PEM file", true); } #line 3925 "src/y.tab.c" /* yacc.c:1646 */ break; case 304: #line 1045 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; sslset.allowSelfSigned = true; } #line 3934 "src/y.tab.c" /* yacc.c:1646 */ break; case 305: #line 1051 "src/p.y" /* yacc.c:1646 */ { Run.httpd.flags |= Httpd_Net; Run.httpd.socket.net.port = (yyvsp[0].number); } #line 3943 "src/y.tab.c" /* yacc.c:1646 */ break; case 306: #line 1057 "src/p.y" /* yacc.c:1646 */ { Run.httpd.flags |= Httpd_Unix; Run.httpd.socket.unix.path = (yyvsp[-1].string); } #line 3952 "src/y.tab.c" /* yacc.c:1646 */ break; case 309: #line 1067 "src/p.y" /* yacc.c:1646 */ { Run.httpd.flags |= Httpd_UnixUid; Run.httpd.socket.unix.uid = get_uid((yyvsp[0].string), 0); FREE((yyvsp[0].string)); } #line 3962 "src/y.tab.c" /* yacc.c:1646 */ break; case 310: #line 1072 "src/p.y" /* yacc.c:1646 */ { Run.httpd.flags |= Httpd_UnixGid; Run.httpd.socket.unix.gid = get_gid((yyvsp[0].string), 0); FREE((yyvsp[0].string)); } #line 3972 "src/y.tab.c" /* yacc.c:1646 */ break; case 311: #line 1077 "src/p.y" /* yacc.c:1646 */ { Run.httpd.flags |= Httpd_UnixUid; Run.httpd.socket.unix.uid = get_uid(NULL, (yyvsp[0].number)); } #line 3981 "src/y.tab.c" /* yacc.c:1646 */ break; case 312: #line 1081 "src/p.y" /* yacc.c:1646 */ { Run.httpd.flags |= Httpd_UnixGid; Run.httpd.socket.unix.gid = get_gid(NULL, (yyvsp[0].number)); } #line 3990 "src/y.tab.c" /* yacc.c:1646 */ break; case 313: #line 1085 "src/p.y" /* yacc.c:1646 */ { Run.httpd.flags |= Httpd_UnixPermission; Run.httpd.socket.unix.permission = check_perm((yyvsp[0].number)); } #line 3999 "src/y.tab.c" /* yacc.c:1646 */ break; case 318: #line 1099 "src/p.y" /* yacc.c:1646 */ { Run.httpd.flags |= Httpd_Signature; } #line 4007 "src/y.tab.c" /* yacc.c:1646 */ break; case 319: #line 1102 "src/p.y" /* yacc.c:1646 */ { Run.httpd.flags &= ~Httpd_Signature; } #line 4015 "src/y.tab.c" /* yacc.c:1646 */ break; case 320: #line 1107 "src/p.y" /* yacc.c:1646 */ { Run.httpd.socket.net.address = (yyvsp[0].string); } #line 4023 "src/y.tab.c" /* yacc.c:1646 */ break; case 321: #line 1112 "src/p.y" /* yacc.c:1646 */ { addcredentials((yyvsp[-3].string), (yyvsp[-1].string), Digest_Cleartext, (yyvsp[0].number)); } #line 4031 "src/y.tab.c" /* yacc.c:1646 */ break; case 322: #line 1115 "src/p.y" /* yacc.c:1646 */ { #ifdef HAVE_LIBPAM addpamauth((yyvsp[-1].string), (yyvsp[0].number)); #else yyerror("PAM is not supported"); FREE((yyvsp[-1].string)); #endif } #line 4044 "src/y.tab.c" /* yacc.c:1646 */ break; case 323: #line 1123 "src/p.y" /* yacc.c:1646 */ { addhtpasswdentry((yyvsp[0].string), NULL, Digest_Cleartext); FREE((yyvsp[0].string)); } #line 4053 "src/y.tab.c" /* yacc.c:1646 */ break; case 324: #line 1127 "src/p.y" /* yacc.c:1646 */ { addhtpasswdentry((yyvsp[0].string), NULL, Digest_Cleartext); FREE((yyvsp[0].string)); } #line 4062 "src/y.tab.c" /* yacc.c:1646 */ break; case 325: #line 1131 "src/p.y" /* yacc.c:1646 */ { addhtpasswdentry((yyvsp[0].string), NULL, Digest_Md5); FREE((yyvsp[0].string)); } #line 4071 "src/y.tab.c" /* yacc.c:1646 */ break; case 326: #line 1135 "src/p.y" /* yacc.c:1646 */ { addhtpasswdentry((yyvsp[0].string), NULL, Digest_Crypt); FREE((yyvsp[0].string)); } #line 4080 "src/y.tab.c" /* yacc.c:1646 */ break; case 327: #line 1139 "src/p.y" /* yacc.c:1646 */ { htpasswd_file = (yyvsp[0].string); digesttype = Digest_Cleartext; } #line 4089 "src/y.tab.c" /* yacc.c:1646 */ break; case 328: #line 1143 "src/p.y" /* yacc.c:1646 */ { FREE(htpasswd_file); } #line 4097 "src/y.tab.c" /* yacc.c:1646 */ break; case 329: #line 1146 "src/p.y" /* yacc.c:1646 */ { htpasswd_file = (yyvsp[0].string); digesttype = Digest_Cleartext; } #line 4106 "src/y.tab.c" /* yacc.c:1646 */ break; case 330: #line 1150 "src/p.y" /* yacc.c:1646 */ { FREE(htpasswd_file); } #line 4114 "src/y.tab.c" /* yacc.c:1646 */ break; case 331: #line 1153 "src/p.y" /* yacc.c:1646 */ { htpasswd_file = (yyvsp[0].string); digesttype = Digest_Md5; } #line 4123 "src/y.tab.c" /* yacc.c:1646 */ break; case 332: #line 1157 "src/p.y" /* yacc.c:1646 */ { FREE(htpasswd_file); } #line 4131 "src/y.tab.c" /* yacc.c:1646 */ break; case 333: #line 1160 "src/p.y" /* yacc.c:1646 */ { htpasswd_file = (yyvsp[0].string); digesttype = Digest_Crypt; } #line 4140 "src/y.tab.c" /* yacc.c:1646 */ break; case 334: #line 1164 "src/p.y" /* yacc.c:1646 */ { FREE(htpasswd_file); } #line 4148 "src/y.tab.c" /* yacc.c:1646 */ break; case 335: #line 1167 "src/p.y" /* yacc.c:1646 */ { if (! Engine_addAllow((yyvsp[0].string))) yywarning2("invalid allow option", (yyvsp[0].string)); FREE((yyvsp[0].string)); } #line 4158 "src/y.tab.c" /* yacc.c:1646 */ break; case 338: #line 1178 "src/p.y" /* yacc.c:1646 */ { addhtpasswdentry(htpasswd_file, (yyvsp[0].string), digesttype); FREE((yyvsp[0].string)); } #line 4167 "src/y.tab.c" /* yacc.c:1646 */ break; case 339: #line 1184 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = false; } #line 4175 "src/y.tab.c" /* yacc.c:1646 */ break; case 340: #line 1187 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = true; } #line 4183 "src/y.tab.c" /* yacc.c:1646 */ break; case 341: #line 1192 "src/p.y" /* yacc.c:1646 */ { createservice(Service_Process, (yyvsp[-2].string), (yyvsp[0].string), check_process); } #line 4191 "src/y.tab.c" /* yacc.c:1646 */ break; case 342: #line 1195 "src/p.y" /* yacc.c:1646 */ { createservice(Service_Process, (yyvsp[-2].string), (yyvsp[0].string), check_process); } #line 4199 "src/y.tab.c" /* yacc.c:1646 */ break; case 343: #line 1198 "src/p.y" /* yacc.c:1646 */ { 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 4211 "src/y.tab.c" /* yacc.c:1646 */ break; case 344: #line 1205 "src/p.y" /* yacc.c:1646 */ { 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 4223 "src/y.tab.c" /* yacc.c:1646 */ break; case 345: #line 1214 "src/p.y" /* yacc.c:1646 */ { createservice(Service_File, (yyvsp[-2].string), (yyvsp[0].string), check_file); } #line 4231 "src/y.tab.c" /* yacc.c:1646 */ break; case 346: #line 1219 "src/p.y" /* yacc.c:1646 */ { createservice(Service_Filesystem, (yyvsp[-2].string), (yyvsp[0].string), check_filesystem); } #line 4239 "src/y.tab.c" /* yacc.c:1646 */ break; case 347: #line 1222 "src/p.y" /* yacc.c:1646 */ { createservice(Service_Filesystem, (yyvsp[-2].string), (yyvsp[0].string), check_filesystem); } #line 4247 "src/y.tab.c" /* yacc.c:1646 */ break; case 348: #line 1227 "src/p.y" /* yacc.c:1646 */ { createservice(Service_Directory, (yyvsp[-2].string), (yyvsp[0].string), check_directory); } #line 4255 "src/y.tab.c" /* yacc.c:1646 */ break; case 349: #line 1232 "src/p.y" /* yacc.c:1646 */ { createservice(Service_Host, (yyvsp[-2].string), (yyvsp[0].string), check_remote_host); } #line 4263 "src/y.tab.c" /* yacc.c:1646 */ break; case 350: #line 1237 "src/p.y" /* yacc.c:1646 */ { 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 4276 "src/y.tab.c" /* yacc.c:1646 */ break; case 351: #line 1245 "src/p.y" /* yacc.c:1646 */ { createservice(Service_Net, (yyvsp[-2].string), (yyvsp[0].string), check_net); current->inf.net->stats = Link_createForInterface((yyvsp[0].string)); } #line 4285 "src/y.tab.c" /* yacc.c:1646 */ break; case 352: #line 1251 "src/p.y" /* yacc.c:1646 */ { char *servicename = (yyvsp[0].string); if (Str_sub(servicename, "$HOST")) { char hostname[STRLEN]; if (gethostname(hostname, sizeof(hostname))) { LogError("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 4303 "src/y.tab.c" /* yacc.c:1646 */ break; case 353: #line 1266 "src/p.y" /* yacc.c:1646 */ { createservice(Service_Fifo, (yyvsp[-2].string), (yyvsp[0].string), check_fifo); } #line 4311 "src/y.tab.c" /* yacc.c:1646 */ break; case 354: #line 1271 "src/p.y" /* yacc.c:1646 */ { command_t c = command; // Current command check_exec(c->arg[0]); 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 4324 "src/y.tab.c" /* yacc.c:1646 */ break; case 355: #line 1279 "src/p.y" /* yacc.c:1646 */ { command_t c = command; // Current command check_exec(c->arg[0]); 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 4337 "src/y.tab.c" /* yacc.c:1646 */ break; case 356: #line 1289 "src/p.y" /* yacc.c:1646 */ { addcommand(START, (yyvsp[0].number)); } #line 4345 "src/y.tab.c" /* yacc.c:1646 */ break; case 357: #line 1292 "src/p.y" /* yacc.c:1646 */ { addcommand(START, (yyvsp[0].number)); } #line 4353 "src/y.tab.c" /* yacc.c:1646 */ break; case 358: #line 1297 "src/p.y" /* yacc.c:1646 */ { addcommand(STOP, (yyvsp[0].number)); } #line 4361 "src/y.tab.c" /* yacc.c:1646 */ break; case 359: #line 1300 "src/p.y" /* yacc.c:1646 */ { addcommand(STOP, (yyvsp[0].number)); } #line 4369 "src/y.tab.c" /* yacc.c:1646 */ break; case 360: #line 1306 "src/p.y" /* yacc.c:1646 */ { addcommand(RESTART, (yyvsp[0].number)); } #line 4377 "src/y.tab.c" /* yacc.c:1646 */ break; case 361: #line 1309 "src/p.y" /* yacc.c:1646 */ { addcommand(RESTART, (yyvsp[0].number)); } #line 4385 "src/y.tab.c" /* yacc.c:1646 */ break; case 366: #line 1322 "src/p.y" /* yacc.c:1646 */ { addargument((yyvsp[0].string)); } #line 4393 "src/y.tab.c" /* yacc.c:1646 */ break; case 367: #line 1325 "src/p.y" /* yacc.c:1646 */ { addargument((yyvsp[0].string)); } #line 4401 "src/y.tab.c" /* yacc.c:1646 */ break; case 368: #line 1330 "src/p.y" /* yacc.c:1646 */ { addeuid(get_uid((yyvsp[0].string), 0)); FREE((yyvsp[0].string)); } #line 4410 "src/y.tab.c" /* yacc.c:1646 */ break; case 369: #line 1334 "src/p.y" /* yacc.c:1646 */ { addegid(get_gid((yyvsp[0].string), 0)); FREE((yyvsp[0].string)); } #line 4419 "src/y.tab.c" /* yacc.c:1646 */ break; case 370: #line 1338 "src/p.y" /* yacc.c:1646 */ { addeuid(get_uid(NULL, (yyvsp[0].number))); } #line 4427 "src/y.tab.c" /* yacc.c:1646 */ break; case 371: #line 1341 "src/p.y" /* yacc.c:1646 */ { addegid(get_gid(NULL, (yyvsp[0].number))); } #line 4435 "src/y.tab.c" /* yacc.c:1646 */ break; case 372: #line 1346 "src/p.y" /* yacc.c:1646 */ { (yyval.string) = (yyvsp[0].string); } #line 4443 "src/y.tab.c" /* yacc.c:1646 */ break; case 373: #line 1349 "src/p.y" /* yacc.c:1646 */ { (yyval.string) = (yyvsp[0].string); } #line 4451 "src/y.tab.c" /* yacc.c:1646 */ break; case 374: #line 1354 "src/p.y" /* yacc.c:1646 */ { (yyval.string) = (yyvsp[0].string); } #line 4459 "src/y.tab.c" /* yacc.c:1646 */ break; case 375: #line 1359 "src/p.y" /* yacc.c:1646 */ { (yyval.string) = NULL; } #line 4467 "src/y.tab.c" /* yacc.c:1646 */ break; case 376: #line 1362 "src/p.y" /* yacc.c:1646 */ { (yyval.string) = (yyvsp[0].string); } #line 4475 "src/y.tab.c" /* yacc.c:1646 */ break; case 377: #line 1367 "src/p.y" /* yacc.c:1646 */ { /* 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; addeventaction(&(portset).action, (yyvsp[-1].number), (yyvsp[0].number)); addport(&(current->portlist), &portset); } #line 4487 "src/y.tab.c" /* yacc.c:1646 */ break; case 391: #line 1393 "src/p.y" /* yacc.c:1646 */ { prepare_urlrequest((yyvsp[-5].url)); addeventaction(&(portset).action, (yyvsp[-1].number), (yyvsp[0].number)); addport(&(current->portlist), &portset); } #line 4497 "src/y.tab.c" /* yacc.c:1646 */ break; case 400: #line 1412 "src/p.y" /* yacc.c:1646 */ { addeventaction(&(portset).action, (yyvsp[-1].number), (yyvsp[0].number)); addport(&(current->socketlist), &portset); } #line 4506 "src/y.tab.c" /* yacc.c:1646 */ break; case 408: #line 1429 "src/p.y" /* yacc.c:1646 */ { icmpset.family = Socket_Ip; icmpset.type = (yyvsp[-5].number); addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number)); addicmp(&icmpset); } #line 4517 "src/y.tab.c" /* yacc.c:1646 */ break; case 409: #line 1435 "src/p.y" /* yacc.c:1646 */ { icmpset.family = Socket_Ip; addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number)); addicmp(&icmpset); } #line 4527 "src/y.tab.c" /* yacc.c:1646 */ break; case 410: #line 1440 "src/p.y" /* yacc.c:1646 */ { icmpset.family = Socket_Ip4; addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number)); addicmp(&icmpset); } #line 4537 "src/y.tab.c" /* yacc.c:1646 */ break; case 411: #line 1445 "src/p.y" /* yacc.c:1646 */ { icmpset.family = Socket_Ip6; addeventaction(&(icmpset).action, (yyvsp[-1].number), (yyvsp[0].number)); addicmp(&icmpset); } #line 4547 "src/y.tab.c" /* yacc.c:1646 */ break; case 418: #line 1462 "src/p.y" /* yacc.c:1646 */ { portset.hostname = Str_dup(current->type == Service_Host ? current->path : LOCALHOST); } #line 4555 "src/y.tab.c" /* yacc.c:1646 */ break; case 419: #line 1465 "src/p.y" /* yacc.c:1646 */ { portset.hostname = (yyvsp[0].string); } #line 4563 "src/y.tab.c" /* yacc.c:1646 */ break; case 420: #line 1470 "src/p.y" /* yacc.c:1646 */ { portset.target.net.port = (yyvsp[0].number); } #line 4571 "src/y.tab.c" /* yacc.c:1646 */ break; case 421: #line 1475 "src/p.y" /* yacc.c:1646 */ { portset.family = Socket_Unix; portset.target.unix.pathname = (yyvsp[0].string); } #line 4580 "src/y.tab.c" /* yacc.c:1646 */ break; case 422: #line 1481 "src/p.y" /* yacc.c:1646 */ { portset.family = Socket_Ip4; } #line 4588 "src/y.tab.c" /* yacc.c:1646 */ break; case 423: #line 1484 "src/p.y" /* yacc.c:1646 */ { portset.family = Socket_Ip6; } #line 4596 "src/y.tab.c" /* yacc.c:1646 */ break; case 424: #line 1489 "src/p.y" /* yacc.c:1646 */ { portset.type = Socket_Tcp; } #line 4604 "src/y.tab.c" /* yacc.c:1646 */ break; case 425: #line 1492 "src/p.y" /* yacc.c:1646 */ { // The typelist is kept for backward compatibility (replaced by ssloptionlist) portset.type = Socket_Tcp; sslset.flags = SSL_Enabled; } #line 4613 "src/y.tab.c" /* yacc.c:1646 */ break; case 426: #line 1496 "src/p.y" /* yacc.c:1646 */ { portset.type = Socket_Udp; } #line 4621 "src/y.tab.c" /* yacc.c:1646 */ break; case 431: #line 1509 "src/p.y" /* yacc.c:1646 */ { _parseOutgoingAddress((yyvsp[0].string), &(portset.outgoing)); } #line 4629 "src/y.tab.c" /* yacc.c:1646 */ break; case 432: #line 1514 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_APACHESTATUS); } #line 4637 "src/y.tab.c" /* yacc.c:1646 */ break; case 433: #line 1517 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_DEFAULT); } #line 4645 "src/y.tab.c" /* yacc.c:1646 */ break; case 434: #line 1520 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_DNS); } #line 4653 "src/y.tab.c" /* yacc.c:1646 */ break; case 435: #line 1523 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_DWP); } #line 4661 "src/y.tab.c" /* yacc.c:1646 */ break; case 436: #line 1526 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_FAIL2BAN); } #line 4669 "src/y.tab.c" /* yacc.c:1646 */ break; case 437: #line 1529 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_FTP); } #line 4677 "src/y.tab.c" /* yacc.c:1646 */ break; case 438: #line 1532 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_HTTP); } #line 4685 "src/y.tab.c" /* yacc.c:1646 */ break; case 439: #line 1535 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; portset.type = Socket_Tcp; portset.protocol = Protocol_get(Protocol_HTTP); } #line 4695 "src/y.tab.c" /* yacc.c:1646 */ break; case 440: #line 1540 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_IMAP); } #line 4703 "src/y.tab.c" /* yacc.c:1646 */ break; case 441: #line 1543 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; portset.type = Socket_Tcp; portset.protocol = Protocol_get(Protocol_IMAP); } #line 4713 "src/y.tab.c" /* yacc.c:1646 */ break; case 442: #line 1548 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_CLAMAV); } #line 4721 "src/y.tab.c" /* yacc.c:1646 */ break; case 443: #line 1551 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_LDAP2); } #line 4729 "src/y.tab.c" /* yacc.c:1646 */ break; case 444: #line 1554 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_LDAP3); } #line 4737 "src/y.tab.c" /* yacc.c:1646 */ break; case 445: #line 1557 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_MONGODB); } #line 4745 "src/y.tab.c" /* yacc.c:1646 */ break; case 446: #line 1560 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_MQTT); } #line 4753 "src/y.tab.c" /* yacc.c:1646 */ break; case 447: #line 1563 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_MYSQL); } #line 4761 "src/y.tab.c" /* yacc.c:1646 */ break; case 448: #line 1566 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_SIP); } #line 4769 "src/y.tab.c" /* yacc.c:1646 */ break; case 449: #line 1569 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_NNTP); } #line 4777 "src/y.tab.c" /* yacc.c:1646 */ break; case 450: #line 1572 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_NTP3); portset.type = Socket_Udp; } #line 4786 "src/y.tab.c" /* yacc.c:1646 */ break; case 451: #line 1576 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_POSTFIXPOLICY); } #line 4794 "src/y.tab.c" /* yacc.c:1646 */ break; case 452: #line 1579 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_POP); } #line 4802 "src/y.tab.c" /* yacc.c:1646 */ break; case 453: #line 1582 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; portset.type = Socket_Tcp; portset.protocol = Protocol_get(Protocol_POP); } #line 4812 "src/y.tab.c" /* yacc.c:1646 */ break; case 454: #line 1587 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_SIEVE); } #line 4820 "src/y.tab.c" /* yacc.c:1646 */ break; case 455: #line 1590 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_SMTP); } #line 4828 "src/y.tab.c" /* yacc.c:1646 */ break; case 456: #line 1593 "src/p.y" /* yacc.c:1646 */ { sslset.flags = SSL_Enabled; portset.type = Socket_Tcp; portset.protocol = Protocol_get(Protocol_SMTP); } #line 4838 "src/y.tab.c" /* yacc.c:1646 */ break; case 457: #line 1598 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_SPAMASSASSIN); } #line 4846 "src/y.tab.c" /* yacc.c:1646 */ break; case 458: #line 1601 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_SSH); } #line 4854 "src/y.tab.c" /* yacc.c:1646 */ break; case 459: #line 1604 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_RDATE); } #line 4862 "src/y.tab.c" /* yacc.c:1646 */ break; case 460: #line 1607 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_REDIS); } #line 4870 "src/y.tab.c" /* yacc.c:1646 */ break; case 461: #line 1610 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_RSYNC); } #line 4878 "src/y.tab.c" /* yacc.c:1646 */ break; case 462: #line 1613 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_TNS); } #line 4886 "src/y.tab.c" /* yacc.c:1646 */ break; case 463: #line 1616 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_PGSQL); } #line 4894 "src/y.tab.c" /* yacc.c:1646 */ break; case 464: #line 1619 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_LMTP); } #line 4902 "src/y.tab.c" /* yacc.c:1646 */ break; case 465: #line 1622 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_GPS); } #line 4910 "src/y.tab.c" /* yacc.c:1646 */ break; case 466: #line 1625 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_RADIUS); } #line 4918 "src/y.tab.c" /* yacc.c:1646 */ break; case 467: #line 1628 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_MEMCACHE); } #line 4926 "src/y.tab.c" /* yacc.c:1646 */ break; case 468: #line 1631 "src/p.y" /* yacc.c:1646 */ { portset.protocol = Protocol_get(Protocol_WEBSOCKET); } #line 4934 "src/y.tab.c" /* yacc.c:1646 */ break; case 469: #line 1636 "src/p.y" /* yacc.c:1646 */ { 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 4947 "src/y.tab.c" /* yacc.c:1646 */ break; case 470: #line 1644 "src/p.y" /* yacc.c:1646 */ { 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 4960 "src/y.tab.c" /* yacc.c:1646 */ break; case 473: #line 1658 "src/p.y" /* yacc.c:1646 */ { portset.parameters.websocket.origin = (yyvsp[0].string); } #line 4968 "src/y.tab.c" /* yacc.c:1646 */ break; case 474: #line 1661 "src/p.y" /* yacc.c:1646 */ { portset.parameters.websocket.request = (yyvsp[0].string); } #line 4976 "src/y.tab.c" /* yacc.c:1646 */ break; case 475: #line 1664 "src/p.y" /* yacc.c:1646 */ { portset.parameters.websocket.host = (yyvsp[0].string); } #line 4984 "src/y.tab.c" /* yacc.c:1646 */ break; case 476: #line 1667 "src/p.y" /* yacc.c:1646 */ { portset.parameters.websocket.version = (yyvsp[0].number); } #line 4992 "src/y.tab.c" /* yacc.c:1646 */ break; case 479: #line 1676 "src/p.y" /* yacc.c:1646 */ { portset.parameters.smtp.username = (yyvsp[0].string); } #line 5000 "src/y.tab.c" /* yacc.c:1646 */ break; case 480: #line 1679 "src/p.y" /* yacc.c:1646 */ { portset.parameters.smtp.password = (yyvsp[0].string); } #line 5008 "src/y.tab.c" /* yacc.c:1646 */ break; case 483: #line 1688 "src/p.y" /* yacc.c:1646 */ { portset.parameters.mqtt.username = (yyvsp[0].string); } #line 5016 "src/y.tab.c" /* yacc.c:1646 */ break; case 484: #line 1691 "src/p.y" /* yacc.c:1646 */ { portset.parameters.mqtt.password = (yyvsp[0].string); } #line 5024 "src/y.tab.c" /* yacc.c:1646 */ break; case 487: #line 1700 "src/p.y" /* yacc.c:1646 */ { if ((yyvsp[0].string)) { if (strlen((yyvsp[0].string)) > 16) yyerror2("Username too long -- Maximum MySQL username length is 16 characters"); else portset.parameters.mysql.username = (yyvsp[0].string); } } #line 5037 "src/y.tab.c" /* yacc.c:1646 */ break; case 488: #line 1708 "src/p.y" /* yacc.c:1646 */ { portset.parameters.mysql.password = (yyvsp[0].string); } #line 5045 "src/y.tab.c" /* yacc.c:1646 */ break; case 489: #line 1713 "src/p.y" /* yacc.c:1646 */ { (yyval.string) = (yyvsp[0].string); } #line 5053 "src/y.tab.c" /* yacc.c:1646 */ break; case 490: #line 1716 "src/p.y" /* yacc.c:1646 */ { (yyval.string) = (yyvsp[0].string); } #line 5061 "src/y.tab.c" /* yacc.c:1646 */ break; case 491: #line 1721 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = verifyMaxForward((yyvsp[0].number)); } #line 5069 "src/y.tab.c" /* yacc.c:1646 */ break; case 494: #line 1730 "src/p.y" /* yacc.c:1646 */ { portset.parameters.sip.target = (yyvsp[0].string); } #line 5077 "src/y.tab.c" /* yacc.c:1646 */ break; case 495: #line 1733 "src/p.y" /* yacc.c:1646 */ { portset.parameters.sip.maxforward = (yyvsp[0].number); } #line 5085 "src/y.tab.c" /* yacc.c:1646 */ break; case 498: #line 1742 "src/p.y" /* yacc.c:1646 */ { portset.parameters.http.username = (yyvsp[0].string); } #line 5093 "src/y.tab.c" /* yacc.c:1646 */ break; case 499: #line 1745 "src/p.y" /* yacc.c:1646 */ { portset.parameters.http.password = (yyvsp[0].string); } #line 5101 "src/y.tab.c" /* yacc.c:1646 */ break; case 506: #line 1756 "src/p.y" /* yacc.c:1646 */ { 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 5114 "src/y.tab.c" /* yacc.c:1646 */ break; case 507: #line 1766 "src/p.y" /* yacc.c:1646 */ { portset.parameters.http.method = Http_Get; } #line 5122 "src/y.tab.c" /* yacc.c:1646 */ break; case 508: #line 1769 "src/p.y" /* yacc.c:1646 */ { portset.parameters.http.method = Http_Head; } #line 5130 "src/y.tab.c" /* yacc.c:1646 */ break; case 509: #line 1774 "src/p.y" /* yacc.c:1646 */ { portset.parameters.http.request = Util_urlEncode((yyvsp[0].string), false); FREE((yyvsp[0].string)); } #line 5139 "src/y.tab.c" /* yacc.c:1646 */ break; case 510: #line 1778 "src/p.y" /* yacc.c:1646 */ { portset.parameters.http.request = Util_urlEncode((yyvsp[0].string), false); FREE((yyvsp[0].string)); } #line 5148 "src/y.tab.c" /* yacc.c:1646 */ break; case 511: #line 1784 "src/p.y" /* yacc.c:1646 */ { portset.parameters.http.checksum = (yyvsp[0].string); } #line 5156 "src/y.tab.c" /* yacc.c:1646 */ break; case 512: #line 1789 "src/p.y" /* yacc.c:1646 */ { addhttpheader(&portset, Str_cat("Host:%s", (yyvsp[0].string))); FREE((yyvsp[0].string)); } #line 5165 "src/y.tab.c" /* yacc.c:1646 */ break; case 514: #line 1796 "src/p.y" /* yacc.c:1646 */ { addhttpheader(&portset, (yyvsp[0].string)); } #line 5173 "src/y.tab.c" /* yacc.c:1646 */ break; case 515: #line 1801 "src/p.y" /* yacc.c:1646 */ { (yyval.string) = (yyvsp[0].string); } #line 5181 "src/y.tab.c" /* yacc.c:1646 */ break; case 518: #line 1810 "src/p.y" /* yacc.c:1646 */ { portset.parameters.radius.secret = (yyvsp[0].string); } #line 5189 "src/y.tab.c" /* yacc.c:1646 */ break; case 521: #line 1819 "src/p.y" /* yacc.c:1646 */ { portset.parameters.apachestatus.username = (yyvsp[0].string); } #line 5197 "src/y.tab.c" /* yacc.c:1646 */ break; case 522: #line 1822 "src/p.y" /* yacc.c:1646 */ { portset.parameters.apachestatus.password = (yyvsp[0].string); } #line 5205 "src/y.tab.c" /* yacc.c:1646 */ break; case 523: #line 1825 "src/p.y" /* yacc.c:1646 */ { portset.parameters.apachestatus.path = (yyvsp[0].string); } #line 5213 "src/y.tab.c" /* yacc.c:1646 */ break; case 524: #line 1828 "src/p.y" /* yacc.c:1646 */ { portset.parameters.apachestatus.loglimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.loglimit = (yyvsp[-1].number); } #line 5222 "src/y.tab.c" /* yacc.c:1646 */ break; case 525: #line 1832 "src/p.y" /* yacc.c:1646 */ { portset.parameters.apachestatus.closelimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.closelimit = (yyvsp[-1].number); } #line 5231 "src/y.tab.c" /* yacc.c:1646 */ break; case 526: #line 1836 "src/p.y" /* yacc.c:1646 */ { portset.parameters.apachestatus.dnslimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.dnslimit = (yyvsp[-1].number); } #line 5240 "src/y.tab.c" /* yacc.c:1646 */ break; case 527: #line 1840 "src/p.y" /* yacc.c:1646 */ { portset.parameters.apachestatus.keepalivelimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.keepalivelimit = (yyvsp[-1].number); } #line 5249 "src/y.tab.c" /* yacc.c:1646 */ break; case 528: #line 1844 "src/p.y" /* yacc.c:1646 */ { portset.parameters.apachestatus.replylimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.replylimit = (yyvsp[-1].number); } #line 5258 "src/y.tab.c" /* yacc.c:1646 */ break; case 529: #line 1848 "src/p.y" /* yacc.c:1646 */ { portset.parameters.apachestatus.requestlimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.requestlimit = (yyvsp[-1].number); } #line 5267 "src/y.tab.c" /* yacc.c:1646 */ break; case 530: #line 1852 "src/p.y" /* yacc.c:1646 */ { portset.parameters.apachestatus.startlimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.startlimit = (yyvsp[-1].number); } #line 5276 "src/y.tab.c" /* yacc.c:1646 */ break; case 531: #line 1856 "src/p.y" /* yacc.c:1646 */ { portset.parameters.apachestatus.waitlimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.waitlimit = (yyvsp[-1].number); } #line 5285 "src/y.tab.c" /* yacc.c:1646 */ break; case 532: #line 1860 "src/p.y" /* yacc.c:1646 */ { portset.parameters.apachestatus.gracefullimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.gracefullimit = (yyvsp[-1].number); } #line 5294 "src/y.tab.c" /* yacc.c:1646 */ break; case 533: #line 1864 "src/p.y" /* yacc.c:1646 */ { portset.parameters.apachestatus.cleanuplimitOP = (yyvsp[-2].number); portset.parameters.apachestatus.cleanuplimit = (yyvsp[-1].number); } #line 5303 "src/y.tab.c" /* yacc.c:1646 */ break; case 534: #line 1870 "src/p.y" /* yacc.c:1646 */ { addeventaction(&(nonexistset).action, (yyvsp[-1].number), (yyvsp[0].number)); addnonexist(&nonexistset); } #line 5312 "src/y.tab.c" /* yacc.c:1646 */ break; case 535: #line 1874 "src/p.y" /* yacc.c:1646 */ { addeventaction(&(existset).action, (yyvsp[-1].number), (yyvsp[0].number)); addexist(&existset); } #line 5321 "src/y.tab.c" /* yacc.c:1646 */ break; case 536: #line 1881 "src/p.y" /* yacc.c:1646 */ { addeventaction(&(pidset).action, (yyvsp[0].number), Action_Ignored); addpid(&pidset); } #line 5330 "src/y.tab.c" /* yacc.c:1646 */ break; case 537: #line 1887 "src/p.y" /* yacc.c:1646 */ { addeventaction(&(ppidset).action, (yyvsp[0].number), Action_Ignored); addppid(&ppidset); } #line 5339 "src/y.tab.c" /* yacc.c:1646 */ break; case 538: #line 1893 "src/p.y" /* yacc.c:1646 */ { 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 5350 "src/y.tab.c" /* yacc.c:1646 */ break; case 539: #line 1900 "src/p.y" /* yacc.c:1646 */ { icmpset.count = (yyvsp[0].number); } #line 5358 "src/y.tab.c" /* yacc.c:1646 */ break; case 540: #line 1905 "src/p.y" /* yacc.c:1646 */ { 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 5371 "src/y.tab.c" /* yacc.c:1646 */ break; case 541: #line 1915 "src/p.y" /* yacc.c:1646 */ { icmpset.timeout = (yyvsp[-1].number) * 1000; // timeout is in milliseconds internally } #line 5379 "src/y.tab.c" /* yacc.c:1646 */ break; case 542: #line 1920 "src/p.y" /* yacc.c:1646 */ { _parseOutgoingAddress((yyvsp[0].string), &(icmpset.outgoing)); } #line 5387 "src/y.tab.c" /* yacc.c:1646 */ break; case 543: #line 1925 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Run.limits.stopTimeout; } #line 5395 "src/y.tab.c" /* yacc.c:1646 */ break; case 544: #line 1928 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = (yyvsp[-1].number) * 1000; // milliseconds internally } #line 5403 "src/y.tab.c" /* yacc.c:1646 */ break; case 545: #line 1933 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Run.limits.startTimeout; } #line 5411 "src/y.tab.c" /* yacc.c:1646 */ break; case 546: #line 1936 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = (yyvsp[-1].number) * 1000; // milliseconds internally } #line 5419 "src/y.tab.c" /* yacc.c:1646 */ break; case 547: #line 1941 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Run.limits.restartTimeout; } #line 5427 "src/y.tab.c" /* yacc.c:1646 */ break; case 548: #line 1944 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = (yyvsp[-1].number) * 1000; // milliseconds internally } #line 5435 "src/y.tab.c" /* yacc.c:1646 */ break; case 549: #line 1949 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Run.limits.programTimeout; } #line 5443 "src/y.tab.c" /* yacc.c:1646 */ break; case 550: #line 1952 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = (yyvsp[-1].number) * 1000; // milliseconds internally } #line 5451 "src/y.tab.c" /* yacc.c:1646 */ break; case 551: #line 1957 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Run.limits.networkTimeout; } #line 5459 "src/y.tab.c" /* yacc.c:1646 */ break; case 552: #line 1960 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = (yyvsp[-1].number) * 1000; // net timeout is in milliseconds internally } #line 5467 "src/y.tab.c" /* yacc.c:1646 */ break; case 553: #line 1965 "src/p.y" /* yacc.c:1646 */ { portset.timeout = (yyvsp[-1].number) * 1000; // timeout is in milliseconds internally } #line 5475 "src/y.tab.c" /* yacc.c:1646 */ break; case 554: #line 1970 "src/p.y" /* yacc.c:1646 */ { portset.retry = (yyvsp[0].number); } #line 5483 "src/y.tab.c" /* yacc.c:1646 */ break; case 555: #line 1975 "src/p.y" /* yacc.c:1646 */ { actionrateset.count = (yyvsp[-5].number); actionrateset.cycle = (yyvsp[-3].number); addeventaction(&(actionrateset).action, (yyvsp[0].number), Action_Alert); addactionrate(&actionrateset); } #line 5494 "src/y.tab.c" /* yacc.c:1646 */ break; case 556: #line 1981 "src/p.y" /* yacc.c:1646 */ { actionrateset.count = (yyvsp[-5].number); actionrateset.cycle = (yyvsp[-3].number); addeventaction(&(actionrateset).action, Action_Unmonitor, Action_Alert); addactionrate(&actionrateset); } #line 5505 "src/y.tab.c" /* yacc.c:1646 */ break; case 557: #line 1989 "src/p.y" /* yacc.c:1646 */ { seturlrequest((yyvsp[-1].number), (yyvsp[0].string)); FREE((yyvsp[0].string)); } #line 5514 "src/y.tab.c" /* yacc.c:1646 */ break; case 558: #line 1995 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Operator_Equal; } #line 5520 "src/y.tab.c" /* yacc.c:1646 */ break; case 559: #line 1996 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Operator_NotEqual; } #line 5526 "src/y.tab.c" /* yacc.c:1646 */ break; case 560: #line 1999 "src/p.y" /* yacc.c:1646 */ { mailset.events = Event_All; addmail((yyvsp[-2].string), &mailset, ¤t->maillist); } #line 5535 "src/y.tab.c" /* yacc.c:1646 */ break; case 561: #line 2003 "src/p.y" /* yacc.c:1646 */ { addmail((yyvsp[-5].string), &mailset, ¤t->maillist); } #line 5543 "src/y.tab.c" /* yacc.c:1646 */ break; case 562: #line 2006 "src/p.y" /* yacc.c:1646 */ { mailset.events = ~mailset.events; addmail((yyvsp[-6].string), &mailset, ¤t->maillist); } #line 5552 "src/y.tab.c" /* yacc.c:1646 */ break; case 563: #line 2010 "src/p.y" /* yacc.c:1646 */ { addmail((yyvsp[0].string), &mailset, ¤t->maillist); } #line 5560 "src/y.tab.c" /* yacc.c:1646 */ break; case 564: #line 2015 "src/p.y" /* yacc.c:1646 */ { (yyval.string) = (yyvsp[0].string); } #line 5566 "src/y.tab.c" /* yacc.c:1646 */ break; case 565: #line 2018 "src/p.y" /* yacc.c:1646 */ { (yyval.string) = (yyvsp[0].string); } #line 5572 "src/y.tab.c" /* yacc.c:1646 */ break; case 568: #line 2025 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Action; } #line 5578 "src/y.tab.c" /* yacc.c:1646 */ break; case 569: #line 2026 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_ByteIn; } #line 5584 "src/y.tab.c" /* yacc.c:1646 */ break; case 570: #line 2027 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_ByteOut; } #line 5590 "src/y.tab.c" /* yacc.c:1646 */ break; case 571: #line 2028 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Checksum; } #line 5596 "src/y.tab.c" /* yacc.c:1646 */ break; case 572: #line 2029 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Connection; } #line 5602 "src/y.tab.c" /* yacc.c:1646 */ break; case 573: #line 2030 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Content; } #line 5608 "src/y.tab.c" /* yacc.c:1646 */ break; case 574: #line 2031 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Data; } #line 5614 "src/y.tab.c" /* yacc.c:1646 */ break; case 575: #line 2032 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Exec; } #line 5620 "src/y.tab.c" /* yacc.c:1646 */ break; case 576: #line 2033 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Exist; } #line 5626 "src/y.tab.c" /* yacc.c:1646 */ break; case 577: #line 2034 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_FsFlag; } #line 5632 "src/y.tab.c" /* yacc.c:1646 */ break; case 578: #line 2035 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Gid; } #line 5638 "src/y.tab.c" /* yacc.c:1646 */ break; case 579: #line 2036 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Icmp; } #line 5644 "src/y.tab.c" /* yacc.c:1646 */ break; case 580: #line 2037 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Instance; } #line 5650 "src/y.tab.c" /* yacc.c:1646 */ break; case 581: #line 2038 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Invalid; } #line 5656 "src/y.tab.c" /* yacc.c:1646 */ break; case 582: #line 2039 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Link; } #line 5662 "src/y.tab.c" /* yacc.c:1646 */ break; case 583: #line 2040 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_NonExist; } #line 5668 "src/y.tab.c" /* yacc.c:1646 */ break; case 584: #line 2041 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_PacketIn; } #line 5674 "src/y.tab.c" /* yacc.c:1646 */ break; case 585: #line 2042 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_PacketOut; } #line 5680 "src/y.tab.c" /* yacc.c:1646 */ break; case 586: #line 2043 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Permission; } #line 5686 "src/y.tab.c" /* yacc.c:1646 */ break; case 587: #line 2044 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Pid; } #line 5692 "src/y.tab.c" /* yacc.c:1646 */ break; case 588: #line 2045 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_PPid; } #line 5698 "src/y.tab.c" /* yacc.c:1646 */ break; case 589: #line 2046 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Resource; } #line 5704 "src/y.tab.c" /* yacc.c:1646 */ break; case 590: #line 2047 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Saturation; } #line 5710 "src/y.tab.c" /* yacc.c:1646 */ break; case 591: #line 2048 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Size; } #line 5716 "src/y.tab.c" /* yacc.c:1646 */ break; case 592: #line 2049 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Speed; } #line 5722 "src/y.tab.c" /* yacc.c:1646 */ break; case 593: #line 2050 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Status; } #line 5728 "src/y.tab.c" /* yacc.c:1646 */ break; case 594: #line 2051 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Timeout; } #line 5734 "src/y.tab.c" /* yacc.c:1646 */ break; case 595: #line 2052 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Timestamp; } #line 5740 "src/y.tab.c" /* yacc.c:1646 */ break; case 596: #line 2053 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Uid; } #line 5746 "src/y.tab.c" /* yacc.c:1646 */ break; case 597: #line 2054 "src/p.y" /* yacc.c:1646 */ { mailset.events |= Event_Uptime; } #line 5752 "src/y.tab.c" /* yacc.c:1646 */ break; case 602: #line 2065 "src/p.y" /* yacc.c:1646 */ { mailset.from = (yyvsp[-1].address); } #line 5758 "src/y.tab.c" /* yacc.c:1646 */ break; case 603: #line 2066 "src/p.y" /* yacc.c:1646 */ { mailset.replyto = (yyvsp[-1].address); } #line 5764 "src/y.tab.c" /* yacc.c:1646 */ break; case 604: #line 2067 "src/p.y" /* yacc.c:1646 */ { mailset.subject = (yyvsp[0].string); } #line 5770 "src/y.tab.c" /* yacc.c:1646 */ break; case 605: #line 2068 "src/p.y" /* yacc.c:1646 */ { mailset.message = (yyvsp[0].string); } #line 5776 "src/y.tab.c" /* yacc.c:1646 */ break; case 606: #line 2071 "src/p.y" /* yacc.c:1646 */ { current->every.type = Every_SkipCycles; current->every.spec.cycle.counter = current->every.spec.cycle.number = (yyvsp[-1].number); } #line 5785 "src/y.tab.c" /* yacc.c:1646 */ break; case 607: #line 2075 "src/p.y" /* yacc.c:1646 */ { current->every.type = Every_Cron; current->every.spec.cron = (yyvsp[0].string); } #line 5794 "src/y.tab.c" /* yacc.c:1646 */ break; case 608: #line 2079 "src/p.y" /* yacc.c:1646 */ { current->every.type = Every_NotInCron; current->every.spec.cron = (yyvsp[0].string); } #line 5803 "src/y.tab.c" /* yacc.c:1646 */ break; case 609: #line 2085 "src/p.y" /* yacc.c:1646 */ { current->mode = Monitor_Active; } #line 5811 "src/y.tab.c" /* yacc.c:1646 */ break; case 610: #line 2088 "src/p.y" /* yacc.c:1646 */ { current->mode = Monitor_Passive; } #line 5819 "src/y.tab.c" /* yacc.c:1646 */ break; case 611: #line 2091 "src/p.y" /* yacc.c:1646 */ { // Deprecated since monit 5.18 current->onreboot = Onreboot_Laststate; } #line 5828 "src/y.tab.c" /* yacc.c:1646 */ break; case 612: #line 2097 "src/p.y" /* yacc.c:1646 */ { current->onreboot = Onreboot_Start; } #line 5836 "src/y.tab.c" /* yacc.c:1646 */ break; case 613: #line 2100 "src/p.y" /* yacc.c:1646 */ { current->onreboot = Onreboot_Nostart; current->monitor = Monitor_Not; } #line 5845 "src/y.tab.c" /* yacc.c:1646 */ break; case 614: #line 2104 "src/p.y" /* yacc.c:1646 */ { current->onreboot = Onreboot_Laststate; } #line 5853 "src/y.tab.c" /* yacc.c:1646 */ break; case 615: #line 2109 "src/p.y" /* yacc.c:1646 */ { addservicegroup((yyvsp[0].string)); FREE((yyvsp[0].string)); } #line 5862 "src/y.tab.c" /* yacc.c:1646 */ break; case 619: #line 2123 "src/p.y" /* yacc.c:1646 */ { adddependant((yyvsp[0].string)); } #line 5868 "src/y.tab.c" /* yacc.c:1646 */ break; case 620: #line 2126 "src/p.y" /* yacc.c:1646 */ { 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 5880 "src/y.tab.c" /* yacc.c:1646 */ break; case 621: #line 2133 "src/p.y" /* yacc.c:1646 */ { statusset.initialized = false; statusset.operator = Operator_Changed; statusset.return_value = 0; addeventaction(&(statusset).action, (yyvsp[0].number), Action_Ignored); addstatus(&statusset); } #line 5892 "src/y.tab.c" /* yacc.c:1646 */ break; case 622: #line 2142 "src/p.y" /* yacc.c:1646 */ { addeventaction(&(resourceset).action, (yyvsp[-1].number), (yyvsp[0].number)); addresource(&resourceset); } #line 5901 "src/y.tab.c" /* yacc.c:1646 */ break; case 632: #line 2161 "src/p.y" /* yacc.c:1646 */ { addeventaction(&(resourceset).action, (yyvsp[-1].number), (yyvsp[0].number)); addresource(&resourceset); } #line 5910 "src/y.tab.c" /* yacc.c:1646 */ break; case 639: #line 2177 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = Resource_CpuPercent; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real); } #line 5920 "src/y.tab.c" /* yacc.c:1646 */ break; case 640: #line 2182 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = Resource_CpuPercentTotal; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real); } #line 5930 "src/y.tab.c" /* yacc.c:1646 */ break; case 641: #line 2189 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = (yyvsp[-3].number); resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real); } #line 5940 "src/y.tab.c" /* yacc.c:1646 */ break; case 642: #line 2196 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Resource_CpuUser; } #line 5946 "src/y.tab.c" /* yacc.c:1646 */ break; case 643: #line 2197 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Resource_CpuSystem; } #line 5952 "src/y.tab.c" /* yacc.c:1646 */ break; case 644: #line 2198 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Resource_CpuWait; } #line 5958 "src/y.tab.c" /* yacc.c:1646 */ break; case 645: #line 2199 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Resource_CpuPercent; } #line 5964 "src/y.tab.c" /* yacc.c:1646 */ break; case 646: #line 2202 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = Resource_MemoryKbyte; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real) * (yyvsp[0].number); } #line 5974 "src/y.tab.c" /* yacc.c:1646 */ break; case 647: #line 2207 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = Resource_MemoryPercent; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real); } #line 5984 "src/y.tab.c" /* yacc.c:1646 */ break; case 648: #line 2214 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = Resource_MemoryKbyte; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real) * (yyvsp[0].number); } #line 5994 "src/y.tab.c" /* yacc.c:1646 */ break; case 649: #line 2219 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = Resource_MemoryPercent; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real); } #line 6004 "src/y.tab.c" /* yacc.c:1646 */ break; case 650: #line 2224 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = Resource_MemoryKbyteTotal; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real) * (yyvsp[0].number); } #line 6014 "src/y.tab.c" /* yacc.c:1646 */ break; case 651: #line 2229 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = Resource_MemoryPercentTotal; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real); } #line 6024 "src/y.tab.c" /* yacc.c:1646 */ break; case 652: #line 2236 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = Resource_SwapKbyte; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real) * (yyvsp[0].number); } #line 6034 "src/y.tab.c" /* yacc.c:1646 */ break; case 653: #line 2241 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = Resource_SwapPercent; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].real); } #line 6044 "src/y.tab.c" /* yacc.c:1646 */ break; case 654: #line 2248 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = Resource_Threads; resourceset.operator = (yyvsp[-1].number); resourceset.limit = (yyvsp[0].number); } #line 6054 "src/y.tab.c" /* yacc.c:1646 */ break; case 655: #line 2255 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = Resource_Children; resourceset.operator = (yyvsp[-1].number); resourceset.limit = (yyvsp[0].number); } #line 6064 "src/y.tab.c" /* yacc.c:1646 */ break; case 656: #line 2262 "src/p.y" /* yacc.c:1646 */ { 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 6087 "src/y.tab.c" /* yacc.c:1646 */ break; case 657: #line 2282 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Resource_LoadAverage1m; } #line 6093 "src/y.tab.c" /* yacc.c:1646 */ break; case 658: #line 2283 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Resource_LoadAverage5m; } #line 6099 "src/y.tab.c" /* yacc.c:1646 */ break; case 659: #line 2284 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Resource_LoadAverage15m; } #line 6105 "src/y.tab.c" /* yacc.c:1646 */ break; case 660: #line 2287 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = 1; } #line 6111 "src/y.tab.c" /* yacc.c:1646 */ break; case 661: #line 2288 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = systeminfo.cpu.count; } #line 6117 "src/y.tab.c" /* yacc.c:1646 */ break; case 662: #line 2292 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = Resource_ReadBytes; resourceset.operator = (yyvsp[-3].number); resourceset.limit = (yyvsp[-2].real) * (yyvsp[-1].number); } #line 6127 "src/y.tab.c" /* yacc.c:1646 */ break; case 663: #line 2297 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = Resource_ReadOperations; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].number); } #line 6137 "src/y.tab.c" /* yacc.c:1646 */ break; case 664: #line 2304 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = Resource_WriteBytes; resourceset.operator = (yyvsp[-3].number); resourceset.limit = (yyvsp[-2].real) * (yyvsp[-1].number); } #line 6147 "src/y.tab.c" /* yacc.c:1646 */ break; case 665: #line 2309 "src/p.y" /* yacc.c:1646 */ { resourceset.resource_id = Resource_WriteOperations; resourceset.operator = (yyvsp[-2].number); resourceset.limit = (yyvsp[-1].number); } #line 6157 "src/y.tab.c" /* yacc.c:1646 */ break; case 666: #line 2316 "src/p.y" /* yacc.c:1646 */ { (yyval.real) = (yyvsp[0].real); } #line 6163 "src/y.tab.c" /* yacc.c:1646 */ break; case 667: #line 2317 "src/p.y" /* yacc.c:1646 */ { (yyval.real) = (float) (yyvsp[0].number); } #line 6169 "src/y.tab.c" /* yacc.c:1646 */ break; case 668: #line 2320 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Timestamp_Default; } #line 6175 "src/y.tab.c" /* yacc.c:1646 */ break; case 669: #line 2321 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Timestamp_Access; } #line 6181 "src/y.tab.c" /* yacc.c:1646 */ break; case 670: #line 2322 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Timestamp_Change; } #line 6187 "src/y.tab.c" /* yacc.c:1646 */ break; case 671: #line 2323 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Timestamp_Modification; } #line 6193 "src/y.tab.c" /* yacc.c:1646 */ break; case 672: #line 2326 "src/p.y" /* yacc.c:1646 */ { 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 6205 "src/y.tab.c" /* yacc.c:1646 */ break; case 673: #line 2333 "src/p.y" /* yacc.c:1646 */ { timestampset.type = (yyvsp[-3].number); timestampset.test_changes = true; addeventaction(&(timestampset).action, (yyvsp[0].number), Action_Ignored); addtimestamp(×tampset); } #line 6216 "src/y.tab.c" /* yacc.c:1646 */ break; case 674: #line 2341 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Operator_Equal; } #line 6222 "src/y.tab.c" /* yacc.c:1646 */ break; case 675: #line 2342 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Operator_Greater; } #line 6228 "src/y.tab.c" /* yacc.c:1646 */ break; case 676: #line 2343 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Operator_GreaterOrEqual; } #line 6234 "src/y.tab.c" /* yacc.c:1646 */ break; case 677: #line 2344 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Operator_Less; } #line 6240 "src/y.tab.c" /* yacc.c:1646 */ break; case 678: #line 2345 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Operator_LessOrEqual; } #line 6246 "src/y.tab.c" /* yacc.c:1646 */ break; case 679: #line 2346 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Operator_Equal; } #line 6252 "src/y.tab.c" /* yacc.c:1646 */ break; case 680: #line 2347 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Operator_NotEqual; } #line 6258 "src/y.tab.c" /* yacc.c:1646 */ break; case 681: #line 2348 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Operator_Changed; } #line 6264 "src/y.tab.c" /* yacc.c:1646 */ break; case 682: #line 2351 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Time_Second; } #line 6270 "src/y.tab.c" /* yacc.c:1646 */ break; case 683: #line 2352 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Time_Second; } #line 6276 "src/y.tab.c" /* yacc.c:1646 */ break; case 684: #line 2353 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Time_Minute; } #line 6282 "src/y.tab.c" /* yacc.c:1646 */ break; case 685: #line 2354 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Time_Hour; } #line 6288 "src/y.tab.c" /* yacc.c:1646 */ break; case 686: #line 2355 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Time_Day; } #line 6294 "src/y.tab.c" /* yacc.c:1646 */ break; case 687: #line 2356 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Time_Month; } #line 6300 "src/y.tab.c" /* yacc.c:1646 */ break; case 688: #line 2359 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Time_Minute; } #line 6306 "src/y.tab.c" /* yacc.c:1646 */ break; case 689: #line 2360 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Time_Hour; } #line 6312 "src/y.tab.c" /* yacc.c:1646 */ break; case 690: #line 2361 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Time_Day; } #line 6318 "src/y.tab.c" /* yacc.c:1646 */ break; case 691: #line 2363 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Time_Second; } #line 6324 "src/y.tab.c" /* yacc.c:1646 */ break; case 692: #line 2364 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Time_Second; } #line 6330 "src/y.tab.c" /* yacc.c:1646 */ break; case 693: #line 2366 "src/p.y" /* yacc.c:1646 */ { repeat = 0; } #line 6338 "src/y.tab.c" /* yacc.c:1646 */ break; case 694: #line 2369 "src/p.y" /* yacc.c:1646 */ { repeat = 1; } #line 6346 "src/y.tab.c" /* yacc.c:1646 */ break; case 695: #line 2372 "src/p.y" /* yacc.c:1646 */ { if ((yyvsp[-1].number) < 0) { yyerror2("The number of repeat cycles must be greater or equal to 0"); } repeat = (yyvsp[-1].number); } #line 6357 "src/y.tab.c" /* yacc.c:1646 */ break; case 696: #line 2380 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Action_Alert; } #line 6365 "src/y.tab.c" /* yacc.c:1646 */ break; case 697: #line 2383 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Action_Exec; } #line 6373 "src/y.tab.c" /* yacc.c:1646 */ break; case 698: #line 2387 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Action_Exec; } #line 6381 "src/y.tab.c" /* yacc.c:1646 */ break; case 699: #line 2390 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Action_Restart; } #line 6389 "src/y.tab.c" /* yacc.c:1646 */ break; case 700: #line 2393 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Action_Start; } #line 6397 "src/y.tab.c" /* yacc.c:1646 */ break; case 701: #line 2396 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Action_Stop; } #line 6405 "src/y.tab.c" /* yacc.c:1646 */ break; case 702: #line 2399 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Action_Unmonitor; } #line 6413 "src/y.tab.c" /* yacc.c:1646 */ break; case 703: #line 2404 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = (yyvsp[0].number); if ((yyvsp[0].number) == Action_Exec && command) { repeat1 = repeat; repeat = 0; command1 = command; command = NULL; } } #line 6427 "src/y.tab.c" /* yacc.c:1646 */ break; case 704: #line 2415 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = (yyvsp[0].number); if ((yyvsp[0].number) == Action_Exec && command) { repeat2 = repeat; repeat = 0; command2 = command; command = NULL; } } #line 6441 "src/y.tab.c" /* yacc.c:1646 */ break; case 705: #line 2426 "src/p.y" /* yacc.c:1646 */ { if ((yyvsp[-1].number) < 1 || (yyvsp[-1].number) > BITMAP_MAX) { yyerror2("The number of cycles must be between 1 and %d", BITMAP_MAX); } else { rate.count = (yyvsp[-1].number); rate.cycles = (yyvsp[-1].number); } } #line 6454 "src/y.tab.c" /* yacc.c:1646 */ break; case 706: #line 2436 "src/p.y" /* yacc.c:1646 */ { if ((yyvsp[-1].number) < 1 || (yyvsp[-1].number) > BITMAP_MAX) { yyerror2("The number of cycles must be between 1 and %d", 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 6469 "src/y.tab.c" /* yacc.c:1646 */ break; case 708: #line 2449 "src/p.y" /* yacc.c:1646 */ { rate1.count = rate.count; rate1.cycles = rate.cycles; reset_rateset(&rate); } #line 6479 "src/y.tab.c" /* yacc.c:1646 */ break; case 709: #line 2454 "src/p.y" /* yacc.c:1646 */ { rate1.count = rate.count; rate1.cycles = rate.cycles; reset_rateset(&rate); } #line 6489 "src/y.tab.c" /* yacc.c:1646 */ break; case 711: #line 2462 "src/p.y" /* yacc.c:1646 */ { rate2.count = rate.count; rate2.cycles = rate.cycles; reset_rateset(&rate); } #line 6499 "src/y.tab.c" /* yacc.c:1646 */ break; case 712: #line 2467 "src/p.y" /* yacc.c:1646 */ { rate2.count = rate.count; rate2.cycles = rate.cycles; reset_rateset(&rate); } #line 6509 "src/y.tab.c" /* yacc.c:1646 */ break; case 713: #line 2474 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Action_Alert; } #line 6517 "src/y.tab.c" /* yacc.c:1646 */ break; case 714: #line 2477 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = (yyvsp[0].number); } #line 6525 "src/y.tab.c" /* yacc.c:1646 */ break; case 715: #line 2480 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = (yyvsp[0].number); } #line 6533 "src/y.tab.c" /* yacc.c:1646 */ break; case 716: #line 2483 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = (yyvsp[0].number); } #line 6541 "src/y.tab.c" /* yacc.c:1646 */ break; case 717: #line 2488 "src/p.y" /* yacc.c:1646 */ { addeventaction(&(checksumset).action, (yyvsp[-1].number), (yyvsp[0].number)); addchecksum(&checksumset); } #line 6550 "src/y.tab.c" /* yacc.c:1646 */ break; case 718: #line 2493 "src/p.y" /* yacc.c:1646 */ { 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 6561 "src/y.tab.c" /* yacc.c:1646 */ break; case 719: #line 2499 "src/p.y" /* yacc.c:1646 */ { checksumset.test_changes = true; addeventaction(&(checksumset).action, (yyvsp[0].number), Action_Ignored); addchecksum(&checksumset); } #line 6571 "src/y.tab.c" /* yacc.c:1646 */ break; case 720: #line 2505 "src/p.y" /* yacc.c:1646 */ { checksumset.type = Hash_Unknown; } #line 6577 "src/y.tab.c" /* yacc.c:1646 */ break; case 721: #line 2506 "src/p.y" /* yacc.c:1646 */ { checksumset.type = Hash_Md5; } #line 6583 "src/y.tab.c" /* yacc.c:1646 */ break; case 722: #line 2507 "src/p.y" /* yacc.c:1646 */ { checksumset.type = Hash_Sha1; } #line 6589 "src/y.tab.c" /* yacc.c:1646 */ break; case 723: #line 2510 "src/p.y" /* yacc.c:1646 */ { 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 6601 "src/y.tab.c" /* yacc.c:1646 */ break; case 724: #line 2517 "src/p.y" /* yacc.c:1646 */ { 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 6613 "src/y.tab.c" /* yacc.c:1646 */ break; case 725: #line 2524 "src/p.y" /* yacc.c:1646 */ { 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 6625 "src/y.tab.c" /* yacc.c:1646 */ break; case 726: #line 2531 "src/p.y" /* yacc.c:1646 */ { 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 6637 "src/y.tab.c" /* yacc.c:1646 */ break; case 727: #line 2540 "src/p.y" /* yacc.c:1646 */ { 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 6649 "src/y.tab.c" /* yacc.c:1646 */ break; case 728: #line 2547 "src/p.y" /* yacc.c:1646 */ { 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 6661 "src/y.tab.c" /* yacc.c:1646 */ break; case 729: #line 2554 "src/p.y" /* yacc.c:1646 */ { 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 6673 "src/y.tab.c" /* yacc.c:1646 */ break; case 730: #line 2561 "src/p.y" /* yacc.c:1646 */ { 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 6685 "src/y.tab.c" /* yacc.c:1646 */ break; case 731: #line 2570 "src/p.y" /* yacc.c:1646 */ { 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 6697 "src/y.tab.c" /* yacc.c:1646 */ break; case 732: #line 2577 "src/p.y" /* yacc.c:1646 */ { 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 6709 "src/y.tab.c" /* yacc.c:1646 */ break; case 733: #line 2586 "src/p.y" /* yacc.c:1646 */ { 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 6721 "src/y.tab.c" /* yacc.c:1646 */ break; case 734: #line 2593 "src/p.y" /* yacc.c:1646 */ { 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 6733 "src/y.tab.c" /* yacc.c:1646 */ break; case 735: #line 2602 "src/p.y" /* yacc.c:1646 */ { 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 6745 "src/y.tab.c" /* yacc.c:1646 */ break; case 736: #line 2609 "src/p.y" /* yacc.c:1646 */ { 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 6757 "src/y.tab.c" /* yacc.c:1646 */ break; case 737: #line 2618 "src/p.y" /* yacc.c:1646 */ { addeventaction(&(fsflagset).action, (yyvsp[0].number), Action_Ignored); addfsflag(&fsflagset); } #line 6766 "src/y.tab.c" /* yacc.c:1646 */ break; case 738: #line 2624 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Unit_Byte; } #line 6772 "src/y.tab.c" /* yacc.c:1646 */ break; case 739: #line 2625 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Unit_Byte; } #line 6778 "src/y.tab.c" /* yacc.c:1646 */ break; case 740: #line 2626 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Unit_Kilobyte; } #line 6784 "src/y.tab.c" /* yacc.c:1646 */ break; case 741: #line 2627 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Unit_Megabyte; } #line 6790 "src/y.tab.c" /* yacc.c:1646 */ break; case 742: #line 2628 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = Unit_Gigabyte; } #line 6796 "src/y.tab.c" /* yacc.c:1646 */ break; case 743: #line 2631 "src/p.y" /* yacc.c:1646 */ { permset.perm = check_perm((yyvsp[-4].number)); addeventaction(&(permset).action, (yyvsp[-1].number), (yyvsp[0].number)); addperm(&permset); } #line 6806 "src/y.tab.c" /* yacc.c:1646 */ break; case 744: #line 2636 "src/p.y" /* yacc.c:1646 */ { permset.test_changes = true; addeventaction(&(permset).action, (yyvsp[-1].number), Action_Ignored); addperm(&permset); } #line 6816 "src/y.tab.c" /* yacc.c:1646 */ break; case 745: #line 2643 "src/p.y" /* yacc.c:1646 */ { 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 6829 "src/y.tab.c" /* yacc.c:1646 */ break; case 746: #line 2651 "src/p.y" /* yacc.c:1646 */ { 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 6841 "src/y.tab.c" /* yacc.c:1646 */ break; case 747: #line 2658 "src/p.y" /* yacc.c:1646 */ { 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 6854 "src/y.tab.c" /* yacc.c:1646 */ break; case 748: #line 2666 "src/p.y" /* yacc.c:1646 */ { 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 6866 "src/y.tab.c" /* yacc.c:1646 */ break; case 749: #line 2674 "src/p.y" /* yacc.c:1646 */ { matchset.ignore = false; matchset.match_path = (yyvsp[-3].string); matchset.match_string = NULL; addmatchpath(&matchset, (yyvsp[0].number)); FREE((yyvsp[-3].string)); } #line 6878 "src/y.tab.c" /* yacc.c:1646 */ break; case 750: #line 2681 "src/p.y" /* yacc.c:1646 */ { matchset.ignore = false; matchset.match_path = NULL; matchset.match_string = (yyvsp[-3].string); addmatch(&matchset, (yyvsp[0].number), 0); } #line 6889 "src/y.tab.c" /* yacc.c:1646 */ break; case 751: #line 2687 "src/p.y" /* yacc.c:1646 */ { matchset.ignore = true; matchset.match_path = (yyvsp[0].string); matchset.match_string = NULL; addmatchpath(&matchset, Action_Ignored); FREE((yyvsp[0].string)); } #line 6901 "src/y.tab.c" /* yacc.c:1646 */ break; case 752: #line 2694 "src/p.y" /* yacc.c:1646 */ { matchset.ignore = true; matchset.match_path = NULL; matchset.match_string = (yyvsp[0].string); addmatch(&matchset, Action_Ignored, 0); } #line 6912 "src/y.tab.c" /* yacc.c:1646 */ break; case 753: #line 2702 "src/p.y" /* yacc.c:1646 */ { matchset.not = false; } #line 6920 "src/y.tab.c" /* yacc.c:1646 */ break; case 754: #line 2705 "src/p.y" /* yacc.c:1646 */ { matchset.not = true; } #line 6928 "src/y.tab.c" /* yacc.c:1646 */ break; case 755: #line 2711 "src/p.y" /* yacc.c:1646 */ { 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 6939 "src/y.tab.c" /* yacc.c:1646 */ break; case 756: #line 2717 "src/p.y" /* yacc.c:1646 */ { sizeset.test_changes = true; addeventaction(&(sizeset).action, (yyvsp[0].number), Action_Ignored); addsize(&sizeset); } #line 6949 "src/y.tab.c" /* yacc.c:1646 */ break; case 757: #line 2724 "src/p.y" /* yacc.c:1646 */ { 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 6960 "src/y.tab.c" /* yacc.c:1646 */ break; case 758: #line 2730 "src/p.y" /* yacc.c:1646 */ { uidset.uid = get_uid(NULL, (yyvsp[-4].number)); addeventaction(&(uidset).action, (yyvsp[-1].number), (yyvsp[0].number)); current->uid = adduid(&uidset); } #line 6970 "src/y.tab.c" /* yacc.c:1646 */ break; case 759: #line 2737 "src/p.y" /* yacc.c:1646 */ { 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 6981 "src/y.tab.c" /* yacc.c:1646 */ break; case 760: #line 2743 "src/p.y" /* yacc.c:1646 */ { uidset.uid = get_uid(NULL, (yyvsp[-4].number)); addeventaction(&(uidset).action, (yyvsp[-1].number), (yyvsp[0].number)); current->euid = adduid(&uidset); } #line 6991 "src/y.tab.c" /* yacc.c:1646 */ break; case 761: #line 2750 "src/p.y" /* yacc.c:1646 */ { addsecurityattribute((yyvsp[-4].string), (yyvsp[-1].number), (yyvsp[0].number)); } #line 6999 "src/y.tab.c" /* yacc.c:1646 */ break; case 762: #line 2753 "src/p.y" /* yacc.c:1646 */ { addsecurityattribute((yyvsp[-4].string), (yyvsp[-1].number), (yyvsp[0].number)); } #line 7007 "src/y.tab.c" /* yacc.c:1646 */ break; case 763: #line 2758 "src/p.y" /* yacc.c:1646 */ { 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 7018 "src/y.tab.c" /* yacc.c:1646 */ break; case 764: #line 2764 "src/p.y" /* yacc.c:1646 */ { gidset.gid = get_gid(NULL, (yyvsp[-4].number)); addeventaction(&(gidset).action, (yyvsp[-1].number), (yyvsp[0].number)); current->gid = addgid(&gidset); } #line 7028 "src/y.tab.c" /* yacc.c:1646 */ break; case 765: #line 2771 "src/p.y" /* yacc.c:1646 */ { addeventaction(&(linkstatusset).action, (yyvsp[-1].number), (yyvsp[0].number)); addlinkstatus(current, &linkstatusset); } #line 7037 "src/y.tab.c" /* yacc.c:1646 */ break; case 766: #line 2777 "src/p.y" /* yacc.c:1646 */ { addeventaction(&(linkspeedset).action, (yyvsp[-1].number), (yyvsp[0].number)); addlinkspeed(current, &linkspeedset); } #line 7046 "src/y.tab.c" /* yacc.c:1646 */ break; case 767: #line 2782 "src/p.y" /* yacc.c:1646 */ { 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 7057 "src/y.tab.c" /* yacc.c:1646 */ break; case 768: #line 2790 "src/p.y" /* yacc.c:1646 */ { 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 7070 "src/y.tab.c" /* yacc.c:1646 */ break; case 769: #line 2798 "src/p.y" /* yacc.c:1646 */ { 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 7083 "src/y.tab.c" /* yacc.c:1646 */ break; case 770: #line 2806 "src/p.y" /* yacc.c:1646 */ { 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 7096 "src/y.tab.c" /* yacc.c:1646 */ break; case 771: #line 2814 "src/p.y" /* yacc.c:1646 */ { 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 7109 "src/y.tab.c" /* yacc.c:1646 */ break; case 772: #line 2822 "src/p.y" /* yacc.c:1646 */ { 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 7122 "src/y.tab.c" /* yacc.c:1646 */ break; case 773: #line 2830 "src/p.y" /* yacc.c:1646 */ { 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 7135 "src/y.tab.c" /* yacc.c:1646 */ break; case 774: #line 2840 "src/p.y" /* yacc.c:1646 */ { 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 7148 "src/y.tab.c" /* yacc.c:1646 */ break; case 775: #line 2848 "src/p.y" /* yacc.c:1646 */ { 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 7161 "src/y.tab.c" /* yacc.c:1646 */ break; case 776: #line 2856 "src/p.y" /* yacc.c:1646 */ { 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 7174 "src/y.tab.c" /* yacc.c:1646 */ break; case 777: #line 2864 "src/p.y" /* yacc.c:1646 */ { 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 7187 "src/y.tab.c" /* yacc.c:1646 */ break; case 778: #line 2872 "src/p.y" /* yacc.c:1646 */ { 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 7200 "src/y.tab.c" /* yacc.c:1646 */ break; case 779: #line 2880 "src/p.y" /* yacc.c:1646 */ { 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 7213 "src/y.tab.c" /* yacc.c:1646 */ break; case 780: #line 2890 "src/p.y" /* yacc.c:1646 */ { (yyval.number) = ICMP_ECHO; } #line 7219 "src/y.tab.c" /* yacc.c:1646 */ break; case 781: #line 2893 "src/p.y" /* yacc.c:1646 */ { mailset.reminder = 0; } #line 7225 "src/y.tab.c" /* yacc.c:1646 */ break; case 782: #line 2894 "src/p.y" /* yacc.c:1646 */ { mailset.reminder = (yyvsp[0].number); } #line 7231 "src/y.tab.c" /* yacc.c:1646 */ break; case 783: #line 2895 "src/p.y" /* yacc.c:1646 */ { mailset.reminder = (yyvsp[-1].number); } #line 7237 "src/y.tab.c" /* yacc.c:1646 */ break; #line 7241 "src/y.tab.c" /* yacc.c:1646 */ 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 ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++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. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; 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 ? YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) { char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; yysyntax_error_status = YYSYNTAX_ERROR; if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == 1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); if (!yymsg) { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = 2; } else { yysyntax_error_status = YYSYNTAX_ERROR; yymsgp = yymsg; } } yyerror (yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } # undef YYSYNTAX_ERROR #endif } 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 like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* 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. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { 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", yystos[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", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: 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", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif return yyresult; } #line 2898 "src/p.y" /* yacc.c:1906 */ /* -------------------------------------------------------- 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); LogError("%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); LogWarning("%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); LogError("%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); LogWarning("%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 */ boolean_t parse(char *controlfile) { ASSERT(controlfile); if ((yyin = fopen(controlfile,"r")) == (FILE *)NULL) { LogError("Cannot open the control file '%s' -- %s\n", controlfile, STRERROR); return false; } currentfile = Str_dup(controlfile); /* * 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() { servicelist = 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.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_mailset(); reset_sslset(); reset_mailserverset(); reset_mmonitset(); 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() { if (cfg_errflag) return; /* If defined - add the last service to the service list */ if (current) addservice(current); /* Check that we do not start monit in daemon mode without having a poll time */ if (! Run.polltime && ((Run.flags & Run_Daemon) || (Run.flags & Run_Foreground))) { LogError("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))) { LogError("Cannot get system hostname -- please add 'check system '\n"); cfg_errflag++; } if (Util_existService(hostname)) { LogError("'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) LogWarning("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) { LogWarning("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 { LogWarning("M/Monit enabled but no httpd allowed -- please add 'set httpd' statement\n"); } } /* Check the sanity of any dependency graph */ check_depend(); #ifdef HAVE_OPENSSL Ssl_setFipsMode(Run.flags & Run_FipsEnabled); #endif Processor_setHttpPostLimit(); } static boolean_t _parseOutgoingAddress(const 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 = (char *)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 -- %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->mode = Monitor_Active; current->monitor = Monitor_Init; current->onreboot = Run.onreboot; current->name = name; current->name_escaped = Util_urlEncode(name, false); 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 servicelist */ 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) { LogError("'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) { LogError("'check program %s' is incomplete: Please add an 'if status != n' test\n", s->name); cfg_errflag++; } // Create the Command object char program[PATH_MAX]; strncpy(program, s->program->args->arg[0], sizeof(program) - 1); 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); 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; } /* Add the service to the end of the service list */ if (tail != NULL) { tail->next = s; tail->next_conf = s; } else { servicelist = s; servicelist_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 = servicegrouplist; 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 = servicegrouplist; servicegrouplist = g; } List_append(g->members, current); } /* * 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_escaped = Util_urlEncode(dependant, false); 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->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 == 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"); } } } p->next = *list; *list = p; reset_sslset(); reset_portset(); } static void addhttpheader(Port_T port, const 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, (char *)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 comparision, 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 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 (! (Util_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; NEW(l); 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 parsing error: %s on line %i of", errbuf, linenumber); else yyerror2("Regex parsing error: %s", 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 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->is_available = Connection_Init; icmp->response = -1; icmp->next = current->icmplist; current->icmplist = icmp; 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 timeout) { switch (what) { case START: current->start = command; break; case STOP: current->stop = command; break; case RESTART: current->restart = command; break; } command->timeout = timeout; command = NULL; } /* * Add a new argument to the argument list */ static void addargument(char *argument) { ASSERT(argument); if (! command) { NEW(command); check_exec(argument); } command->arg[command->length++] = argument; command->arg[command->length] = NULL; if (command->length >= ARGMAX) yyerror("Exceeded maximum number of program arguments"); } /* * 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->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; } /* * 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; ASSERT(filename); handle = fopen(filename, "r"); if (handle == NULL) { if (username != NULL) yyerror2("Cannot read htpasswd (%s)", filename); else yyerror2("Cannot read htpasswd", 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 boolean_t addcredentials(char *uname, char *passwd, Digest_Type dtype, boolean_t readonly) { Auth_T c; ASSERT(uname); ASSERT(passwd); if (strlen(passwd) > MAX_CONSTANT_TIME_STRING_LENGTH) { yyerror2("Password for user %s is too long, maximum %d allowed", uname, MAX_CONSTANT_TIME_STRING_LENGTH); FREE(uname); FREE(passwd); return false; } 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 yyerror2("Invalid syslog facility"); } else { Run.facility = LOG_USER; } } /* * Reset the current sslset for reuse */ static void reset_sslset() { memset(&sslset, 0, sizeof(struct SslOptions_T)); sslset.version = sslset.verify = sslset.allowSelfSigned = -1; } /* * Reset the current mailset for reuse */ static void reset_mailset() { memset(&mailset, 0, sizeof(struct Mail_T)); } /* * Reset the mailserver set to default values */ static void reset_mailserverset() { memset(&mailserverset, 0, sizeof(struct MailServer_T)); mailserverset.port = PORT_SMTP; } /* * Reset the mmonit set to default values */ static void reset_mmonitset() { memset(&mmonitset, 0, sizeof(struct Mmonit_T)); mmonitset.timeout = Run.limits.networkTimeout; } /* * Reset the Port set to default values */ static void reset_portset() { memset(&portset, 0, sizeof(struct Port_T)); 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() { 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() { 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() { actionrateset.count = 0; actionrateset.cycle = 0; actionrateset.action = NULL; } /* * Reset the Size set to default values */ static void reset_sizeset() { sizeset.operator = Operator_Equal; sizeset.size = 0; sizeset.test_changes = false; sizeset.action = NULL; } /* * Reset the Uptime set to default values */ static void reset_uptimeset() { uptimeset.operator = Operator_Equal; uptimeset.uptime = 0; uptimeset.action = NULL; } static void reset_linkstatusset() { linkstatusset.action = NULL; } static void reset_linkspeedset() { linkspeedset.action = NULL; } static void reset_linksaturationset() { linksaturationset.limit = 0.; linksaturationset.operator = Operator_Equal; linksaturationset.action = NULL; } /* * Reset the Bandwidth set to default values */ static void reset_bandwidthset() { bandwidthset.operator = Operator_Equal; bandwidthset.limit = 0ULL; bandwidthset.action = NULL; } /* * Reset the Pid set to default values */ static void reset_pidset() { pidset.action = NULL; } /* * Reset the PPid set to default values */ static void reset_ppidset() { ppidset.action = NULL; } /* * Reset the Fsflag set to default values */ static void reset_fsflagset() { fsflagset.action = NULL; } /* * Reset the Nonexist set to default values */ static void reset_nonexistset() { nonexistset.action = NULL; } static void reset_existset() { existset.action = NULL; } /* * Reset the Checksum set to default values */ static void reset_checksumset() { 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() { permset.test_changes = false; permset.perm = 0; permset.action = NULL; } /* * Reset the Status set to default values */ static void reset_statusset() { 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() { uidset.uid = 0; uidset.action = NULL; } /* * Reset the Gid set to default values */ static void reset_gidset() { gidset.gid = 0; gidset.action = NULL; } /* * Reset the Filesystem set to default values */ static void reset_filesystemset() { 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() { icmpset.type = ICMP_ECHO; icmpset.size = ICMP_SIZE; icmpset.count = ICMP_ATTEMPT_COUNT; icmpset.timeout = Run.limits.networkTimeout; icmpset.action = NULL; } /* * 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() { Service_T depends_on = NULL; Service_T* dlt = &depend_list; /* the current tail of it */ boolean_t done; /* no unvisited nodes left? */ boolean_t found_some; /* last iteration found anything new ? */ depend_list = NULL; /* depend_list will be the topological sorted servicelist */ do { done = true; found_some = false; for (Service_T s = servicelist; 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) { LogError("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); LogError("Found a depend loop in the control file involving the service '%s'\n", depends_on->name); exit(1); } ASSERT(depend_list); servicelist = depend_list; for (Service_T s = depend_list; s; s = s->next_depend) s->next = s->next_depend; } /* * Check if the executable 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 unitialized (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, boolean_t isFile) { if (*store) { yyerror2("Duplicate %s", description); } else if (! File_exist(path)) { yyerror2("%s doesn't exist", description); } else if (! (isFile ? File_isFile(path) : File_isDirectory(path))) { yyerror2("%s is not a %s", description, isFile ? "file" : "directory"); } else if (! File_isReadable(path)) { yyerror2("Cannot read %s", description); } 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->verify = sslset.verify; options->version = sslset.version; reset_sslset(); } 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; } monit-5.26.0/src/file.c0000664000175000017500000002324413507751326014532 0ustar martinpmartinp/* * 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() { 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() { Engine_cleanup(); unlink(Run.files.pid); } char *file_findControlFile() { 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; } LogError("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); } boolean_t file_createPidFile(char *pidfile) { ASSERT(pidfile); unlink(pidfile); FILE *F = fopen(pidfile, "w"); if (! F) { LogError("Error opening pidfile '%s' for writing -- %s\n", pidfile, STRERROR); return false; } fprintf(F, "%d\n", (int)getpid()); fclose(F); return true; } boolean_t file_checkStat(char *filename, char *description, int permmask) { ASSERT(filename); ASSERT(description); errno = 0; struct stat buf; if (stat(filename, &buf) < 0) { LogError("Cannot stat the %s '%s' -- %s\n", description, filename, STRERROR); return false; } if (! S_ISREG(buf.st_mode)) { LogError("The %s '%s' is not a regular file.\n", description, filename); return false; } if (buf.st_uid != geteuid()) { LogError("The %s '%s' must be owned by you.\n", description, filename); return false; } if ((buf.st_mode & 0777) & ~permmask) { LogError("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; } boolean_t file_checkQueueDirectory(char *path) { if (mkdir(path, 0700) < 0 && errno != EEXIST) { LogError("Cannot create the event queue directory '%s' -- %s\n", path, STRERROR); return false; } return true; } boolean_t file_checkQueueLimit(char *path, int limit) { if (limit >= 0) { DIR *dir = opendir(path); if (! dir) { LogError("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) { LogError("Event queue is full\n"); closedir(dir); return false; } } closedir(dir); } return true; } boolean_t file_writeQueue(FILE *file, 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)) LogError("Queued event file: unable to write event size -- %s\n", feof(file) ? "end of file" : "stream error"); else LogError("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)) LogError("Queued event file: unable to write event size -- %s\n", feof(file) ? "end of file" : "stream error"); else LogError("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)) LogError("Queued event file: unable to read event size -- %s\n", feof(file) ? "end of file" : "stream error"); else LogError("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)) LogError("Queued event file: unable to read event data -- %s\n", feof(file) ? "end of file" : "stream error"); else LogError("Queued event file: unable to read event data -- read returned %lu bytes\n", (unsigned long)rv); return NULL; } } return data; } boolean_t file_readProc(char *buf, int buf_size, 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) { DEBUG("Cannot open proc file '%s' -- %s\n", filename, STRERROR); return false; } boolean_t 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) LogError("Failed to close proc file '%s' -- %s\n", filename, STRERROR); return rv; } monit-5.26.0/src/md5.h0000664000175000017500000000614713507751326014310 0ustar martinpmartinp/* 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.26.0/src/tokens.h0000664000175000017500000003157413507751355015132 0ustar martinpmartinp/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2015 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. */ #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 type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { IF = 258, ELSE = 259, THEN = 260, FAILED = 261, SET = 262, LOGFILE = 263, FACILITY = 264, DAEMON = 265, SYSLOG = 266, MAILSERVER = 267, HTTPD = 268, ALLOW = 269, REJECTOPT = 270, ADDRESS = 271, INIT = 272, TERMINAL = 273, BATCH = 274, READONLY = 275, CLEARTEXT = 276, MD5HASH = 277, SHA1HASH = 278, CRYPT = 279, DELAY = 280, PEMFILE = 281, ENABLE = 282, DISABLE = 283, SSL = 284, CIPHER = 285, CLIENTPEMFILE = 286, ALLOWSELFCERTIFICATION = 287, SELFSIGNED = 288, VERIFY = 289, CERTIFICATE = 290, CACERTIFICATEFILE = 291, CACERTIFICATEPATH = 292, VALID = 293, INTERFACE = 294, LINK = 295, PACKET = 296, BYTEIN = 297, BYTEOUT = 298, PACKETIN = 299, PACKETOUT = 300, SPEED = 301, SATURATION = 302, UPLOAD = 303, DOWNLOAD = 304, TOTAL = 305, IDFILE = 306, STATEFILE = 307, SEND = 308, EXPECT = 309, CYCLE = 310, COUNT = 311, REMINDER = 312, REPEAT = 313, LIMITS = 314, SENDEXPECTBUFFER = 315, EXPECTBUFFER = 316, FILECONTENTBUFFER = 317, HTTPCONTENTBUFFER = 318, PROGRAMOUTPUT = 319, NETWORKTIMEOUT = 320, PROGRAMTIMEOUT = 321, STARTTIMEOUT = 322, STOPTIMEOUT = 323, RESTARTTIMEOUT = 324, PIDFILE = 325, START = 326, STOP = 327, PATHTOK = 328, HOST = 329, HOSTNAME = 330, PORT = 331, IPV4 = 332, IPV6 = 333, TYPE = 334, UDP = 335, TCP = 336, TCPSSL = 337, PROTOCOL = 338, CONNECTION = 339, ALERT = 340, NOALERT = 341, MAILFORMAT = 342, UNIXSOCKET = 343, SIGNATURE = 344, TIMEOUT = 345, RETRY = 346, RESTART = 347, CHECKSUM = 348, EVERY = 349, NOTEVERY = 350, DEFAULT = 351, HTTP = 352, HTTPS = 353, APACHESTATUS = 354, FTP = 355, SMTP = 356, SMTPS = 357, POP = 358, POPS = 359, IMAP = 360, IMAPS = 361, CLAMAV = 362, NNTP = 363, NTP3 = 364, MYSQL = 365, DNS = 366, WEBSOCKET = 367, MQTT = 368, SSH = 369, DWP = 370, LDAP2 = 371, LDAP3 = 372, RDATE = 373, RSYNC = 374, TNS = 375, PGSQL = 376, POSTFIXPOLICY = 377, SIP = 378, LMTP = 379, GPS = 380, RADIUS = 381, MEMCACHE = 382, REDIS = 383, MONGODB = 384, SIEVE = 385, SPAMASSASSIN = 386, FAIL2BAN = 387, STRING = 388, PATH = 389, MAILADDR = 390, MAILFROM = 391, MAILREPLYTO = 392, MAILSUBJECT = 393, MAILBODY = 394, SERVICENAME = 395, STRINGNAME = 396, NUMBER = 397, PERCENT = 398, LOGLIMIT = 399, CLOSELIMIT = 400, DNSLIMIT = 401, KEEPALIVELIMIT = 402, REPLYLIMIT = 403, REQUESTLIMIT = 404, STARTLIMIT = 405, WAITLIMIT = 406, GRACEFULLIMIT = 407, CLEANUPLIMIT = 408, REAL = 409, CHECKPROC = 410, CHECKFILESYS = 411, CHECKFILE = 412, CHECKDIR = 413, CHECKHOST = 414, CHECKSYSTEM = 415, CHECKFIFO = 416, CHECKPROGRAM = 417, CHECKNET = 418, THREADS = 419, CHILDREN = 420, METHOD = 421, GET = 422, HEAD = 423, STATUS = 424, ORIGIN = 425, VERSIONOPT = 426, READ = 427, WRITE = 428, OPERATION = 429, SERVICETIME = 430, DISK = 431, RESOURCE = 432, MEMORY = 433, TOTALMEMORY = 434, LOADAVG1 = 435, LOADAVG5 = 436, LOADAVG15 = 437, SWAP = 438, MODE = 439, ACTIVE = 440, PASSIVE = 441, MANUAL = 442, ONREBOOT = 443, NOSTART = 444, LASTSTATE = 445, CORE = 446, CPU = 447, TOTALCPU = 448, CPUUSER = 449, CPUSYSTEM = 450, CPUWAIT = 451, GROUP = 452, REQUEST = 453, DEPENDS = 454, BASEDIR = 455, SLOT = 456, EVENTQUEUE = 457, SECRET = 458, HOSTHEADER = 459, UID = 460, EUID = 461, GID = 462, MMONIT = 463, INSTANCE = 464, USERNAME = 465, PASSWORD = 466, TIME = 467, ATIME = 468, CTIME = 469, MTIME = 470, CHANGED = 471, MILLISECOND = 472, SECOND = 473, MINUTE = 474, HOUR = 475, DAY = 476, MONTH = 477, SSLAUTO = 478, SSLV2 = 479, SSLV3 = 480, TLSV1 = 481, TLSV11 = 482, TLSV12 = 483, TLSV13 = 484, CERTMD5 = 485, AUTO = 486, BYTE = 487, KILOBYTE = 488, MEGABYTE = 489, GIGABYTE = 490, INODE = 491, SPACE = 492, TFREE = 493, PERMISSION = 494, SIZE = 495, MATCH = 496, NOT = 497, IGNORE = 498, ACTION = 499, UPTIME = 500, EXEC = 501, UNMONITOR = 502, PING = 503, PING4 = 504, PING6 = 505, ICMP = 506, ICMPECHO = 507, NONEXIST = 508, EXIST = 509, INVALID = 510, DATA = 511, RECOVERED = 512, PASSED = 513, SUCCEEDED = 514, URL = 515, CONTENT = 516, PID = 517, PPID = 518, FSFLAG = 519, REGISTER = 520, CREDENTIALS = 521, URLOBJECT = 522, ADDRESSOBJECT = 523, TARGET = 524, TIMESPEC = 525, HTTPHEADER = 526, MAXFORWARD = 527, FIPS = 528, SECURITY = 529, ATTRIBUTE = 530, GREATER = 531, GREATEROREQUAL = 532, LESS = 533, LESSOREQUAL = 534, EQUAL = 535, NOTEQUAL = 536 }; #endif /* Tokens. */ #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 ENABLE 282 #define DISABLE 283 #define SSL 284 #define CIPHER 285 #define CLIENTPEMFILE 286 #define ALLOWSELFCERTIFICATION 287 #define SELFSIGNED 288 #define VERIFY 289 #define CERTIFICATE 290 #define CACERTIFICATEFILE 291 #define CACERTIFICATEPATH 292 #define VALID 293 #define INTERFACE 294 #define LINK 295 #define PACKET 296 #define BYTEIN 297 #define BYTEOUT 298 #define PACKETIN 299 #define PACKETOUT 300 #define SPEED 301 #define SATURATION 302 #define UPLOAD 303 #define DOWNLOAD 304 #define TOTAL 305 #define IDFILE 306 #define STATEFILE 307 #define SEND 308 #define EXPECT 309 #define CYCLE 310 #define COUNT 311 #define REMINDER 312 #define REPEAT 313 #define LIMITS 314 #define SENDEXPECTBUFFER 315 #define EXPECTBUFFER 316 #define FILECONTENTBUFFER 317 #define HTTPCONTENTBUFFER 318 #define PROGRAMOUTPUT 319 #define NETWORKTIMEOUT 320 #define PROGRAMTIMEOUT 321 #define STARTTIMEOUT 322 #define STOPTIMEOUT 323 #define RESTARTTIMEOUT 324 #define PIDFILE 325 #define START 326 #define STOP 327 #define PATHTOK 328 #define HOST 329 #define HOSTNAME 330 #define PORT 331 #define IPV4 332 #define IPV6 333 #define TYPE 334 #define UDP 335 #define TCP 336 #define TCPSSL 337 #define PROTOCOL 338 #define CONNECTION 339 #define ALERT 340 #define NOALERT 341 #define MAILFORMAT 342 #define UNIXSOCKET 343 #define SIGNATURE 344 #define TIMEOUT 345 #define RETRY 346 #define RESTART 347 #define CHECKSUM 348 #define EVERY 349 #define NOTEVERY 350 #define DEFAULT 351 #define HTTP 352 #define HTTPS 353 #define APACHESTATUS 354 #define FTP 355 #define SMTP 356 #define SMTPS 357 #define POP 358 #define POPS 359 #define IMAP 360 #define IMAPS 361 #define CLAMAV 362 #define NNTP 363 #define NTP3 364 #define MYSQL 365 #define DNS 366 #define WEBSOCKET 367 #define MQTT 368 #define SSH 369 #define DWP 370 #define LDAP2 371 #define LDAP3 372 #define RDATE 373 #define RSYNC 374 #define TNS 375 #define PGSQL 376 #define POSTFIXPOLICY 377 #define SIP 378 #define LMTP 379 #define GPS 380 #define RADIUS 381 #define MEMCACHE 382 #define REDIS 383 #define MONGODB 384 #define SIEVE 385 #define SPAMASSASSIN 386 #define FAIL2BAN 387 #define STRING 388 #define PATH 389 #define MAILADDR 390 #define MAILFROM 391 #define MAILREPLYTO 392 #define MAILSUBJECT 393 #define MAILBODY 394 #define SERVICENAME 395 #define STRINGNAME 396 #define NUMBER 397 #define PERCENT 398 #define LOGLIMIT 399 #define CLOSELIMIT 400 #define DNSLIMIT 401 #define KEEPALIVELIMIT 402 #define REPLYLIMIT 403 #define REQUESTLIMIT 404 #define STARTLIMIT 405 #define WAITLIMIT 406 #define GRACEFULLIMIT 407 #define CLEANUPLIMIT 408 #define REAL 409 #define CHECKPROC 410 #define CHECKFILESYS 411 #define CHECKFILE 412 #define CHECKDIR 413 #define CHECKHOST 414 #define CHECKSYSTEM 415 #define CHECKFIFO 416 #define CHECKPROGRAM 417 #define CHECKNET 418 #define THREADS 419 #define CHILDREN 420 #define METHOD 421 #define GET 422 #define HEAD 423 #define STATUS 424 #define ORIGIN 425 #define VERSIONOPT 426 #define READ 427 #define WRITE 428 #define OPERATION 429 #define SERVICETIME 430 #define DISK 431 #define RESOURCE 432 #define MEMORY 433 #define TOTALMEMORY 434 #define LOADAVG1 435 #define LOADAVG5 436 #define LOADAVG15 437 #define SWAP 438 #define MODE 439 #define ACTIVE 440 #define PASSIVE 441 #define MANUAL 442 #define ONREBOOT 443 #define NOSTART 444 #define LASTSTATE 445 #define CORE 446 #define CPU 447 #define TOTALCPU 448 #define CPUUSER 449 #define CPUSYSTEM 450 #define CPUWAIT 451 #define GROUP 452 #define REQUEST 453 #define DEPENDS 454 #define BASEDIR 455 #define SLOT 456 #define EVENTQUEUE 457 #define SECRET 458 #define HOSTHEADER 459 #define UID 460 #define EUID 461 #define GID 462 #define MMONIT 463 #define INSTANCE 464 #define USERNAME 465 #define PASSWORD 466 #define TIME 467 #define ATIME 468 #define CTIME 469 #define MTIME 470 #define CHANGED 471 #define MILLISECOND 472 #define SECOND 473 #define MINUTE 474 #define HOUR 475 #define DAY 476 #define MONTH 477 #define SSLAUTO 478 #define SSLV2 479 #define SSLV3 480 #define TLSV1 481 #define TLSV11 482 #define TLSV12 483 #define TLSV13 484 #define CERTMD5 485 #define AUTO 486 #define BYTE 487 #define KILOBYTE 488 #define MEGABYTE 489 #define GIGABYTE 490 #define INODE 491 #define SPACE 492 #define TFREE 493 #define PERMISSION 494 #define SIZE 495 #define MATCH 496 #define NOT 497 #define IGNORE 498 #define ACTION 499 #define UPTIME 500 #define EXEC 501 #define UNMONITOR 502 #define PING 503 #define PING4 504 #define PING6 505 #define ICMP 506 #define ICMPECHO 507 #define NONEXIST 508 #define EXIST 509 #define INVALID 510 #define DATA 511 #define RECOVERED 512 #define PASSED 513 #define SUCCEEDED 514 #define URL 515 #define CONTENT 516 #define PID 517 #define PPID 518 #define FSFLAG 519 #define REGISTER 520 #define CREDENTIALS 521 #define URLOBJECT 522 #define ADDRESSOBJECT 523 #define TARGET 524 #define TIMESPEC 525 #define HTTPHEADER 526 #define MAXFORWARD 527 #define FIPS 528 #define SECURITY 529 #define ATTRIBUTE 530 #define GREATER 531 #define GREATEROREQUAL 532 #define LESS 533 #define LESSOREQUAL 534 #define EQUAL 535 #define NOTEQUAL 536 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { #line 310 "src/p.y" /* yacc.c:1909 */ URL_T url; Address_T address; float real; int number; char *string; #line 624 "src/y.tab.h" /* yacc.c:1909 */ }; 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.26.0/src/p.y0000664000175000017500000052574113507751326014111 0ustar martinpmartinp/* * 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. */ %{ /* * 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 #include "net.h" #include "monit.h" #include "protocol.h" #include "engine.h" #include "alert.h" #include "ProcessTree.h" #include "device.h" #include "processor.h" // libmonit #include "io/File.h" #include "util/Str.h" #include "thread/Thread.h" /* ------------------------------------------------------------- Definitions */ struct precedence_t { boolean_t daemon; boolean_t logfile; boolean_t pidfile; }; struct rate_t { unsigned count; unsigned cycles; }; /* yacc interface */ void yyerror(const char *,...); void yyerror2(const char *,...); void yywarning(const char *,...); void yywarning2(const char *,...); /* 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 Uptime_T uptimeset = {}; 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}; 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 repeat = 0; static unsigned repeat1 = 0; static unsigned repeat2 = 0; static Digest_Type digesttype = Digest_Cleartext; #define BITMAP_MAX (sizeof(long long) * 8) /* -------------------------------------------------------------- Prototypes */ static void preparse(void); static void postparse(void); static boolean_t _parseOutgoingAddress(const 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 addport(Port_T *, Port_T); static void addhttpheader(Port_T, const char *); static void addresource(Resource_T); static void addtimestamp(Timestamp_T); static void addactionrate(ActionRate_T); static void addsize(Size_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 boolean_t addcredentials(char *, char *, Digest_Type, boolean_t); #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 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 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_uptimeset(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, boolean_t isFile); static void _setSSLOptions(SslOptions_T options); static void addsecurityattribute(char *, Action_Type, Action_Type); %} %union { URL_T url; Address_T address; float real; int number; 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 ENABLE DISABLE SSL CIPHER CLIENTPEMFILE ALLOWSELFCERTIFICATION SELFSIGNED VERIFY CERTIFICATE CACERTIFICATEFILE CACERTIFICATEPATH VALID %token INTERFACE LINK PACKET BYTEIN BYTEOUT PACKETIN PACKETOUT SPEED SATURATION UPLOAD DOWNLOAD TOTAL %token IDFILE STATEFILE SEND EXPECT CYCLE COUNT REMINDER REPEAT %token LIMITS SENDEXPECTBUFFER EXPECTBUFFER FILECONTENTBUFFER HTTPCONTENTBUFFER PROGRAMOUTPUT NETWORKTIMEOUT PROGRAMTIMEOUT STARTTIMEOUT STOPTIMEOUT RESTARTTIMEOUT %token PIDFILE START STOP PATHTOK %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 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 %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 CORE CPU TOTALCPU CPUUSER CPUSYSTEM CPUWAIT %token GROUP REQUEST DEPENDS BASEDIR SLOT EVENTQUEUE SECRET HOSTHEADER %token UID EUID GID MMONIT INSTANCE USERNAME PASSWORD %token TIME ATIME CTIME MTIME CHANGED MILLISECOND SECOND MINUTE HOUR DAY MONTH %token SSLAUTO SSLV2 SSLV3 TLSV1 TLSV11 TLSV12 TLSV13 CERTMD5 AUTO %token BYTE KILOBYTE MEGABYTE GIGABYTE %token INODE SPACE TFREE PERMISSION SIZE MATCH NOT IGNORE ACTION UPTIME %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 %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 | 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 | 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 | 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 ; optfifolist : /* EMPTY */ | optfifolist optfifo ; optfifo : start | stop | restart | exist | timestamp | actionrate | every | alert | permission | uid | gid | mode | onreboot | group | depend ; optprogramlist : /* EMPTY */ | optprogramlist optprogram ; optprogram : start | stop | restart | actionrate | alert | every | mode | onreboot | group | depend | statusvalue ; 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) { ihp.daemon = true; Run.flags |= Run_Daemon; 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 { Run.limits.sendExpectBuffer = $3 * $4; } | FILECONTENTBUFFER ':' NUMBER unit { Run.limits.fileContentBuffer = $3 * $4; } | HTTPCONTENTBUFFER ':' NUMBER unit { Run.limits.httpContentBuffer = $3 * $4; } | PROGRAMOUTPUT ':' NUMBER unit { Run.limits.programOutput = $3 * $4; } | NETWORKTIMEOUT ':' NUMBER MILLISECOND { Run.limits.networkTimeout = $3; } | NETWORKTIMEOUT ':' NUMBER SECOND { Run.limits.networkTimeout = $3 * 1000; } | PROGRAMTIMEOUT ':' NUMBER MILLISECOND { Run.limits.programTimeout = $3; } | PROGRAMTIMEOUT ':' NUMBER SECOND { Run.limits.programTimeout = $3 * 1000; } | STOPTIMEOUT ':' NUMBER MILLISECOND { Run.limits.stopTimeout = $3; } | STOPTIMEOUT ':' NUMBER SECOND { Run.limits.stopTimeout = $3 * 1000; } | STARTTIMEOUT ':' NUMBER MILLISECOND { Run.limits.startTimeout = $3; } | STARTTIMEOUT ':' NUMBER SECOND { Run.limits.startTimeout = $3 * 1000; } | RESTARTTIMEOUT ':' NUMBER MILLISECOND { Run.limits.restartTimeout = $3; } | RESTARTTIMEOUT ':' NUMBER SECOND { Run.limits.restartTimeout = $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; } } | 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 { Run.files.id = $3; } ; setstatefile : SET STATEFILE PATH { Run.files.state = $3; } ; setpid : SET PIDFILE PATH { if (! Run.files.pid || ihp.pidfile) { ihp.pidfile = true; setpidfile($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 { mmonitset.timeout = $2 * 1000; // net timeout is in milliseconds internally } | ssl | sslchecksum | sslversion | certmd5 ; credentials : /* EMPTY */ | REGISTER CREDENTIALS { Run.flags &= ~Run_MmonitCredentials; } ; setssl : SET SSL '{' ssloptionlist '}' { _setSSLOptions(&(Run.ssl)); } ; ssl : SSL { sslset.flags = SSL_Enabled; } | SSL '{' 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 ':' sslversion { sslset.flags = SSL_Enabled; } | CIPHER ':' STRING { FREE(sslset.ciphers); sslset.ciphers = $3; } | PEMFILE ':' PATH { _setPEM(&(sslset.pemfile), $3, "SSL server 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 ; sslversion : SSLV2 { sslset.flags = SSL_Enabled; sslset.version = SSL_V2; } | SSLV3 { sslset.flags = SSL_Enabled; sslset.version = SSL_V3; } | TLSV1 { sslset.flags = SSL_Enabled; sslset.version = SSL_TLSV1; } | TLSV11 { #ifndef HAVE_TLSV1_1 yyerror("Your SSL Library does not support TLS version 1.1"); #endif sslset.flags = SSL_Enabled; sslset.version = SSL_TLSV11; } | TLSV12 { #ifndef HAVE_TLSV1_2 yyerror("Your SSL Library does not support TLS version 1.2"); #endif sslset.flags = SSL_Enabled; sslset.version = SSL_TLSV12; } | TLSV13 { #ifndef HAVE_TLSV1_3 yyerror("Your SSL Library does not support TLS version 1.3"); #endif sslset.flags = SSL_Enabled; sslset.version = SSL_TLSV13; } | SSLAUTO { sslset.flags = SSL_Enabled; sslset.version = SSL_Auto; } | AUTO { sslset.flags = SSL_Enabled; sslset.version = SSL_Auto; } ; 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 { if (($4) > SMTP_TIMEOUT) 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 overriden 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 overriden 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) { yyerror("SSL server PEM file is required (please use ssl pemfile option)"); } else if (! file_checkStat(sslset.pemfile, "SSL server PEM file", S_IRWXU)) { yyerror("SSL server PEM file permissions check failed"); } else { _setSSLOptions(&(Run.httpd.socket.net.ssl)); } #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 { Run.httpd.flags |= Httpd_Net; Run.httpd.socket.net.port = $2; } ; 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); } ; 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 { 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", $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))) { LogError("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 { command_t c = command; // Current command check_exec(c->arg[0]); 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 { command_t c = command; // Current command check_exec(c->arg[0]); 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; } ; hostname : /* EMPTY */ { $$ = NULL; } | HOSTNAME STRING { $$ = $2; } ; connection : IF FAILED host port connectionoptlist rate1 THEN action1 recovery { /* 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; addeventaction(&(portset).action, $8, $9); addport(&(current->portlist), &portset); } ; connectionoptlist : /* EMPTY */ | connectionoptlist connectionopt ; connectionopt : ip | type | protocol | sendexpect | urloption | connectiontimeout | outgoing | retry | ssl | sslchecksum | sslexpire ; connectionurl : IF FAILED URL URLOBJECT connectionurloptlist rate1 THEN action1 recovery { 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 { addeventaction(&(portset).action, $7, $8); addport(&(current->socketlist), &portset); } ; connectionuxoptlist : /* EMPTY */ | connectionuxoptlist connectionuxopt ; connectionuxopt : type | protocol | sendexpect | connectiontimeout | retry ; icmp : IF FAILED ICMP icmptype icmpoptlist rate1 THEN action1 recovery { icmpset.family = Socket_Ip; icmpset.type = $4; addeventaction(&(icmpset).action, $8, $9); addicmp(&icmpset); } | IF FAILED PING icmpoptlist rate1 THEN action1 recovery { icmpset.family = Socket_Ip; addeventaction(&(icmpset).action, $7, $8); addicmp(&icmpset); } | IF FAILED PING4 icmpoptlist rate1 THEN action1 recovery { icmpset.family = Socket_Ip4; addeventaction(&(icmpset).action, $7, $8); addicmp(&icmpset); } | IF FAILED PING6 icmpoptlist rate1 THEN action1 recovery { icmpset.family = Socket_Ip6; addeventaction(&(icmpset).action, $7, $8); addicmp(&icmpset); } ; icmpoptlist : /* EMPTY */ | icmpoptlist icmpopt ; icmpopt : icmpcount | icmpsize | icmptimeout | icmpoutgoing ; 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 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 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 CLAMAV { portset.protocol = Protocol_get(Protocol_CLAMAV); } | PROTOCOL LDAP2 { portset.protocol = Protocol_get(Protocol_LDAP2); } | PROTOCOL LDAP3 { portset.protocol = Protocol_get(Protocol_LDAP3); } | 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 SIP siplist { portset.protocol = Protocol_get(Protocol_SIP); } | PROTOCOL NNTP { portset.protocol = Protocol_get(Protocol_NNTP); } | PROTOCOL NTP3 { portset.protocol = Protocol_get(Protocol_NTP3); portset.type = Socket_Udp; } | PROTOCOL POSTFIXPOLICY { portset.protocol = Protocol_get(Protocol_POSTFIXPOLICY); } | 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 SIEVE { portset.protocol = Protocol_get(Protocol_SIEVE); } | 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 RDATE { portset.protocol = Protocol_get(Protocol_RDATE); } | PROTOCOL REDIS { portset.protocol = Protocol_get(Protocol_REDIS); } | PROTOCOL RSYNC { portset.protocol = Protocol_get(Protocol_RSYNC); } | PROTOCOL TNS { portset.protocol = Protocol_get(Protocol_TNS); } | PROTOCOL PGSQL { portset.protocol = Protocol_get(Protocol_PGSQL); } | PROTOCOL LMTP { portset.protocol = Protocol_get(Protocol_LMTP); } | PROTOCOL GPS { portset.protocol = Protocol_get(Protocol_GPS); } | PROTOCOL RADIUS radiuslist { portset.protocol = Protocol_get(Protocol_RADIUS); } | PROTOCOL MEMCACHE { portset.protocol = Protocol_get(Protocol_MEMCACHE); } | 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 { if ($1) { if (strlen($1) > 16) yyerror2("Username too long -- Maximum MySQL username length is 16 characters"); else portset.parameters.mysql.username = $1; } } | password { portset.parameters.mysql.password = $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 { addeventaction(&(nonexistset).action, $6, $7); addnonexist(&nonexistset); } | IF EXIST rate1 THEN action1 recovery { 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 { uptimeset.operator = $3; uptimeset.uptime = ((unsigned long long)$4 * $5); addeventaction(&(uptimeset).action, $8, $9); adduptime(&uptimeset); } 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 { icmpset.timeout = $2 * 1000; // timeout is in milliseconds internally } ; icmpoutgoing : ADDRESS STRING { _parseOutgoingAddress($2, &(icmpset.outgoing)); } ; stoptimeout : /* EMPTY */ { $$ = Run.limits.stopTimeout; } | TIMEOUT NUMBER SECOND { $$ = $2 * 1000; // milliseconds internally } ; starttimeout : /* EMPTY */ { $$ = Run.limits.startTimeout; } | TIMEOUT NUMBER SECOND { $$ = $2 * 1000; // milliseconds internally } ; restarttimeout : /* EMPTY */ { $$ = Run.limits.restartTimeout; } | TIMEOUT NUMBER SECOND { $$ = $2 * 1000; // milliseconds internally } ; programtimeout : /* EMPTY */ { $$ = Run.limits.programTimeout; } | TIMEOUT NUMBER SECOND { $$ = $2 * 1000; // milliseconds internally } ; nettimeout : /* EMPTY */ { $$ = Run.limits.networkTimeout; } | TIMEOUT NUMBER SECOND { $$ = $2 * 1000; // net timeout is in milliseconds internally } ; connectiontimeout : TIMEOUT NUMBER SECOND { 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 { current->every.type = Every_SkipCycles; current->every.spec.cycle.counter = current->every.spec.cycle.number = $2; } | EVERY TIMESPEC { current->every.type = Every_Cron; current->every.spec.cron = $2; } | NOTEVERY TIMESPEC { 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); } ; depend : DEPENDS dependlist ; dependlist : dependant | dependlist dependant ; dependant : SERVICENAME { adddependant($1); } ; statusvalue : IF STATUS operator NUMBER rate1 THEN action1 recovery { 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 { 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 { 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 { $$ = Resource_CpuUser; } | CPUSYSTEM { $$ = Resource_CpuSystem; } | CPUWAIT { $$ = Resource_CpuWait; } | 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 { $$ = systeminfo.cpu.count; } ; resourceread : DISK READ operator value unit currenttime { resourceset.resource_id = Resource_ReadBytes; resourceset.operator = $3; resourceset.limit = $4 * $5; } | DISK READ operator NUMBER OPERATION { resourceset.resource_id = Resource_ReadOperations; resourceset.operator = $3; resourceset.limit = $4; } ; resourcewrite : DISK WRITE operator value unit currenttime { resourceset.resource_id = Resource_WriteBytes; 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 { 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; } 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 repeat { $$ = Action_Exec; } | EXEC argumentlist useroptionlist repeat { $$ = Action_Exec; } | RESTART { $$ = Action_Restart; } | START { $$ = Action_Start; } | STOP { $$ = Action_Stop; } | UNMONITOR { $$ = Action_Unmonitor; } ; action1 : action { $$ = $1; if ($1 == Action_Exec && command) { repeat1 = repeat; repeat = 0; command1 = command; command = NULL; } } ; action2 : action { $$ = $1; if ($1 == Action_Exec && command) { repeat2 = repeat; repeat = 0; command2 = command; command = NULL; } } ; rateXcycles : NUMBER CYCLE { if ($1 < 1 || $1 > BITMAP_MAX) { yyerror2("The number of cycles must be between 1 and %d", BITMAP_MAX); } else { rate.count = $1; rate.cycles = $1; } } ; rateXYcycles : NUMBER NUMBER CYCLE { if ($2 < 1 || $2 > BITMAP_MAX) { yyerror2("The number of cycles must be between 1 and %d", 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 : /* EMPTY */ { $$ = Action_Alert; } | ELSE IF RECOVERED rate2 THEN action2 { $$ = $6; } | ELSE IF PASSED rate2 THEN action2 { $$ = $6; } | ELSE IF SUCCEEDED rate2 THEN action2 { $$ = $6; } ; checksum : IF FAILED hashtype CHECKSUM rate1 THEN action1 recovery { addeventaction(&(checksumset).action, $7, $8); addchecksum(&checksumset); } | IF FAILED hashtype CHECKSUM EXPECT STRING rate1 THEN action1 recovery { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { permset.perm = check_perm($4); addeventaction(&(permset).action, $7, $8); addperm(&permset); } | IF CHANGED PERMISSION rate1 THEN action1 recovery { permset.test_changes = true; addeventaction(&(permset).action, $6, Action_Ignored); addperm(&permset); } ; 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 { 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); } ; uid : IF FAILED UID STRING rate1 THEN action1 recovery { 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 { uidset.uid = get_uid(NULL, $4); addeventaction(&(uidset).action, $7, $8); current->uid = adduid(&uidset); } ; euid : IF FAILED EUID STRING rate1 THEN action1 recovery { 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 { 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 { addsecurityattribute($5, $8, $9); } | IF FAILED SECURITY ATTRIBUTE PATH rate1 THEN action1 recovery { addsecurityattribute($5, $8, $9); } ; gid : IF FAILED GID STRING rate1 THEN action1 recovery { 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 { gidset.gid = get_gid(NULL, $4); addeventaction(&(gidset).action, $7, $8); current->gid = addgid(&gidset); } ; linkstatus : IF FAILED LINK rate1 THEN action1 recovery { addeventaction(&(linkstatusset).action, $6, $7); addlinkstatus(current, &linkstatusset); } ; linkspeed : IF CHANGED LINK rate1 THEN action1 recovery { addeventaction(&(linkspeedset).action, $6, $7); addlinkspeed(current, &linkspeedset); } linksaturation : IF SATURATION operator NUMBER PERCENT rate1 THEN action1 recovery { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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 { 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); LogError("%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); LogWarning("%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); LogError("%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); LogWarning("%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 */ boolean_t parse(char *controlfile) { ASSERT(controlfile); if ((yyin = fopen(controlfile,"r")) == (FILE *)NULL) { LogError("Cannot open the control file '%s' -- %s\n", controlfile, STRERROR); return false; } currentfile = Str_dup(controlfile); /* * 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() { servicelist = 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.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_mailset(); reset_sslset(); reset_mailserverset(); reset_mmonitset(); 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() { if (cfg_errflag) return; /* If defined - add the last service to the service list */ if (current) addservice(current); /* Check that we do not start monit in daemon mode without having a poll time */ if (! Run.polltime && ((Run.flags & Run_Daemon) || (Run.flags & Run_Foreground))) { LogError("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))) { LogError("Cannot get system hostname -- please add 'check system '\n"); cfg_errflag++; } if (Util_existService(hostname)) { LogError("'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) LogWarning("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) { LogWarning("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 { LogWarning("M/Monit enabled but no httpd allowed -- please add 'set httpd' statement\n"); } } /* Check the sanity of any dependency graph */ check_depend(); #ifdef HAVE_OPENSSL Ssl_setFipsMode(Run.flags & Run_FipsEnabled); #endif Processor_setHttpPostLimit(); } static boolean_t _parseOutgoingAddress(const 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 = (char *)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 -- %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->mode = Monitor_Active; current->monitor = Monitor_Init; current->onreboot = Run.onreboot; current->name = name; current->name_escaped = Util_urlEncode(name, false); 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 servicelist */ 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) { LogError("'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) { LogError("'check program %s' is incomplete: Please add an 'if status != n' test\n", s->name); cfg_errflag++; } // Create the Command object char program[PATH_MAX]; strncpy(program, s->program->args->arg[0], sizeof(program) - 1); 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); 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; } /* Add the service to the end of the service list */ if (tail != NULL) { tail->next = s; tail->next_conf = s; } else { servicelist = s; servicelist_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 = servicegrouplist; 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 = servicegrouplist; servicegrouplist = g; } List_append(g->members, current); } /* * 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_escaped = Util_urlEncode(dependant, false); 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->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 == 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"); } } } p->next = *list; *list = p; reset_sslset(); reset_portset(); } static void addhttpheader(Port_T port, const 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, (char *)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 comparision, 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 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 (! (Util_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; NEW(l); 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 parsing error: %s on line %i of", errbuf, linenumber); else yyerror2("Regex parsing error: %s", 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 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->is_available = Connection_Init; icmp->response = -1; icmp->next = current->icmplist; current->icmplist = icmp; 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 timeout) { switch (what) { case START: current->start = command; break; case STOP: current->stop = command; break; case RESTART: current->restart = command; break; } command->timeout = timeout; command = NULL; } /* * Add a new argument to the argument list */ static void addargument(char *argument) { ASSERT(argument); if (! command) { NEW(command); check_exec(argument); } command->arg[command->length++] = argument; command->arg[command->length] = NULL; if (command->length >= ARGMAX) yyerror("Exceeded maximum number of program arguments"); } /* * 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->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; } /* * 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; ASSERT(filename); handle = fopen(filename, "r"); if (handle == NULL) { if (username != NULL) yyerror2("Cannot read htpasswd (%s)", filename); else yyerror2("Cannot read htpasswd", 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 boolean_t addcredentials(char *uname, char *passwd, Digest_Type dtype, boolean_t readonly) { Auth_T c; ASSERT(uname); ASSERT(passwd); if (strlen(passwd) > MAX_CONSTANT_TIME_STRING_LENGTH) { yyerror2("Password for user %s is too long, maximum %d allowed", uname, MAX_CONSTANT_TIME_STRING_LENGTH); FREE(uname); FREE(passwd); return false; } 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 yyerror2("Invalid syslog facility"); } else { Run.facility = LOG_USER; } } /* * Reset the current sslset for reuse */ static void reset_sslset() { memset(&sslset, 0, sizeof(struct SslOptions_T)); sslset.version = sslset.verify = sslset.allowSelfSigned = -1; } /* * Reset the current mailset for reuse */ static void reset_mailset() { memset(&mailset, 0, sizeof(struct Mail_T)); } /* * Reset the mailserver set to default values */ static void reset_mailserverset() { memset(&mailserverset, 0, sizeof(struct MailServer_T)); mailserverset.port = PORT_SMTP; } /* * Reset the mmonit set to default values */ static void reset_mmonitset() { memset(&mmonitset, 0, sizeof(struct Mmonit_T)); mmonitset.timeout = Run.limits.networkTimeout; } /* * Reset the Port set to default values */ static void reset_portset() { memset(&portset, 0, sizeof(struct Port_T)); 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() { 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() { 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() { actionrateset.count = 0; actionrateset.cycle = 0; actionrateset.action = NULL; } /* * Reset the Size set to default values */ static void reset_sizeset() { sizeset.operator = Operator_Equal; sizeset.size = 0; sizeset.test_changes = false; sizeset.action = NULL; } /* * Reset the Uptime set to default values */ static void reset_uptimeset() { uptimeset.operator = Operator_Equal; uptimeset.uptime = 0; uptimeset.action = NULL; } static void reset_linkstatusset() { linkstatusset.action = NULL; } static void reset_linkspeedset() { linkspeedset.action = NULL; } static void reset_linksaturationset() { linksaturationset.limit = 0.; linksaturationset.operator = Operator_Equal; linksaturationset.action = NULL; } /* * Reset the Bandwidth set to default values */ static void reset_bandwidthset() { bandwidthset.operator = Operator_Equal; bandwidthset.limit = 0ULL; bandwidthset.action = NULL; } /* * Reset the Pid set to default values */ static void reset_pidset() { pidset.action = NULL; } /* * Reset the PPid set to default values */ static void reset_ppidset() { ppidset.action = NULL; } /* * Reset the Fsflag set to default values */ static void reset_fsflagset() { fsflagset.action = NULL; } /* * Reset the Nonexist set to default values */ static void reset_nonexistset() { nonexistset.action = NULL; } static void reset_existset() { existset.action = NULL; } /* * Reset the Checksum set to default values */ static void reset_checksumset() { 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() { permset.test_changes = false; permset.perm = 0; permset.action = NULL; } /* * Reset the Status set to default values */ static void reset_statusset() { 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() { uidset.uid = 0; uidset.action = NULL; } /* * Reset the Gid set to default values */ static void reset_gidset() { gidset.gid = 0; gidset.action = NULL; } /* * Reset the Filesystem set to default values */ static void reset_filesystemset() { 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() { icmpset.type = ICMP_ECHO; icmpset.size = ICMP_SIZE; icmpset.count = ICMP_ATTEMPT_COUNT; icmpset.timeout = Run.limits.networkTimeout; icmpset.action = NULL; } /* * 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() { Service_T depends_on = NULL; Service_T* dlt = &depend_list; /* the current tail of it */ boolean_t done; /* no unvisited nodes left? */ boolean_t found_some; /* last iteration found anything new ? */ depend_list = NULL; /* depend_list will be the topological sorted servicelist */ do { done = true; found_some = false; for (Service_T s = servicelist; 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) { LogError("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); LogError("Found a depend loop in the control file involving the service '%s'\n", depends_on->name); exit(1); } ASSERT(depend_list); servicelist = depend_list; for (Service_T s = depend_list; s; s = s->next_depend) s->next = s->next_depend; } /* * Check if the executable 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 unitialized (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, boolean_t isFile) { if (*store) { yyerror2("Duplicate %s", description); } else if (! File_exist(path)) { yyerror2("%s doesn't exist", description); } else if (! (isFile ? File_isFile(path) : File_isDirectory(path))) { yyerror2("%s is not a %s", description, isFile ? "file" : "directory"); } else if (! File_isReadable(path)) { yyerror2("Cannot read %s", description); } 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->verify = sslset.verify; options->version = sslset.version; reset_sslset(); } 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; } monit-5.26.0/src/control.c0000664000175000017500000005217013507751326015273 0ustar martinpmartinp/* * 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 "net.h" #include "socket.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 } __attribute__((__packed__)) Process_Status; #define RETRY_INTERVAL 100000 // 100ms /* ----------------------------------------------------------------- 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, int64_t *timeout) { ASSERT(S); ASSERT(c); ASSERT(msg); msg[0] = 0; 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], NULL); } ELSE { snprintf(msg, msglen, "Program %s failed: %s", c->arg[0], Exception_frame.message); } END_TRY; if (C) { int64_t _timeoutMilli = *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_string(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); Command_free(&C); if (P) { do { Time_usleep(RETRY_INTERVAL); *timeout -= RETRY_INTERVAL; } while ((status = Process_exitStatus(P)) < 0 && *timeout > 0 && ! (Run.flags & Run_Stopped)); if (*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_getErrorStream(P), buf, sizeof(buf))) <= 0) n = _getOutput(Process_getInputStream(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]){}), *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_free(&P); // Will kill the program if still running } } return status; } static Process_Status _waitProcessStart(Service_T s, int64_t *timeout) { long wait = RETRY_INTERVAL; do { Time_usleep(wait); pid_t pid = ProcessTree_findProcess(s); if (pid) { ProcessTree_init(ProcessEngine_None); ProcessTree_updateProcess(s, pid); return Process_Started; } *timeout -= wait; wait = wait < 1000000 ? 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 (*timeout > 0 && ! (Run.flags & Run_Stopped)); return Process_Stopped; } static Process_Status _waitProcessStop(int pid, int64_t *timeout) { do { Time_usleep(RETRY_INTERVAL); if (! pid || (getpgid(pid) == -1 && errno != EPERM)) return Process_Stopped; *timeout -= RETRY_INTERVAL; } while (*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 int64_t timeout = s->program->timeout * USEC_PER_MSEC; do { Time_usleep(RETRY_INTERVAL); timeout -= RETRY_INTERVAL; } while (Process_exitStatus(s->program->P) < 0 && 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 boolean_t _doStart(Service_T s) { ASSERT(s); boolean_t 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)) { LogInfo("'%s' start: '%s'\n", s->name, Util_commandDescription(s->start, (char[STRLEN]){})); char msg[1024]; int64_t timeout = s->start->timeout * USEC_PER_MSEC; int status = _commandExecute(s, s->start, msg, sizeof(msg), &timeout); if (status < 0 || (s->type == Service_Process && _waitProcessStart(s, &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 { LogDebug("'%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, int64_t *timeout) { LogInfo("'%s' stop: '%s'\n", s->name, Util_commandDescription(s->stop, (char[STRLEN]){})); return _commandExecute(s, s->stop, msg, msglen, timeout); } static void _evaluateStop(Service_T s, boolean_t 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 boolean_t _doStop(Service_T s, boolean_t unmonitor) { ASSERT(s); boolean_t rv = true; if (s->stop) { if (s->monitor != Monitor_Not) { int exitStatus; char msg[1024]; int64_t 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), &timeout); rv = _waitProcessStop(pid, &timeout) == Process_Stopped ? true : false; _evaluateStop(s, rv, exitStatus, msg); } } else { exitStatus = _executeStop(s, msg, sizeof(msg), &timeout); rv = exitStatus >= 0 ? true : false; _evaluateStop(s, rv, exitStatus, msg); } } } else { LogDebug("'%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 boolean_t _doRestart(Service_T s) { ASSERT(s); boolean_t rv = true; if (s->restart) { LogInfo("'%s' restart: '%s'\n", s->name, Util_commandDescription(s->restart, (char[STRLEN]){})); Util_resetInfo(s); char msg[1024]; int64_t timeout = s->restart->timeout * USEC_PER_MSEC; int status = _commandExecute(s, s->restart, msg, sizeof(msg), &timeout); if (status < 0 || (s->type == Service_Process && _waitProcessStart(s, &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 { LogDebug("'%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 boolean_t _doDepend(Service_T s, Action_Type action, boolean_t unmonitor) { ASSERT(s); boolean_t rv = true; for (Service_T child = servicelist; 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 */ boolean_t control_service_string(List_T services, const char *action) { ASSERT(services); ASSERT(action); Action_Type a = Util_getAction(action); if (a == Action_Ignored) { LogError("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 */ boolean_t control_service(const char *S, Action_Type A) { Service_T s = NULL; boolean_t rv = true; ASSERT(S); if (! (s = Util_getService(S))) { LogError("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: LogInfo("'%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: LogError("Service '%s' -- invalid action %d\n", S, A); rv = false; } if (s->doaction == A) { s->doaction = Action_Ignored; } return rv; } monit-5.26.0/src/log.c0000664000175000017500000002754513507751326014404 0ustar martinpmartinp/* * 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 log_mutex = PTHREAD_MUTEX_INITIALIZER; static struct mylogpriority { int priority; 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 boolean_t open_log() { if (Run.flags & Run_UseSyslog) { openlog(prog, LOG_PID, Run.facility); } else { LOG = fopen(Run.files.log, "a+"); if (! LOG) { LogError("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 *logPriorityDescription(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 formated (printf-style) string to log */ static void log_log(int priority, const char *s, va_list ap) { ASSERT(s); #ifdef HAVE_VA_COPY va_list ap_copy; #endif LOCK(log_mutex) { FILE *output = priority < LOG_INFO ? stderr : stdout; #ifdef HAVE_VA_COPY va_copy(ap_copy, ap); vfprintf(output, s, ap_copy); va_end(ap_copy); #else vfprintf(output, s, ap); #endif fflush(output); if (Run.flags & Run_Log) { if (Run.flags & Run_UseSyslog) { #ifdef HAVE_VA_COPY va_copy(ap_copy, ap); vsyslog(priority, s, ap_copy); va_end(ap_copy); #else vsyslog(priority, s, ap); #endif } else if (LOG) { char datetime[STRLEN]; fprintf(LOG, "[%s] %-8s : ", Time_fmt(datetime, sizeof(datetime), TIMEFORMAT, time(NULL)), logPriorityDescription(priority)); #ifdef HAVE_VA_COPY va_copy(ap_copy, ap); vfprintf(LOG, s, ap_copy); va_end(ap_copy); #else vfprintf(LOG, s, ap); #endif } } } END_LOCK; } static void log_backtrace() { #ifdef HAVE_BACKTRACE int i, frames; void *callstack[128]; char **strs; if (Run.debug >= 2) { frames = backtrace(callstack, 128); strs = backtrace_symbols(callstack, frames); LogDebug("-------------------------------------------------------------------------------\n"); for (i = 0; i < frames; ++i) LogDebug(" %s\n", strs[i]); LogDebug("-------------------------------------------------------------------------------\n"); FREE(strs); } #endif } /* ------------------------------------------------------------------ Public */ /** * Initialize the log system and 'log' function * @return true if the log system was successfully initialized */ boolean_t log_init() { if (! (Run.flags & Run_Log)) return true; if (! open_log()) return false; /* Register log_close to be called at program termination */ atexit(log_close); return true; } /** * Logging interface with priority support * @param s A formated (printf-style) string to log */ void LogEmergency(const char *s, ...) { ASSERT(s); va_list ap; va_start(ap, s); log_log(LOG_EMERG, s, ap); va_end(ap); log_backtrace(); } /** * Logging interface with priority support * @param s A formated (printf-style) string to log * @param ap A variable argument list */ void vLogEmergency(const char *s, va_list ap) { ASSERT(s); va_list ap_copy; va_copy(ap_copy, ap); log_log(LOG_EMERG, s, ap); va_end(ap_copy); log_backtrace(); } /** * Logging interface with priority support * @param s A formated (printf-style) string to log */ void LogAlert(const char *s, ...) { ASSERT(s); va_list ap; va_start(ap, s); log_log(LOG_ALERT, s, ap); va_end(ap); log_backtrace(); } /** * Logging interface with priority support * @param s A formated (printf-style) string to log * @param ap A variable argument list */ void vLogAlert(const char *s, va_list ap) { ASSERT(s); va_list ap_copy; va_copy(ap_copy, ap); log_log(LOG_ALERT, s, ap); va_end(ap_copy); log_backtrace(); } /** * Logging interface with priority support * @param s A formated (printf-style) string to log */ void LogCritical(const char *s, ...) { ASSERT(s); va_list ap; va_start(ap, s); log_log(LOG_CRIT, s, ap); va_end(ap); log_backtrace(); } /** * Logging interface with priority support * @param s A formated (printf-style) string to log * @param ap A variable argument list */ void vLogCritical(const char *s, va_list ap) { ASSERT(s); va_list ap_copy; va_copy(ap_copy, ap); log_log(LOG_CRIT, s, ap); va_end(ap_copy); log_backtrace(); } /* * Called by libmonit on Exception. Log * error and abort the application */ void vLogAbortHandler(const char *s, va_list ap) { ASSERT(s); va_list ap_copy; va_copy(ap_copy, ap); log_log(LOG_CRIT, s, ap); va_end(ap_copy); if (Run.debug) abort(); exit(1); } /** * Logging interface with priority support * @param s A formated (printf-style) string to log */ void LogError(const char *s, ...) { ASSERT(s); va_list ap; va_start(ap, s); log_log(LOG_ERR, s, ap); va_end(ap); log_backtrace(); } /** * Logging interface with priority support * @param s A formated (printf-style) string to log * @param ap A variable argument list */ void vLogError(const char *s, va_list ap) { ASSERT(s); va_list ap_copy; va_copy(ap_copy, ap); log_log(LOG_ERR, s, ap); va_end(ap_copy); log_backtrace(); } /** * Logging interface with priority support * @param s A formated (printf-style) string to log */ void LogWarning(const char *s, ...) { ASSERT(s); va_list ap; va_start(ap, s); log_log(LOG_WARNING, s, ap); va_end(ap); } /** * Logging interface with priority support * @param s A formated (printf-style) string to log * @param ap A variable argument list */ void vLogWarning(const char *s, va_list ap) { ASSERT(s); va_list ap_copy; va_copy(ap_copy, ap); log_log(LOG_WARNING, s, ap); va_end(ap_copy); } /** * Logging interface with priority support * @param s A formated (printf-style) string to log */ void LogNotice(const char *s, ...) { ASSERT(s); va_list ap; va_start(ap, s); log_log(LOG_NOTICE, s, ap); va_end(ap); } /** * Logging interface with priority support * @param s A formated (printf-style) string to log * @param ap A variable argument list */ void vLogNotice(const char *s, va_list ap) { ASSERT(s); va_list ap_copy; va_copy(ap_copy, ap); log_log(LOG_NOTICE, s, ap); va_end(ap_copy); } /** * Logging interface with priority support * @param s A formated (printf-style) string to log */ void LogInfo(const char *s, ...) { ASSERT(s); va_list ap; va_start(ap, s); log_log(LOG_INFO, s, ap); va_end(ap); } /** * Logging interface with priority support * @param s A formated (printf-style) string to log * @param ap A variable argument list */ void vLogInfo(const char *s, va_list ap) { ASSERT(s); va_list ap_copy; va_copy(ap_copy, ap); log_log(LOG_INFO, s, ap); va_end(ap_copy); } /** * Logging interface with priority support * @param s A formated (printf-style) string to log */ void LogDebug(const char *s, ...) { ASSERT(s); if (Run.debug) { va_list ap; va_start(ap, s); log_log(LOG_DEBUG, s, ap); va_end(ap); } } /** * Logging interface with priority support * @param s A formated (printf-style) string to log * @param ap A variable argument list */ void vLogDebug(const char *s, va_list ap) { ASSERT(s); if (Run.debug) { va_list ap_copy; va_copy(ap_copy, ap); log_log(LOG_NOTICE, s, ap); va_end(ap_copy); } } /** * Close the log file or syslog */ void log_close() { if (Run.flags & Run_UseSyslog) { closelog(); } if (LOG && (0 != fclose(LOG))) { LogError("Error closing the log file -- %s\n", STRERROR); } LOG = NULL; } #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 */ monit-5.26.0/src/config.h.in0000664000175000017500000004146113507751337015475 0ustar martinpmartinp/* 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 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 to 1 if you have the `backtrace' function. */ #undef HAVE_BACKTRACE /* Define to 1 if the system has the type `boolean_t'. */ #undef HAVE_BOOLEAN_T /* 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 CPU wait information is available. */ #undef HAVE_CPU_WAIT /* 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_BOOLEAN_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_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 header file. */ #undef HAVE_SETJMP_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 openssl with SSLv2 */ #undef HAVE_SSLV2 /* 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_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_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 VA_COPY is defined. */ #undef HAVE_VA_COPY /* 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 as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define to 1 if the `S_IS*' macros in do not work properly. */ #undef STAT_MACROS_BROKEN /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* 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 /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #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 to `int' if does not define. */ #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.26.0/src/terminal/0000775000175000017500000000000013507751326015255 5ustar martinpmartinpmonit-5.26.0/src/terminal/Color.h0000664000175000017500000001154413507751326016511 0ustar martinpmartinp/* * 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 COLOR_INCLUDED #define COLOR_INCLUDED /** * Class for terminal color output. * * @author http://www.tildeslash.com/ * @see http://www.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 Color_black(format, ...) COLOR_BLACK format COLOR_RESET, ##__VA_ARGS__ #define Color_red(format, ...) COLOR_RED format COLOR_RESET, ##__VA_ARGS__ #define Color_green(format, ...) COLOR_GREEN format COLOR_RESET, ##__VA_ARGS__ #define Color_yellow(format, ...) COLOR_YELLOW format COLOR_RESET, ##__VA_ARGS__ #define Color_blue(format, ...) COLOR_BLUE format COLOR_RESET, ##__VA_ARGS__ #define Color_magenta(format, ...) COLOR_MAGENTA format COLOR_RESET, ##__VA_ARGS__ #define Color_cyan(format, ...) COLOR_CYAN format COLOR_RESET, ##__VA_ARGS__ #define Color_white(format, ...) COLOR_WHITE format COLOR_RESET, ##__VA_ARGS__ #define Color_boldBlack(format, ...) COLOR_BOLDBLACK format COLOR_RESET, ##__VA_ARGS__ #define Color_boldRed(format, ...) COLOR_BOLDRED format COLOR_RESET, ##__VA_ARGS__ #define Color_boldGreen(format, ...) COLOR_BOLDGREEN format COLOR_RESET, ##__VA_ARGS__ #define Color_boldYellow(format, ...) COLOR_BOLDYELLOW format COLOR_RESET, ##__VA_ARGS__ #define Color_boldBlue(format, ...) COLOR_BOLDBLUE format COLOR_RESET, ##__VA_ARGS__ #define Color_boldMagenta(format, ...) COLOR_BOLDMAGENTA format COLOR_RESET, ##__VA_ARGS__ #define Color_boldCyan(format, ...) COLOR_BOLDCYAN format COLOR_RESET, ##__VA_ARGS__ #define Color_boldWhite(format, ...) COLOR_BOLDWHITE format COLOR_RESET, ##__VA_ARGS__ #define Color_darkGray(format, ...) COLOR_DARKGRAY format COLOR_RESET, ##__VA_ARGS__ #define Color_lightRed(format, ...) COLOR_LIGHTRED format COLOR_RESET, ##__VA_ARGS__ #define Color_lightGreen(format, ...) COLOR_LIGHTGREEN format COLOR_RESET, ##__VA_ARGS__ #define Color_lightYellow(format, ...) COLOR_LIGHTYELLOW format COLOR_RESET, ##__VA_ARGS__ #define Color_lightBlue(format, ...) COLOR_LIGHTBLUE format COLOR_RESET, ##__VA_ARGS__ #define Color_lightMagenta(format, ...) COLOR_LIGHTMAGENTA format COLOR_RESET, ##__VA_ARGS__ #define Color_lightCyan(format, ...) COLOR_LIGHTCYAN format COLOR_RESET, ##__VA_ARGS__ #define Color_lightWhite(format, ...) COLOR_LIGHTWHITE format COLOR_RESET, ##__VA_ARGS__ /** * Test terminal color support * @return true if colors are supported, otherwise false */ boolean_t Color_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 Color_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 *Color_strip(char *s); #endif monit-5.26.0/src/terminal/Box.c0000664000175000017500000002655013507751326016161 0ustar martinpmartinp/* * 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 "Color.h" #include "Box.h" // libmonit #include "util/Str.h" /** * Implementation of the Terminal table interface using UTF-8 box: * http://www.unicode.org/charts/PDF/U2500.pdf * * @author http://www.tildeslash.com/ * @see http://www.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 Box_T struct T { struct { unsigned row; unsigned column; } index; struct { struct { boolean_t enabled; char *color; } header; } options; unsigned columnsCount; BoxColumn_T *columns; StringBuffer_T b; }; /* ------------------------------------------------------- Private Methods */ static void _printBorderTop(T t) { StringBuffer_append(t->b, COLOR_DARKGRAY BOX_DOWN_RIGHT BOX_HORIZONTAL); for (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 (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 (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 (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(BoxColumn_T *column) { boolean_t 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 boolean_t _printRow(T t) { boolean_t repeat = false; for (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 pading StringBuffer_append(t->b, "%*s", t->columns[i].width, " "); } else if (strlen(t->columns[i].value + t->columns[i]._cursor) > 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 == BoxAlign_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 == BoxAlign_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(BoxColumn_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 (int i = 0; i < t->columnsCount; i++) _resetColumn(&(t->columns[i])); } /* -------------------------------------------------------- Public Methods */ T Box_new(StringBuffer_T b, int columnsCount, BoxColumn_T *columns, boolean_t 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 Box_free(T *t) { ASSERT(t && *t); if ((*t)->index.row > 0) _printBorderBottom(*t); for (int i = 0; i < (*t)->columnsCount; i++) FREE((*t)->columns[i].value); FREE(*t); } void Box_setColumn(T t, 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 = Color_length(t->columns[_index].value))) { _cacheColor(&(t->columns[_index])); Color_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 Box_printRow(T t) { ASSERT(t); if (t->index.row == 0) { _printBorderTop(t); if (t->options.header.enabled) { _printHeader(t); _printBorderMiddle(t); } } else { _printBorderMiddle(t); } boolean_t repeat = false; do { repeat = _printRow(t); } while (repeat); _resetRow(t); } char *Box_strip(char *s) { if (STR_DEF(s)) { int x, y; unsigned char *_s = (unsigned char *)s; boolean_t 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.26.0/src/terminal/Color.c0000664000175000017500000000703513507751326016504 0ustar martinpmartinp/* * 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" // libmonit #include "util/Str.h" /** * Implementation of the Terminal color interface * * @author http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ /* -------------------------------------------------------- Public Methods */ boolean_t Color_support() { if (! (Run.flags & Run_Batch) && isatty(STDOUT_FILENO)) { if (getenv("COLORTERM")) { return true; } else { char *term = getenv("TERM"); if (term && (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 Color_length(char *s) { if (STR_DEF(s)) { int length = 0; boolean_t 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 *Color_strip(char *s) { if (STR_DEF(s)) { int x, y; boolean_t 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.26.0/src/terminal/Box.h0000664000175000017500000000534313507751326016163 0ustar martinpmartinp/* * 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 http://www.tildeslash.com/ * @see http://www.mmonit.com/ * @file */ typedef enum { BoxAlign_Left = 0, BoxAlign_Right } __attribute__((__packed__)) BoxAlign_T; typedef struct BoxColumn_T { const char *name; char *value; // Options int width; boolean_t wrap; BoxAlign_T align; // Internal int _colorLength; unsigned long _valueLength; unsigned long _cursor; char _color[8]; } BoxColumn_T; #define T Box_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 Box_new(StringBuffer_T b, int columnsCount, BoxColumn_T *columns, boolean_t printHeader); //FIXME: when OutputStream is added, use it instead of StringBuffer /** * Close and destroy a Box object and free allocated resources * @param t a Box object reference */ void Box_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 Box_setColumn(T t, int index, const char *format, ...) __attribute__((format (printf, 3, 4))); /** * Print a table row * @param t The terminal table object */ void Box_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 *Box_strip(char *s); #undef T #endif monit-5.26.0/src/signal.c0000664000175000017500000000444713507751326015074 0ustar martinpmartinp/* * 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 handeling routines. * * @file */ /* ------------------------------------------------------------------ Public */ /** * 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); } /** * Set a collective thread signal block for signals honored by monit */ void set_signal_block() { sigset_t mask; sigemptyset(&mask); sigaddset(&mask, SIGHUP); sigaddset(&mask, SIGINT); sigaddset(&mask, SIGUSR1); sigaddset(&mask, SIGTERM); pthread_sigmask(SIG_BLOCK, &mask, NULL); } monit-5.26.0/src/monit.c0000664000175000017500000010332013507751326014733 0ustar martinpmartinp/* * 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 "net.h" #include "ProcessTree.h" #include "state.h" #include "event.h" #include "engine.h" #include "client.h" #include "MMonit.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(void); /* Re-initialize the runtime application */ static void do_action(int, char **); /* Dispatch to the submitted action */ static void do_exit(boolean_t); /* Finalize monit */ static void do_default(void); /* Do default action */ static void handle_options(int, char **); /* Handle program options */ static void help(void); /* Print program help message to stdout */ static void version(void); /* Print version information */ static void *heartbeat(void *args); /* M/Monit heartbeat thread */ static RETSIGTYPE do_reload(int); /* Signalhandler for a daemon reload */ static RETSIGTYPE do_destroy(int); /* Signalhandler for monit finalization */ static RETSIGTYPE do_wakeup(int); /* Signalhandler for a daemon wakeup call */ static void waitforchildren(void); /* Wait for any child process not running */ /* ------------------------------------------------------------------ Global */ const char *prog; /**< The Name of this Program */ struct Run_T Run; /**< Struct holding runtime constants */ Service_T servicelist; /**< The service list (created in p.y) */ Service_T servicelist_conf; /**< The service list in conf file (c. in p.y) */ ServiceGroup_T servicegrouplist;/**< The service group list (created in p.y) */ SystemInfo_T systeminfo; /**< System infomation */ Thread_T heartbeatThread; Sem_T heartbeatCond; Mutex_T heartbeatMutex; static volatile boolean_t heartbeatRunning = false; char *actionnames[] = {"ignore", "alert", "restart", "stop", "exec", "unmonitor", "start", "monitor", ""}; char *modenames[] = {"active", "passive"}; char *onrebootnames[] = {"start", "nostart", "laststate"}; char *checksumnames[] = {"UNKNOWN", "MD5", "SHA1"}; char *operatornames[] = {"less than", "less than or equal to", "greater than", "greater than or equal to", "equal to", "not equal to", "changed"}; char *operatorshortnames[] = {"<", "<=", ">", ">=", "=", "!=", "<>"}; char *servicetypes[] = {"Filesystem", "Directory", "File", "Process", "Remote Host", "System", "Fifo", "Program", "Network"}; char *pathnames[] = {"Path", "Path", "Path", "Pid file", "Path", "", "Path"}; char *icmpnames[] = {"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"}; char *sslnames[] = {"auto", "v2", "v3", "tlsv1", "tlsv1.1", "tlsv1.2", "tlsv1.3"}; char *socketnames[] = {"unix", "IP", "IPv4", "IPv6"}; char *timestampnames[] = {"modify/change time", "access time", "change time", "modify time"}; char *httpmethod[] = {"", "HEAD", "GET"}; /* ------------------------------------------------------------------ Public */ /** * The Prime mover */ int main(int argc, char **argv) { Bootstrap(); // Bootstrap libmonit Bootstrap_setAbortHandler(vLogAbortHandler); // Abort Monit on exceptions thrown by libmonit Bootstrap_setErrorHandler(vLogError); setlocale(LC_ALL, "C"); prog = File_basename(argv[0]); #ifdef HAVE_OPENSSL Ssl_start(); #endif init_env(); handle_options(argc, argv); do_init(); do_action(argc, argv); do_exit(false); return 0; } /** * Wakeup a sleeping monit daemon. * Returns true on success otherwise false */ boolean_t do_wakeupcall() { pid_t pid; if ((pid = exist_daemon()) > 0) { kill(pid, SIGUSR1); LogInfo("Monit daemon with PID %d awakened\n", pid); return true; } return false; } boolean_t interrupt() { return Run.flags & Run_Stopped || Run.flags & Run_DoReload; } /* ----------------------------------------------------------------- Private */ static void _validateOnce() { 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() { /* * Register interest for the SIGTERM signal, * in case we run in daemon mode this signal * will terminate a running daemon. */ signal(SIGTERM, do_destroy); /* * Register interest for the SIGUSER1 signal, * in case we run in daemon mode this signal * will wakeup a sleeping daemon. */ signal(SIGUSR1, do_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, do_destroy); /* * Register interest for the SIGHUP signal, * in case we run in daemon mode this signal * will reload the configuration. */ signal(SIGHUP, do_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 heartbeat mutex and condition */ Mutex_init(heartbeatMutex); Sem_init(heartbeatCond); /* * Get the position of the control file */ if (! Run.files.control) Run.files.control = file_findControlFile(); /* * Initialize the system information data collecting interface */ if (init_system_info()) 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)) exit(1); /* * Initialize the log system */ if (! log_init()) exit(1); /* * Did we find any service ? */ if (! servicelist) { LogError("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(); } /* * Reap any stray child processes we may have created */ atexit(waitforchildren); } /** * Re-Initialize the application - called if a * monit daemon receives the SIGHUP signal. */ static void do_reinit() { LogInfo("Reinitializing Monit -- control file '%s'\n", Run.files.control); /* Wait non-blocking for any children that has exited. Since we reinitialize any information about children we have setup to wait for will be lost. This may create zombie processes until Monit itself exit. However, Monit will wait on all children that has exited before it ifself exit. TODO: Later refactored versions will use a globale process table which a sigchld handler can check */ waitforchildren(); if (Run.mmonits && heartbeatRunning) { Sem_signal(heartbeatCond); Thread_join(heartbeatThread); heartbeatRunning = false; } 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) */ State_save(); State_close(); /* Run the garbage collector */ gc(); if (! parse(Run.files.control)) { LogError("%s stopped -- error parsing 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 (! servicelist) { LogError("No service has been specified\n"); exit(0); } /* Reinitialize Runtime file variables */ file_init(); if (! file_createPidFile(Run.files.pid)) { LogError("%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(); /* 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) { Thread_create(heartbeatThread, heartbeat, NULL); heartbeatRunning = true; } } /** * Dispatch to the submitted action - actions are program arguments */ static void do_action(int argc, char **args) { char *action = args[optind]; 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 = args[++optind]; if (Run.mygroup || service) { int errors = 0; List_T services = List_new(); if (Run.mygroup) { for (ServiceGroup_T sg = servicegrouplist; 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; List_append(services, s->name); } break; } } if (List_length(services) == 0) { List_free(&services); LogError("Group '%s' not found\n", Run.mygroup); exit(1); } } else if (IS(service, "all")) { for (Service_T s = servicelist; 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 { LogError("Please specify a service name or 'all' after %s\n", action); exit(1); } } else if (IS(action, "reload")) { LogInfo("Reinitializing %s daemon\n", prog); kill_daemon(SIGHUP); } else if (IS(action, "status")) { char *service = args[++optind]; if (! HttpClient_status(Run.mygroup, service)) exit(1); } else if (IS(action, "summary")) { char *service = args[++optind]; if (! HttpClient_summary(Run.mygroup, service)) exit(1); } else if (IS(action, "report")) { char *type = args[++optind]; if (! HttpClient_report(type)) exit(1); } else if (IS(action, "procmatch")) { char *pattern = args[++optind]; 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 = args[++optind]; HttpClient_status(Run.mygroup, service); } else { _validateOnce(); } exit(1); } else { LogError("Invalid argument -- %s (-h will show valid arguments)\n", action); exit(1); } } /** * Finalize monit */ static void do_exit(boolean_t saveState) { set_signal_block(); Run.flags |= Run_Stopped; if ((Run.flags & Run_Daemon) && ! (Run.flags & Run_Once)) { if (can_http()) monit_http(Httpd_Stop); if (Run.mmonits && heartbeatRunning) { Sem_signal(heartbeatCond); Thread_join(heartbeatThread); heartbeatRunning = false; } LogInfo("Monit daemon with pid [%d] stopped\n", (int)getpid()); /* 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(); } 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 deamon mode. */ static void do_default() { if (Run.flags & Run_Daemon) { if (do_wakeupcall()) exit(0); Run.flags &= ~Run_Once; if (can_http()) { if (Run.httpd.flags & Httpd_Net) LogInfo("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) LogInfo("Starting Monit %s daemon with http interface at %s\n", VERSION, Run.httpd.socket.unix.path); } else { LogInfo("Starting Monit %s daemon\n", VERSION); } if (! (Run.flags & Run_Foreground)) daemonize(); if (! file_createPidFile(Run.files.pid)) { LogError("Monit daemon died\n"); exit(1); } if (! State_open()) exit(1); State_restore(); atexit(file_finalize); if (Run.startdelay && State_reboot()) { time_t now = Time_now(); time_t delay = now + Run.startdelay; LogInfo("Monit will delay for %ds on first start after reboot ...\n", Run.startdelay); /* sleep can be interrupted by signal => make sure we paused long enough */ while (now < delay) { sleep((unsigned int)(delay - now)); if (Run.flags & Run_Stopped) do_exit(false); now = Time_now(); } } 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) { Thread_create(heartbeatThread, heartbeat, NULL); heartbeatRunning = true; } while (true) { validate(); /* In the case that there is no pending action then sleep */ if (! (Run.flags & Run_ActionPending) && ! interrupt()) sleep(Run.polltime); if (Run.flags & Run_DoWakeup) { Run.flags &= ~Run_DoWakeup; LogInfo("Awakened by User defined signal 1\n"); } if (Run.flags & Run_Stopped) { do_exit(true); } else if (Run.flags & Run_DoReload) { do_reinit(); } else { State_saveIfDirty(); } } } else { _validateOnce(); } } /** * Handle program options - Options set from the commandline * takes precedence over those found in the control file */ static void handle_options(int argc, char **argv) { int opt; int deferred_opt = 0; opterr = 0; Run.mygroup = NULL; const char *shortopts = "c:d:g:l:p:s:HIirtvVhB"; #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} }; while ((opt = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) #else while ((opt = getopt(argc, argv, shortopts)) != -1) #endif { switch (opt) { case 'c': { char *f = optarg; if (f[0] != SEPARATOR_CHAR) f = File_getRealPath(optarg, (char[PATH_MAX]){}); 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) { LogError("Option -%c requires a natural number\n", opt); exit(1); } break; } case 'g': { Run.mygroup = Str_dup(optarg); break; } case 'l': { Run.files.log = Str_dup(optarg); if (IS(Run.files.log, "syslog")) Run.flags |= Run_UseSyslog; Run.flags |= Run_Log; break; } case 'p': { Run.files.pid = Str_dup(optarg); break; } case 's': { 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++; break; } case 'H': { if (argc > optind) Util_printHash(argv[optind]); else Util_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': { LogError("Option -- %c requires an argument\n", optopt); break; } default: { LogError("Invalid option -- %c (-h will show valid options)\n", optopt); } } exit(1); } } } /* 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() { 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 omited; 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() { 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-2019 Tildeslash Ltd. All Rights Reserved.\n"); } /** * M/Monit heartbeat thread */ static void *heartbeat(void *args) { set_signal_block(); LogInfo("M/Monit heartbeat started\n"); LOCK(heartbeatMutex) { while (! interrupt()) { MMonit_send(NULL); struct timespec wait = {.tv_sec = Time_now() + Run.polltime, .tv_nsec = 0}; Sem_timeWait(heartbeatCond, heartbeatMutex, wait); } } END_LOCK; #ifdef HAVE_OPENSSL Ssl_threadCleanup(); #endif LogInfo("M/Monit heartbeat stopped\n"); return NULL; } /** * Signalhandler for a daemon reload call */ static RETSIGTYPE do_reload(int sig) { Run.flags |= Run_DoReload; } /** * Signalhandler for monit finalization */ static RETSIGTYPE do_destroy(int sig) { Run.flags |= Run_Stopped; } /** * Signalhandler for a daemon wakeup call */ static RETSIGTYPE do_wakeup(int sig) { Run.flags |= Run_DoWakeup; } /* A simple non-blocking reaper to ensure that we wait-for and reap all/any stray child processes we may have created and not waited on, so we do not create any zombie processes at exit */ static void waitforchildren(void) { while (waitpid(-1, NULL, WNOHANG) > 0) ; } monit-5.26.0/src/protocols/0000775000175000017500000000000013507751326015466 5ustar martinpmartinpmonit-5.26.0/src/protocols/imap.c0000664000175000017500000000441513507751326016564 0ustar martinpmartinp/* * 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' and then send LOGOUT and check for code '* BYE' * * @file */ void check_imap(Socket_T socket) { char buf[512]; const char *ok = "* OK"; const char *bye = "* BYE"; 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); // Logout and check response if (Socket_print(socket, "001 LOGOUT\r\n") < 0) THROW(IOException, "IMAP: logout command error -- %s", STRERROR); 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.26.0/src/protocols/lmtp.c0000664000175000017500000000460413507751326016612 0ustar martinpmartinp/* * 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, 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.26.0/src/protocols/dns.c0000664000175000017500000001176713507751326016432 0ustar martinpmartinp/* * 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.26.0/src/protocols/protocol.h0000664000175000017500000000606113507751326017503 0ustar martinpmartinp/* * 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" #include "socket.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.26.0/src/protocols/default.c0000664000175000017500000000421713507751326017262 0ustar martinpmartinp/* * 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.26.0/src/protocols/dwp.c0000664000175000017500000000410113507751326016420 0ustar martinpmartinp/* * 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.26.0/src/protocols/rsync.c0000664000175000017500000000576313507751326017003 0ustar martinpmartinp/* * 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; char *rsyncd = "@RSYNCD:"; 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.26.0/src/protocols/sip.c0000664000175000017500000001352713507751326016435 0ustar martinpmartinp/* * 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 "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 recieved 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); char *proto = Socket_isSecure(socket) ? "sips" : "sip"; char *transport = ""; 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"); break; } 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%"PRIx64"%s\r\n" "Max-Forwards: %d\r\n" "To: <%s:%s>\r\n" "From: monit <%s:monit@%s>;tag=%"PRIx64"\r\n" "Call-ID: %"PRIx64"\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 System_randomNumber(), // 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 System_randomNumber(), // tag System_randomNumber(), // 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.26.0/src/protocols/ntp3.c0000664000175000017500000000653713507751326016531 0ustar martinpmartinp/* * 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; 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.26.0/src/protocols/nntp.c0000664000175000017500000000415113507751326016612 0ustar martinpmartinp/* * 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.26.0/src/protocols/ldap3.c0000664000175000017500000001267413507751326016647 0ustar martinpmartinp/* * 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 successfull - 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.26.0/src/protocols/clamav.c0000664000175000017500000000344413507751326017102 0ustar martinpmartinp/* * 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.26.0/src/protocols/mysql.c0000664000175000017500000005056713507751326017014 0ustar martinpmartinp/* * 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" #include "sha1.h" // libmonit #include "exceptions/IOException.h" #include "exceptions/ProtocolException.h" /* ----------------------------------------------------------- Definitions */ #define MYSQL_OK 0x00 #define MYSQL_EOF 0xfe #define MYSQL_ERROR 0xff #define COM_QUIT 0x1 #define COM_QUERY 0x3 #define COM_PING 0xe // Capability flags (see http://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 http://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 typedef struct { uint32_t len : 24; uint32_t seq : 8; // Data buffer char buf[STRLEN + 1]; // State char *cursor; char *limit; } mysql_request_t; typedef struct { // Data buffer char buf[STRLEN + 4 + 1]; // reserve 4 bytes for header // Parser state char *cursor; char *limit; // Header uint32_t len; uint8_t seq; uint8_t header; // Packet specific data union { struct { uint16_t code; char sql_state_marker; char sql_state[5]; char *message; } error; struct { char *version; uint32_t connectionid; uint8_t characterset; uint16_t status; uint32_t capabilities; uint8_t authdatalen; char authdata[21]; } handshake; } data; } mysql_response_t; typedef enum { MySQL_Init = 0, MySQL_Handshake, MySQL_Ok, MySQL_Eof, MySQL_Error } __attribute__((__packed__)) mysql_state_t; typedef struct mysql_t { mysql_state_t state; mysql_response_t response; mysql_request_t request; Socket_T socket; Port_T port; uint32_t capabilities; } 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 char *data, unsigned long 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 http://dev.mysql.com/doc/internals/en/packet-OK_Packet.html) static void _responseOk(mysql_t *mysql) { mysql->state = MySQL_Ok; } // EOF packet (see http://dev.mysql.com/doc/internals/en/packet-EOF_Packet.html) static void _responseEof(mysql_t *mysql) { mysql->state = MySQL_Eof; } // ERR packet (see http://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 handshake packet (see http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::Handshake) static void _responseHandshake(mysql_t *mysql) { mysql->state = MySQL_Handshake; // 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->response.data.handshake.authdata, 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 |= _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->response.data.handshake.authdata + 8, 13, "%s", _getString(&mysql->response)); // auth_plugin_data_part_2 mysql->capabilities = mysql->response.data.handshake.capabilities; // Save capabilities DEBUG("MySQL Server: Protocol: %d, Version: %s, Connection ID: %d\n", mysql->response.header, mysql->response.data.handshake.version, mysql->response.data.handshake.connectionid); } // Response handler static void _response(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 > STRLEN) THROW(ProtocolException, "Invalid handshake packet length -- not MySQL protocol"); if (mysql->response.seq != 0) THROW(ProtocolException, "Invalid handshake packet sequence id -- not MySQL protocol"); } mysql->response.len = mysql->response.len > STRLEN ? STRLEN : 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_EOF: _responseEof(mysql); break; case MYSQL_ERROR: _responseError(mysql); break; default: _responseHandshake(mysql); break; } } /* ------------------------------------------------------ Request handlers */ // Set the password (see http://dev.mysql.com/doc/internals/en/secure-password-authentication.html): static char *_password(char result[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; } // Initiate the request static void _initRequest(mysql_t *mysql, uint8_t sequence) { memset(&mysql->request, 0, sizeof(mysql_request_t)); mysql->request.seq = 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->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\n", STRERROR); } // Hadshake response packet (see http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::HandshakeResponse) static void _requestHandshake(mysql_t *mysql) { ASSERT(mysql->state == MySQL_Handshake); _initRequest(mysql, 1); _setUInt4(&mysql->request, CLIENT_LONG_PASSWORD | CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION); // 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 (mysql->port->parameters.mysql.password) { _setUInt1(&mysql->request, SHA1_DIGEST_SIZE); // authdatalen _setData(&mysql->request, _password((char[SHA1_DIGEST_SIZE]){0}, mysql->port->parameters.mysql.password, mysql->response.data.handshake.authdata), SHA1_DIGEST_SIZE); // password } else { _setUInt1(&mysql->request, 0); // no password } _sendRequest(mysql); } // COM_QUIT packet (see http://dev.mysql.com/doc/internals/en/com-quit.html) static void _requestQuit(mysql_t *mysql) { ASSERT(mysql->state == MySQL_Ok); _initRequest(mysql, 0); _setUInt1(&mysql->request, COM_QUIT); _sendRequest(mysql); } // COM_PING packet (see http://dev.mysql.com/doc/internals/en/com-ping.html) static void _requestPing(mysql_t *mysql) { ASSERT(mysql->state == MySQL_Ok); _initRequest(mysql, 0); _setUInt1(&mysql->request, COM_PING); _sendRequest(mysql); } /* // 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 http://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, 0); _setUInt1(&mysql->request, COM_QUERY); _setData(&mysql->request, query, strlen(query)); _sendRequest(mysql); } */ /* ---------------------------------------------------------------- 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 http://dev.mysql.com/doc/internals/en/client-server-protocol.html */ void check_mysql(Socket_T socket) { ASSERT(socket); mysql_t mysql = {.state = MySQL_Init, .socket = socket, .port = Socket_getPort(socket)}; _response(&mysql); if (mysql.state != MySQL_Handshake) THROW(ProtocolException, "Invalid server greeting, the server didn't sent a handshake packet -- not MySQL protocol\n"); _requestHandshake(&mysql); // Check handshake response: if no credentials are set, we allow both Ok/Error as we've sent an anonymous login which may fail, but if credentials are set, we expect Ok only TRY { _response(&mysql); } ELSE { if (mysql.port->parameters.mysql.username) RETHROW; } END_TRY; // If we're logged in, ping and quit if (mysql.state == MySQL_Ok) { _requestPing(&mysql); _response(&mysql); _requestQuit(&mysql); } } monit-5.26.0/src/protocols/ftp.c0000664000175000017500000000427013507751326016426 0ustar martinpmartinp/* * 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.26.0/src/protocols/postfix_policy.c0000664000175000017500000000511713507751326020711 0ustar martinpmartinp/* * 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.26.0/src/protocols/pgsql.c0000664000175000017500000001001613507751326016756 0ustar martinpmartinp/* * 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" /** * PostgreSQL test. * * @file */ void check_pgsql(Socket_T socket) { unsigned char buf[STRLEN]; unsigned char requestLogin[33] = { 0x00, /** Length */ 0x00, 0x00, 0x21, 0x00, /** ProtoVer 3.0 */ 0x03, 0x00, 0x00, 0x75, 0x73, 0x65, 0x72, 0x00, /** user */ 0x72, 0x6f, 0x6f, 0x74, 0x00, /** root */ 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x00, /** database */ 0x72, 0x6f, 0x6f, 0x74, 0x00, /** root */ 0x00 }; /** Doing this is too suspicious maybe. * Type Q, Length 19 and QUERY select 1 as a; */ /** unsigned char requestQuery[20] = { 0x51, 0x00, 0x00, 0x00, 0x13, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x20, 0x31, 0x20, 0x61, 0x73, 0x20, 0x61, 0x3b, 0x00 }; */ unsigned char requestTerm[5] = { 0x58, /** Type X */ 0x00, /** Length */ 0x00, 0x00, 0x04 }; unsigned char responseAuthOk[9] = { 0x52, /** Type R */ 0x00, /** Length */ 0x00, 0x00, 0x08, 0x00, /** OK code 0 */ 0x00, 0x00, 0x00 }; ASSERT(socket); if (Socket_write(socket, (unsigned char *)requestLogin, sizeof(requestLogin)) <= 0) THROW(IOException, "PGSQL: error sending data -- %s", STRERROR); /** Nine-byte is enough to hold Auth-Ok */ if (Socket_read(socket, buf, 9) <= 0) THROW(IOException, "PGSQL: error receiving data -- %s", STRERROR); /** If server insists on auth error it is working anyway */ if (*buf == 'E') return; /** Successful connection */ if (! memcmp((unsigned char *)buf, (unsigned char *)responseAuthOk, 9)) { /** This is where suspicious people can do SELECT query that I dont */ if (Socket_write(socket, (unsigned char *)requestTerm, sizeof(requestTerm)) < 0) THROW(IOException, "PGSQL: connection terminator write error -- %s", STRERROR); return; } /** The last possibility must be that server is demanding password */ if (*buf == 'R') return; THROW(ProtocolException, "PGSQL: unknown error"); } monit-5.26.0/src/protocols/protocol.c0000664000175000017500000000706213507751326017500 0ustar martinpmartinp/* * 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.26.0/src/protocols/websocket.c0000664000175000017500000001351713507751326017627 0ustar martinpmartinp/* * 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. * * http://tools.ietf.org/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 unsigned payload_size = *(buf + 1) & 0x7F; if (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 : "http://www.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.26.0/src/protocols/radius.c0000664000175000017500000001317413507751326017127 0ustar martinpmartinp/* * 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 "protocol.h" // libmonit #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; 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 */ System_random(request + 4, 16); /* sign the packet */ Util_hmacMD5(request, sizeof(request), (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) LogInfo("RADIUS: message fails authentication"); } monit-5.26.0/src/protocols/smtp.c0000664000175000017500000000366413507751326016626 0ustar martinpmartinp/* * 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.26.0/src/protocols/memcache.c0000664000175000017500000001112313507751326017372 0ustar martinpmartinp/* * 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.26.0/src/protocols/rdate.c0000664000175000017500000000404613507751326016735 0ustar martinpmartinp/* * 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.26.0/src/protocols/redis.c0000664000175000017500000000434113507751326016742 0ustar martinpmartinp/* * 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 http://redis.io/topics/protocol * * @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.26.0/src/protocols/fail2ban.c0000664000175000017500000000417313507751326017315 0ustar martinpmartinp/* * 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, (void *)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.26.0/src/protocols/mongodb.c0000664000175000017500000001471613507751326017270 0ustar martinpmartinp/* * 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 int64_t 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 http://docs.mongodb.org/meta-driver/latest/legacy/mongodb-wire-protocol/ and http://bsonspec.org/spec.html * * @file */ void check_mongodb(Socket_T socket) { ASSERT(socket); _ping(socket); _pong(socket); } monit-5.26.0/src/protocols/ssh.c0000664000175000017500000000402513507751326016430 0ustar martinpmartinp/* * 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' implemetation based on RFC (http://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.26.0/src/protocols/apache_status.c0000664000175000017500000002047613507751326020467 0ustar martinpmartinp/* * 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.26.0/src/protocols/mqtt.c0000664000175000017500000002544013507751326016624 0ustar martinpmartinp/* * 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 http://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 http://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 http://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); mqtt_payload_t payload = (mqtt_payload_t)(request->data + request->header.messageLength); strncpy(payload->data, data, dataLength); payload->length = htons(dataLength); request->header.messageLength += sizeof(payload->length) + 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) }; // 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 (Socket_read(mqtt->socket, &response, sizeof(mqtt_connect_response_t)) < 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 http://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.26.0/src/protocols/generic.c0000664000175000017500000001215313507751326017250 0ustar martinpmartinp/* * 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" /* Escape zero i.e. '\0' in expect buffer with "\0" so zero can be tested in expect strings as "\0". If there are no '\0' in the buffer it is returned as it is */ static char *_escapeZeroInExpectBuffer(char *buf, int buflen, int n) { for (int i = 0, j = 0; i < n && j < buflen; i++, j++) { if (buf[j] == '\0') { if (j + 1 < buflen) { memmove(buf + j + 1, buf + j, n - i); buf[j] = '\\'; buf[j + 1] = '0'; j++; } } } 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); 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) _escapeZeroInExpectBuffer(buf, Run.limits.sendExpectBuffer, n); 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.26.0/src/protocols/ldap2.c0000664000175000017500000001266013507751326016641 0ustar martinpmartinp/* * 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 successfull - 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.26.0/src/protocols/pop.c0000664000175000017500000000433013507751326016430 0ustar martinpmartinp/* * 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.26.0/src/protocols/http.c0000664000175000017500000004146313507751326016621 0ustar martinpmartinp/* * 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 "md5.h" #include "sha1.h" #include "base64.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 typedef union ChecksumContext_T { md5_context_t md5; sha1_context_t sha1; } *ChecksumContext_T; /* ----------------------------------------------------------------- Private */ static void _contentVerify(Port_T P, const char *data) { if (P->url_request && P->url_request->regex) { boolean_t 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 void _checksumInit(Port_T P, ChecksumContext_T context) { if (P->parameters.http.checksum) { switch (P->parameters.http.hashtype) { case Hash_Md5: md5_init(&(context->md5)); break; case Hash_Sha1: sha1_init(&(context->sha1)); break; default: THROW(ProtocolException, "HTTP checksum error: Unknown hash type"); } } } static void _checksumFinish(Port_T P, ChecksumContext_T context, MD_T hash) { if (P->parameters.http.checksum) { switch (P->parameters.http.hashtype) { case Hash_Md5: md5_finish(&(context->md5), (md5_byte_t *)hash); break; case Hash_Sha1: sha1_finish(&(context->sha1), (unsigned char *)hash); break; default: THROW(ProtocolException, "HTTP checksum error: Unknown hash type"); } } } static void _checksumAppend(Port_T P, ChecksumContext_T context, const char *input, int inputLength) { if (P->parameters.http.checksum) { switch (P->parameters.http.hashtype) { case Hash_Md5: md5_append(&(context->md5), (const md5_byte_t *)input, inputLength); break; case Hash_Sha1: sha1_append(&(context->sha1), (const unsigned char *)input, inputLength); break; default: THROW(ProtocolException, "HTTP checksum error: Unknown hash type"); } } } static void _checksumVerify(Port_T P, MD_T hash) { if (P->parameters.http.checksum) { int keyLength = 0; switch (P->parameters.http.hashtype) { case Hash_Md5: keyLength = 16; /* Raw key bytes not string chars! */ break; case Hash_Sha1: keyLength = 20; /* Raw key bytes not string chars! */ break; default: THROW(ProtocolException, "HTTP checksum error: Unknown hash type"); } MD_T hashString = {}; if (strncasecmp(Util_digest2Bytes((unsigned char *)hash, keyLength, hashString), P->parameters.http.checksum, keyLength * 2) != 0) THROW(ProtocolException, "HTTP checksum error: Data checksum mismatch (expected %s got %s)", P->parameters.http.checksum, hashString); DEBUG("HTTP: Succeeded testing data checksum\n"); } } static boolean_t _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 _getChunkSize(Socket_T socket) { char buf[9]; unsigned 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(Port_T P, 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, volatile 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((void *)*data, *haveBytes + wantBytes + 1); *haveBytes += _readDataFromSocket(P, socket, (void *)*data + *haveBytes, wantBytes); _checksumAppend(P, context, (const char *)*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(P, socket, (void *)*data, readBytes); _checksumAppend(P, context, (const char *)*data, readBytes); *haveBytes += readBytes; } } } static void _processBodyChunked(Socket_T socket, Port_T P, volatile char **data, 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(P, socket, crlf, 2); } } static void _processBodyContentLength(Socket_T socket, Port_T P, volatile 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 > 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 _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, Port_T P, void (**processBody)(Socket_T socket, Port_T P, volatile char **data, int *contentLength, ChecksumContext_T context), int *contentLength) { char buf[512] = {}; 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, "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: Ilegal 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, volatile char **data, int *contentLength, ChecksumContext_T context) = NULL; _processStatus(socket, P); _processHeaders(socket, P, &processBody, &contentLength); if ((P->url_request && P->url_request->regex) || P->parameters.http.checksum) { if (processBody) { MD_T hash = {}; volatile char *data = CALLOC(1, BUFSIZE); union ChecksumContext_T context = {}; TRY { // Read data _checksumInit(P, &context); processBody(socket, P, &data, &contentLength, &context); _checksumFinish(P, &context, hash); // Perform tests _checksumVerify(P, hash); _contentVerify(P, (char *)data); } FINALLY { free((void *)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[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, (void*)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.26.0/src/protocols/sieve.c0000664000175000017500000000470013507751326016746 0ustar martinpmartinp/* * 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.26.0/src/protocols/spamassassin.c0000664000175000017500000000360413507751326020342 0ustar martinpmartinp/* * 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.26.0/src/protocols/tns.c0000664000175000017500000001022013507751326016431 0ustar martinpmartinp/* * 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.26.0/src/protocols/gps.c0000664000175000017500000000430313507751326016423 0ustar martinpmartinp/* * 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.26.0/src/md5_crypt.h0000664000175000017500000000316613507751326015527 0ustar martinpmartinp/* * 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.26.0/src/net.c0000664000175000017500000005323013507751326014377 0ustar martinpmartinp/* * 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; } static void __attribute__((format (printf, 3, 4))) _LogWarningOrError(int attempt, int maxAttempts, const char *s, ...) { ASSERT(s); va_list ap; va_start(ap, s); if (attempt < maxAttempts) { vLogWarning(s, ap); } else { vLogError(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", socketnames[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) LogError("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) LogError("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) LogError("Ping: setsockopt for TTL failed -- %s\n", System_getLastError()); break; #ifdef HAVE_IPV6 case AF_INET6: if (setsockopt(socket, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &ttl, sizeof(ttl)) < 0) LogError("Ping: setsockopt for multicast hops failed -- %s\n", System_getLastError()); if (setsockopt(socket, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &ttl, sizeof(ttl)) < 0) LogError("Ping: setsockopt for unicast hops failed -- %s\n", System_getLastError()); if (setsockopt(socket, IPPROTO_ICMPV6, ICMP6_FILTER, &filter, sizeof(struct icmp6_filter)) < 0) LogError("Ping: setsockopt for filter failed -- %s\n", System_getLastError()); break; #endif default: break; } } static boolean_t _sendPing(const char *hostname, int socket, struct addrinfo *addr, int size, int retry, int maxretries, int id, int64_t started) { char buf[ICMP_MAXSIZE] = {}; int header_len = 0; int 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((int64_t *)(out_icmp4->icmp_data), &started, sizeof(int64_t)); // 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, 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((int64_t *)(out_icmp6 + 1), &started, sizeof(int64_t)); // 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)) { _LogWarningOrError(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) { _LogWarningOrError(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, int64_t 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.; } int64_t stopped = Time_micro(); struct sockaddr_storage in_addr; socklen_t addrlen = sizeof(in_addr); boolean_t 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) { _LogWarningOrError(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: LogError("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(int64_t)); 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 } } _LogWarningOrError(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 = {}; 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: LogError("Invalid socket family %d\n", family); return response; } int status = getaddrinfo(hostname, NULL, &hints, &result); if (status) { LogError("Ping for %s -- getaddrinfo failed: %s\n", hostname, status == EAI_SYSTEM ? STRERROR : gai_strerror(status)); return response; } 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: break; } if (s >= 0) { if (outgoing->ip && bind(s, (struct sockaddr *)&(outgoing->addr), outgoing->addrlen) < 0) { LogError("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++) { int64_t 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 { LogError("Ping for %s -- cannot create socket: %s\n", hostname, STRERROR); } goto error; } } } error: freeaddrinfo(result); return response; } monit-5.26.0/src/monit.h0000664000175000017500000016334713507751326014757 0ustar martinpmartinp/* * 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_MACH_BOOLEAN_H #include #endif #ifdef HAVE_UVM_UVM_PARAM_H #include #endif #ifdef HAVE_VM_VM_H #include #endif #ifdef HAVE_INTTYPES_H #include #else #define PRIu64 "llu" #endif //FIXME: we can export this type in libmonit #ifndef HAVE_BOOLEAN_T #undef true #undef false typedef enum { false = 0, true } __attribute__((__packed__)) boolean_t; #else #define false 0 #define true 1 #endif #include "Ssl.h" #include "Address.h" // libmonit #include "system/Command.h" #include "system/Process.h" #include "util/Str.h" #include "util/StringBuffer.h" #include "system/Link.h" #include "statistics/Statistics.h" #include "thread/Thread.h" #define MONITRC "monitrc" #define TIMEFORMAT "%Z %b %e %T" #define STRERROR strerror(errno) #define STRLEN 256 #ifndef USEC_PER_SEC #define USEC_PER_SEC 1000000L #endif #define USEC_PER_MSEC 1000L #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 */ } __attribute__((__packed__)) Run_Flags; typedef enum { ProcessEngine_None = 0x0, ProcessEngine_CollectCommandLine = 0x1 } __attribute__((__packed__)) ProcessEngine_Flags; typedef enum { Httpd_Start = 1, Httpd_Stop } __attribute__((__packed__)) Httpd_Action; typedef enum { Every_Cycle = 0, Every_SkipCycles, Every_Cron, Every_NotInCron } __attribute__((__packed__)) Every_Type; typedef enum { State_Succeeded = 0x0, State_Failed = 0x1, State_Changed = 0x2, State_ChangedNot = 0x4, State_Init = 0x8, State_None = State_Init // Alias } __attribute__((__packed__)) State_Type; typedef enum { Operator_Less = 0, Operator_LessOrEqual, Operator_Greater, Operator_GreaterOrEqual, Operator_Equal, Operator_NotEqual, Operator_Changed } __attribute__((__packed__)) Operator_Type; typedef enum { Timestamp_Default = 0, Timestamp_Access, Timestamp_Change, Timestamp_Modification } __attribute__((__packed__)) 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 } __attribute__((__packed__)) Httpd_Flags; typedef enum { Http_Head = 1, Http_Get } __attribute__((__packed__)) Http_Method; typedef enum { Time_Second = 1, Time_Minute = 60, Time_Hour = 3600, Time_Day = 86400, Time_Month = 2678400 } __attribute__((__packed__)) Time_Type; typedef enum { Action_Ignored = 0, Action_Alert, Action_Restart, Action_Stop, Action_Exec, Action_Unmonitor, Action_Start, Action_Monitor } __attribute__((__packed__)) Action_Type; typedef enum { Monitor_Active = 0, Monitor_Passive } __attribute__((__packed__)) Monitor_Mode; typedef enum { Onreboot_Start = 0, Onreboot_Nostart, Onreboot_Laststate } __attribute__((__packed__)) Onreboot_Type; typedef enum { Monitor_Not = 0x0, Monitor_Yes = 0x1, Monitor_Init = 0x2, Monitor_Waiting = 0x4 } __attribute__((__packed__)) Monitor_State; typedef enum { Connection_Failed = 0, Connection_Ok, Connection_Init } __attribute__((__packed__)) 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 } __attribute__((__packed__)) 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_CpuPercentTotal, Resource_SwapPercent, Resource_SwapKbyte, Resource_Threads, Resource_ReadBytes, Resource_ReadOperations, Resource_WriteBytes, Resource_WriteOperations, Resource_ServiceTime, Resource_LoadAveragePerCore1m, Resource_LoadAveragePerCore5m, Resource_LoadAveragePerCore15m } __attribute__((__packed__)) Resource_Type; typedef enum { Digest_Cleartext = 1, Digest_Crypt, Digest_Md5, Digest_Pam } __attribute__((__packed__)) Digest_Type; typedef enum { Unit_Byte = 1, Unit_Kilobyte = 1024, Unit_Megabyte = 1048576, Unit_Gigabyte = 1073741824 } __attribute__((__packed__)) Unit_Type; typedef enum { Hash_Unknown = 0, Hash_Md5, Hash_Sha1, Hash_Default = Hash_Md5 } __attribute__((__packed__)) Hash_Type; typedef enum { Handler_Succeeded = 0x0, Handler_Alert = 0x1, Handler_Mmonit = 0x2, Handler_Max = Handler_Mmonit } __attribute__((__packed__)) Handler_Type; typedef enum { MmonitCompress_Init = 0, MmonitCompress_No, MmonitCompress_Yes } __attribute__((__packed__)) MmonitCompress_Type; /* 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 #include "socket.h" /** ------------------------------------------------- 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 LogDebug #define FLAG(x, y) (x & y) == y #define NVLSTR(x) (x ? x : "") /** ------------------------------------------ Simple Assert Exception macro */ #define ASSERT(e) do { if (!(e)) { LogCritical("AssertException: " #e \ " at %s:%d\naborting..\n", __FILE__, __LINE__); abort(); } } while (0) /* --------------------------------------------------------- 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 { uint32_t sendExpectBuffer; /**< Maximum send/expect response length [B] */ uint32_t fileContentBuffer; /**< Maximum tested file content length [B] */ uint32_t httpContentBuffer; /**< Maximum tested HTTP content length [B] */ uint32_t programOutput; /**< Program output truncate limit [B] */ uint32_t networkTimeout; /**< Default network timeout [ms] */ uint32_t programTimeout; /**< Default program timeout [ms] */ uint32_t stopTimeout; /**< Default stop timeout [ms] */ uint32_t startTimeout; /**< Default start timeout [ms] */ uint32_t restartTimeout; /**< Default restart 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 */ boolean_t has_uid; /**< true if a new uid is defined for this Command */ boolean_t 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 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 */ uint8_t count; /**< Event count needed to trigger the action */ uint8_t cycles; /**< Cycles during which count limit can be reached */ uint8_t 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 */ boolean_t 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 */ /** 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 */ boolean_t 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 { struct { int count; /**< Number of CPUs */ struct { float user; /**< Total CPU in use in user space [%] */ float system; /**< Total CPU in use in kernel space [%] */ float wait; /**< Total CPU in use in waiting [%] */ } usage; } cpu; struct { uint64_t size; /**< Maximal system real memory */ struct { float percent; /**< Total real memory in use in the system */ uint64_t bytes; /**< Total real memory in use in the system */ } usage; } memory; struct { uint64_t size; /**< Swap size */ struct { float percent; /**< Total swap in use in the system */ uint64_t bytes; /**< Total swap in use in the system */ } usage; } swap; 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 */ uint64_t booted; /**< System boot time (seconds since UNIX epoch, using platform-agnostic uint64_t) */ 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; /** 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 */ 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 */ double response; /**< Socket connection response time [ms] */ 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 occurence */ /** 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) */ boolean_t 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; } mysql; 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 */ Connection_State is_available; /**< Flag for the server is availability */ Socket_Family family; /**< ICMP family used for connection */ double response; /**< ICMP ECHO response time [ms] */ Outgoing_T outgoing; /**< Outgoing address */ EventAction_T action; /**< Description of the action upon event occurence */ /** 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_escaped; /**< URL 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 occurence */ /** For internal use */ struct Resource_T *next; /**< next resource in chain */ } *Resource_T; /** Defines timestamp object */ typedef struct Timestamp_T { boolean_t initialized; /**< true if timestamp was initialized */ boolean_t test_changes; /**< true if we only should test for changes */ Timestamp_Type type; Operator_Type operator; /**< Comparison operator */ uint64_t time; /**< Timestamp watermark */ time_t lastTimestamp; /**< Last timestamp (context depends on type) */ EventAction_T action; /**< Description of the action upon event occurence */ /** 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 suports both the old cycle based every statement and the new cron-format version */ typedef struct Every_T { Every_Type type; /**< 0 = not set, 1 = cycle, 2 = cron, 3 = negated cron */ 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 { boolean_t 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 occurence */ /** 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 { boolean_t initialized; /**< true if size was initialized */ boolean_t 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 occurence */ /** For internal use */ struct Size_T *next; /**< next size in chain */ } *Size_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 occurence */ /** For internal use */ struct Uptime_T *next; /**< next uptime in chain */ } *Uptime_T; typedef struct LinkStatus_T { EventAction_T action; /**< Description of the action upon event occurence */ /** 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 occurence */ /** 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 occurence */ /** 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 occurence */ /** For internal use */ struct Bandwidth_T *next; /**< next bandwidth in chain */ } *Bandwidth_T; /** Defines checksum object */ typedef struct Checksum_T { boolean_t initialized; /**< true if checksum was initialized */ boolean_t 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 */ MD_T hash; /**< A checksum hash computed for the path */ EventAction_T action; /**< Description of the action upon event occurence */ } *Checksum_T; /** Defines permission object */ typedef struct Perm_T { boolean_t test_changes; /**< true if we only should test for changes */ int perm; /**< Access permission */ EventAction_T action; /**< Description of the action upon event occurence */ } *Perm_T; /** Defines match object */ typedef struct Match_T { boolean_t ignore; /**< Ignore match */ boolean_t 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 occurence */ /** For internal use */ struct Match_T *next; /**< next match in chain */ } *Match_T; /** Defines uid object */ typedef struct Uid_T { uid_t uid; /**< Owner's uid */ EventAction_T action; /**< Description of the action upon event occurence */ } *Uid_T; /** Defines gid object */ typedef struct Gid_T { gid_t gid; /**< Owner's gid */ EventAction_T action; /**< Description of the action upon event occurence */ } *Gid_T; typedef struct SecurityAttribute_T { char *attribute; /**< Security attribute */ EventAction_T action; /**< Description of the action upon event occurence */ /** For internal use */ struct SecurityAttribute_T *next; } *SecurityAttribute_T; /** Defines pid object */ typedef struct Pid_T { EventAction_T action; /**< Description of the action upon event occurence */ /** For internal use */ struct Pid_T *next; /**< next pid in chain */ } *Pid_T; typedef struct FsFlag_T { EventAction_T action; /**< Description of the action upon event occurence */ /** For internal use */ struct FsFlag_T *next; } *FsFlag_T; typedef struct NonExist_T { EventAction_T action; /**< Description of the action upon event occurence */ /** For internal use */ struct NonExist_T *next; } *NonExist_T; typedef struct Exist_T { EventAction_T action; /**< Description of the action upon event occurence */ /** For internal use */ struct Exist_T *next; } *Exist_T; /** Defines filesystem configuration */ typedef struct FileSystem_T { Resource_Type resource; /**< Whether to check inode or space */ Operator_Type operator; /**< Comparison operator */ //FIXME: union long long limit_absolute; /**< Watermark - blocks */ float limit_percent; /**< Watermark - percent */ EventAction_T action; /**< Description of the action upon event occurence */ /** For internal use */ struct FileSystem_T *next; /**< next filesystem in chain */ } *FileSystem_T; typedef struct IOStatistics_T { struct Statistics_T operations; /**< Number of operations completed */ struct Statistics_T bytes; /**< Number of bytes handled by operations */ } *IOStatistics_T; typedef struct Device_T { boolean_t mounted; int generation; int instance; char partition; char device[PATH_MAX]; char mountpoint[PATH_MAX]; char key[PATH_MAX]; char module[256]; char type[64]; uint64_t flags; boolean_t (*getDiskUsage)(void *); boolean_t (*getDiskActivity)(void *); } *Device_T; typedef struct TimestampInfo_T { uint64_t access; uint64_t change; uint64_t modify; } *TimestampInfo_T; typedef struct FileSystemInfo_T { long long f_blocks; /**< Total data blocks in filesystem */ long long f_blocksfree; /**< Free blocks available to non-superuser */ long long f_blocksfreetotal; /**< Free blocks in filesystem */ long long f_blocksused; /**< Used space total blocks */ long long f_files; /**< Total file nodes in filesystem */ long long f_filesfree; /**< Free file nodes in filesystem */ long long f_filesused; /**< Used inode total objects */ float inode_percent; /**< Used inode percentage */ float space_percent; /**< Used space percentage */ int f_bsize; /**< Transfer block size */ int uid; /**< Owner's uid */ int gid; /**< Owner's gid */ int mode; /**< Permission */ char flags[STRLEN]; /**< Filesystem flags */ boolean_t flagsChanged; /**< True if filesystem flags changed */ struct IOStatistics_T read; /**< Read statistics */ struct IOStatistics_T write; /**< Write statistics */ struct { struct Statistics_T read; /**< Time spend by read [ms] */ struct Statistics_T write; /**< Time spend by write [ms] */ struct Statistics_T wait; /**< Time spend in wait queue [ms] */ struct Statistics_T run; /**< Time spend in run queue [ms] */ } time; struct Device_T object; /**< Device object */ } *FileSystemInfo_T; typedef struct FileInfo_T { struct TimestampInfo_T timestamp; int mode; /**< Permission */ int uid; /**< Owner's uid */ int gid; /**< Owner's gid */ off_t size; /**< Size */ off_t readpos; /**< Position for regex matching */ ino_t inode; /**< Inode */ ino_t inode_prev; /**< Previous inode for regex matching */ MD_T cs_sum; /**< Checksum */ //FIXME: allocate dynamically only when necessary } *FileInfo_T; typedef struct DirectoryInfo_T { struct TimestampInfo_T timestamp; int mode; /**< Permission */ int uid; /**< Owner's uid */ int gid; /**< Owner's gid */ } *DirectoryInfo_T; typedef struct FifoInfo_T { struct TimestampInfo_T timestamp; int mode; /**< Permission */ int uid; /**< Owner's uid */ int gid; /**< Owner's gid */ } *FifoInfo_T; typedef struct ProcessInfo_T { boolean_t zombie; pid_t _pid; /**< Process PID from last cycle */ pid_t _ppid; /**< Process parent PID from last cycle */ pid_t pid; /**< Process PID from actual cycle */ pid_t ppid; /**< Process parent PID from actual cycle */ int uid; /**< Process UID */ int euid; /**< Effective Process UID */ int gid; /**< Process GID */ int threads; int children; uint64_t mem; uint64_t total_mem; float mem_percent; /**< percentage */ float total_mem_percent; /**< percentage */ float cpu_percent; /**< percentage */ float total_cpu_percent; /**< percentage */ time_t uptime; /**< Process uptime */ struct IOStatistics_T read; /**< Read statistics */ struct IOStatistics_T write; /**< Write statistics */ char secattr[STRLEN]; /**< Security attributes */ } *ProcessInfo_T; typedef struct NetInfo_T { Link_T stats; } *NetInfo_T; /** Defines service data */ typedef union Info_T { //FIXME: move global SystemInfo_T systeminfo here (for System service context) DirectoryInfo_T directory; FifoInfo_T fifo; FileInfo_T file; FileSystemInfo_T filesystem; NetInfo_T net; ProcessInfo_T process; } *Info_T; /** Defines service data */ //FIXME: use union for type-specific rules typedef struct Service_T { /** Common parameters */ char *name; /**< Service descriptive name */ char *name_escaped; /**< Service name URL escaped */ State_Type (*check)(struct Service_T *);/**< Service verification function */ boolean_t visited; /**< Service visited flag, set if dependencies are used */ Service_Type type; /**< Monitored service type */ Monitor_State monitor; /**< Monitor state flag */ Monitor_Mode mode; /**< Monitoring mode for the service */ Onreboot_Type onreboot; /**< On reboot mode */ Action_Type doaction; /**< Action scheduled by http thread */ int ncycle; /**< The number of the current cycle */ int nstart; /**< The number of current starts with this service */ Every_T every; /**< Timespec for when to run check of service */ command_t start; /**< The start command for the service */ command_t stop; /**< The stop command for the service */ command_t restart; /**< The restart command for the service */ Program_T program; /**< Program execution check */ Dependant_T dependantlist; /**< Dependant service list */ Mail_T maillist; /**< Alert notification mailinglist */ /** Test rules and event handlers */ ActionRate_T actionratelist; /**< ActionRate check list */ Checksum_T checksum; /**< Checksum check */ FileSystem_T filesystemlist; /**< Filesystem check list */ Icmp_T icmplist; /**< ICMP check list */ Perm_T perm; /**< Permission check */ Port_T portlist; /**< Portnumbers to check */ Port_T socketlist; /**< Unix sockets to check */ Resource_T resourcelist; /**< Resouce check list */ Size_T sizelist; /**< Size check list */ Uptime_T uptimelist; /**< Uptime check list */ Match_T matchlist; /**< Content Match list */ Match_T matchignorelist; /**< Content Match ignore list */ Timestamp_T timestamplist; /**< Timestamp check list */ Pid_T pidlist; /**< Pid check list */ Pid_T ppidlist; /**< PPid check list */ Status_T statuslist; /**< Program execution status check list */ FsFlag_T fsflaglist; /**< Action upon filesystem flags change */ NonExist_T nonexistlist; /**< Actions if test subject does not exist */ Exist_T existlist; /**< Actions if test subject exist */ Uid_T uid; /**< Uid check */ Uid_T euid; /**< Effective Uid check */ Gid_T gid; /**< Gid check */ SecurityAttribute_T secattrlist; /**< Security attributes list */ LinkStatus_T linkstatuslist; /**< Network link status list */ LinkSpeed_T linkspeedlist; /**< Network link speed list */ LinkSaturation_T linksaturationlist; /**< Network link saturation list */ Bandwidth_T uploadbyteslist; /**< Upload bytes check list */ Bandwidth_T uploadpacketslist; /**< Upload packets check list */ Bandwidth_T downloadbyteslist; /**< Download bytes check list */ Bandwidth_T downloadpacketslist; /**< Download packets check list */ /** General event handlers */ EventAction_T action_DATA; /**< Description of the action upon event */ EventAction_T action_EXEC; /**< Description of the action upon event */ EventAction_T action_INVALID; /**< Description of the action upon event */ /** Internal monit events */ EventAction_T action_MONIT_START; /**< Monit instance start/reload action */ EventAction_T action_MONIT_STOP; /**< Monit instance stop action */ EventAction_T action_ACTION; /**< Action requested by CLI or GUI */ /** Runtime parameters */ int error; /**< Error flags bitmap */ int error_hint; /**< Failed/Changed hint for error bitmap */ union Info_T inf; /**< Service check result */ struct timeval collected; /**< When were data collected */ //FIXME: replace with uint64_t? (all places where timeval is used) ... Time_milli()? char *token; /**< Action token */ /** Events */ struct myevent { #define EVENT_VERSION 4 /**< The event structure version */ long id; /**< The event identification */ struct timeval collected; /**< When the event occurred */ struct Service_T *source; /**< Event source */ Monitor_Mode mode; /**< Monitoring mode for the service */ Service_Type type; /**< Monitored service type */ State_Type state; /**< Test state */ boolean_t state_changed; /**< true if state changed */ Handler_Type flag; /**< The handlers state flag */ long long state_map; /**< Event bitmap for last cycles */ unsigned int count; /**< The event rate */ char *message; /**< Optional message describing the event */ EventAction_T action; /**< Description of the event action */ /** For internal use */ struct myevent *next; /**< next event in chain */ } *eventlist; /**< Pending events list */ /** Context specific parameters */ char *path; /**< Path to the filesys, file, directory or process pid file */ /** For internal use */ Mutex_T mutex; /**< Mutex used for action synchronization */ struct Service_T *next; /**< next service in chain */ struct Service_T *next_conf; /**< next service according to conf file */ struct Service_T *next_depend; /**< next depend service in chain */ } *Service_T; typedef struct myevent *Event_T; typedef struct ServiceGroup_T { char *name; /**< name of service group */ List_T members; /**< Service group members */ /** For internal use */ struct ServiceGroup_T *next; /**< next service group in chain */ } *ServiceGroup_T; /** Data for application runtime */ struct Run_T { uint8_t debug; /**< Debug level */ volatile Run_Flags flags; Handler_Type handler_flag; /**< The handlers state flag */ Onreboot_Type onreboot; struct { char *control; /**< The file to read configuration from */ char *log; /**< The file to write logdata into */ char *pid; /**< This programs pidfile */ char *id; /**< The file with unique monit id */ char *state; /**< The file with the saved runtime state */ } files; char *mygroup; /**< Group Name of the Service */ MD_T id; /**< Unique monit id */ Limits_T limits; /**< Default limits */ struct SslOptions_T ssl; /**< Default SSL options */ int polltime; /**< In deamon mode, the sleeptime (sec) between run */ int startdelay; /**< the sleeptime [s] on first start after machine boot */ int facility; /** The facility to use when running openlog() */ int eventlist_slots; /**< The event queue size - number of slots */ int mailserver_timeout; /**< Connect and read timeout ms for a SMTP server */ time_t incarnation; /**< Unique ID for running monit instance */ int handler_queue[Handler_Max + 1]; /**< The handlers queue counter */ Service_T system; /**< The general system service */ char *eventlist_dir; /**< The event queue base directory */ /** An object holding Monit HTTP interface setup */ struct { Httpd_Flags flags; struct { struct { int port; char *address; struct SslOptions_T ssl; } net; struct { int uid; int gid; int permission; char *path; } unix; } socket; Auth_T credentials; } httpd; /** An object holding program relevant "environment" data, see: env.c */ struct myenvironment { char *user; /**< The the effective user running this program */ char *home; /**< Users home directory */ char *cwd; /**< Current working directory */ } Env; char *mail_hostname; /**< Used in HELO/EHLO/MessageID when sending mail */ Mail_T maillist; /**< Global alert notification mailinglist */ MailServer_T mailservers; /**< List of MTAs used for alert notification */ Mmonit_T mmonits; /**< Event notification and status receivers list */ Auth_T mmonitcredentials; /**< Pointer to selected credentials or NULL */ /** User selected standard mail format */ struct myformat { Address_T from; /**< The standard mail from address */ Address_T replyto; /**< Optional reply-to header */ char *subject; /**< The standard mail subject */ char *message; /**< The standard mail message */ } MailFormat; Mutex_T mutex; /**< Mutex used for service data synchronization */ }; /* -------------------------------------------------------- Global variables */ extern const char *prog; extern struct Run_T Run; extern Service_T servicelist; extern Service_T servicelist_conf; extern ServiceGroup_T servicegrouplist; extern SystemInfo_T systeminfo; extern char *actionnames[]; extern char *modenames[]; extern char *onrebootnames[]; extern char *checksumnames[]; extern char *operatornames[]; extern char *operatorshortnames[]; extern char *servicetypes[]; extern char *pathnames[]; extern char *icmpnames[]; extern char *sslnames[]; extern char *socketnames[]; extern char *timestampnames[]; extern char *httpmethod[]; /* ------------------------------------------------------- Public prototypes */ #include "util.h" #include "file.h" // libmonit #include "system/Mem.h" /* FIXME: move remaining prototypes into seperate header-files */ boolean_t parse(char *); boolean_t control_service(const char *, Action_Type); boolean_t control_service_string(List_T, const char *); void spawn(Service_T, command_t, Event_T); boolean_t log_init(void); void LogEmergency(const char *, ...) __attribute__((format (printf, 1, 2))); void LogAlert(const char *, ...) __attribute__((format (printf, 1, 2))); void LogCritical(const char *, ...) __attribute__((format (printf, 1, 2))); void LogError(const char *, ...) __attribute__((format (printf, 1, 2))); void LogWarning(const char *, ...) __attribute__((format (printf, 1, 2))); void LogNotice(const char *, ...) __attribute__((format (printf, 1, 2))); void LogInfo(const char *, ...) __attribute__((format (printf, 1, 2))); void LogDebug(const char *, ...) __attribute__((format (printf, 1, 2))); void vLogEmergency(const char *, va_list ap); void vLogAlert(const char *, va_list ap); void vLogCritical(const char *, va_list ap); void vLogError(const char *, va_list ap); void vLogWarning(const char *,va_list ap); void vLogNotice(const char *, va_list ap); void vLogInfo(const char *, va_list ap); void vLogDebug(const char *, va_list ap); void vLogAbortHandler(const char *s, va_list ap); void log_close(void); #ifndef HAVE_VSYSLOG #ifdef HAVE_SYSLOG void vsyslog (int, const char *, va_list); #endif /* HAVE_SYSLOG */ #endif /* HAVE_VSYSLOG */ int validate(void); void daemonize(void); void gc(void); void gc_mail_list(Mail_T *); void gccmd(command_t *); void gc_event(Event_T *e); boolean_t kill_daemon(int); int exist_daemon(void); boolean_t sendmail(Mail_T); void init_env(void); void monit_http(Httpd_Action); boolean_t can_http(void); void set_signal_block(void); State_Type check_process(Service_T); State_Type check_filesystem(Service_T); State_Type check_file(Service_T); State_Type check_directory(Service_T); State_Type check_remote_host(Service_T); State_Type check_system(Service_T); State_Type check_fifo(Service_T); State_Type check_program(Service_T); State_Type check_net(Service_T); int check_URL(Service_T s); void status_xml(StringBuffer_T, Event_T, int, const char *); boolean_t do_wakeupcall(void); boolean_t interrupt(void); #endif monit-5.26.0/src/event.c0000664000175000017500000007617413507751326014746 0ustar martinpmartinp/* * 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 "ProcessTree.h" #include "MMonit.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 boolean_t _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 */ long long 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 partialy 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)) { LogError("Aborting event - cannot access the event queue directory %s\n", Run.eventlist_dir); return; } if (! file_checkQueueLimit(Run.eventlist_dir, Run.eventlist_slots)) { LogError("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); LogInfo("Adding event to the queue file %s for later delivery\n", file_name); FILE *file = fopen(file_name, "w"); if (! file) { LogError("Aborting event - cannot create event file %s -- %s\n", file_name, STRERROR); return; } boolean_t 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) { LogError("Aborting event - unable to save event information to %s\n", file_name); if (unlink(file_name) < 0) LogError("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 partialy 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); boolean_t rv; ASSERT(E); ASSERT(E->flag != Handler_Succeeded); if (! file_checkQueueDirectory(Run.eventlist_dir)) { LogError("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) { LogError("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) { LogError("Aborting event - unable to update event information in '%s'\n", file_name); if (unlink(file_name) < 0) LogError("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 LogError("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)) { LogInfo("'%s' exec: '%s'\n", E->source->name, Util_commandDescription(A->exec, (char[STRLEN]){})); spawn(E->source, A->exec, E); 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; 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 LogInfo("'%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 LogWarning("'%s' %s\n", S->name, E->message); } else { // Success LogInfo("'%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 LogWarning("'%s' %s\n", S->name, E->message); } return; } else { LogError("'%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, chaged=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); } } /* ------------------------------------------------------------------ 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, 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 <<= 1; 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 informations are 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 managable 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: LogError("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 possitive 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 actionnames[Event_get_action(E)]; } /** * Reprocess the partially handled event queue */ void Event_queue_process() { /* 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) LogError("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) { LogError("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)) { LogError("Aborting queued event %s - invalid size %lu\n", file_name, (unsigned long)size); goto error3; } if (*version != EVENT_VERSION) { LogError("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))) { LogError("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: LogError("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 { LogError("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 { LogError("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) LogError("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.26.0/src/daemonize.c0000664000175000017500000000731013507751326015562 0ustar martinpmartinp/* * 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() { pid_t pid; /* * Become a session leader to lose our controlling terminal */ if ((pid = fork ()) < 0) { LogError("Cannot fork a new process\n"); exit (1); } else if (pid != 0) { _exit(0); } setsid(); if ((pid = fork ()) < 0) { LogError("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) { LogError("Cannot chdir to / -- %s\n", STRERROR); exit(1); } /* * Attach 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 */ boolean_t kill_daemon(int sig) { pid_t pid; if ((pid = exist_daemon()) > 0) { if (kill(pid, sig) < 0) { LogError("Cannot signal the monit daemon process -- %s\n", STRERROR); return false; } } else { LogInfo("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 */ int exist_daemon() { errno = 0; pid_t pid; if ((pid = Util_getPid(Run.files.pid)) && (getpgid(pid) > -1 || errno == EPERM)) return (int)pid; return 0; } monit-5.26.0/src/notification/0000775000175000017500000000000013507751326016130 5ustar martinpmartinpmonit-5.26.0/src/notification/MMonit.c0000664000175000017500000001522713507751326017506 0ustar martinpmartinp/* * 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 "socket.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 boolean_t _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, (unsigned char *)body, bodyLength) < 0) { LogError("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 boolean_t _receive(Socket_T socket, Mmonit_T C) { int status; char buf[STRLEN]; if (! Socket_readLine(socket, buf, sizeof(buf))) { LogError("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)) { LogError("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) { LogError("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)); if (! _send(socket, C, sb)) { LogError("M/Monit: cannot send %s message to %s\n", E ? "event" : "status", C->url->url); goto error; } StringBuffer_clear(sb); if (! _receive(socket, C)) { LogError("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.26.0/src/notification/MMonit.h0000664000175000017500000000251713507751326017511 0ustar martinpmartinp/* * 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.26.0/src/notification/Address.h0000664000175000017500000000310713507751326017667 0ustar martinpmartinp/* * 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.26.0/src/notification/SMTP.c0000664000175000017500000002072113507751326017061 0ustar martinpmartinp/* * 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 "net.h" #include "socket.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 } __attribute__((__packed__)) 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 } __attribute__((__packed__)) 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; } } static void _send(T S, const char *data, ...) { va_list ap; va_start(ap, data); char *msg = Str_vcat(data, ap); va_end(ap); 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); 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 { LogError("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 *b64 = encode_base64(strlen(buffer), (unsigned char *)buffer); TRY { _send(S, "%s\r\n", b64); _receive(S, 334, NULL); } FINALLY { FREE(b64); } END_TRY; strncpy(buffer, password, sizeof(buffer) - 1); b64 = encode_base64(strlen(buffer), (unsigned char *)buffer); TRY { _send(S, "%s\r\n", b64); _receive(S, 235, NULL); } FINALLY { FREE(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.26.0/src/notification/SMTP.h0000664000175000017500000001111313507751326017061 0ustar martinpmartinp/* * 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 "net.h" #include "socket.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.26.0/src/notification/Address.c0000664000175000017500000000330313507751326017660 0ustar martinpmartinp/* * 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() { 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.26.0/src/file.h0000664000175000017500000000735613507751326014545 0ustar martinpmartinp/* * 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. */ boolean_t file_createPidFile(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 */ boolean_t file_checkStat(char *filename, char *description, int 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 */ boolean_t file_checkQueueDirectory(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 */ boolean_t file_checkQueueLimit(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 */ boolean_t file_writeQueue(FILE *file, 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. */ boolean_t file_readProc(char *buf, int buf_size, char *name, int pid, int *bytes_read); #endif monit-5.26.0/src/lex.yy.c0000664000175000017500000144242713507751355015056 0ustar martinpmartinp#line 2 "src/lex.yy.c" #line 4 "src/lex.yy.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 #define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 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 382 #define YY_END_OF_BUFFER 383 /* 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[4184] = { 0, 2, 2, 378, 378, 383, 377, 382, 1, 377, 382, 2, 382, 377, 382, 329, 377, 382, 2, 326, 377, 382, 326, 377, 382, 313, 377, 382, 329, 377, 382, 321, 326, 377, 382, 311, 312, 326, 377, 382, 311, 312, 326, 377, 382, 311, 312, 326, 377, 382, 311, 312, 326, 377, 382, 377, 382, 280, 326, 377, 382, 282, 326, 377, 382, 278, 326, 377, 382, 326, 377, 382, 268, 326, 377, 382, 326, 377, 382, 326, 377, 382, 326, 377, 382, 326, 377, 382, 326, 377, 382, 287, 326, 377, 382, 326, 377, 382, 326, 377, 382, 326, 377, 382, 326, 377, 382, 286, 326, 377, 382, 326, 377, 382, 326, 377, 382, 326, 377, 382, 326, 377, 382, 285, 326, 377, 382, 326, 377, 382, 326, 377, 382, 326, 377, 382, 326, 377, 382, 2, 326, 377, 382, 347, 377, 382, 342, 377, 382, 343, 382, 342, 347, 377, 382, 344, 377, 382, 346, 347, 377, 382, 336, 377, 382, 337, 382, 377, 382, 338, 377, 382, 377, 382, 336, 377, 382, 330, 377, 382, 331, 382, 335, 377, 382, 332, 377, 382, 335, 377, 382, 377, 382,16733, 348, 377, 382,16733, 348, 382,16733, 348, 377, 382, 356, 377, 382,16733, 351, 377, 382, 16733, 354, 377, 382,16733, 377, 382, 355, 377, 382, 16733, 377, 382,16733, 361, 377, 382, 357, 382, 359, 361, 377, 382, 358, 359, 361, 377, 382, 358, 359, 360, 361, 377, 382, 360, 361, 377, 382, 358, 361, 377, 382, 357, 361, 377, 382, 382, 365, 377, 382, 362, 377, 382, 365, 377, 382, 369, 377, 382, 366, 369, 377, 382, 369, 377, 382, 367, 369, 377, 382, 376, 377, 382, 370, 376, 377, 382, 372, 382, 370, 376, 377, 382, 376, 377, 382, 371, 376, 377, 382, 375, 376, 377, 382, 381, 382, 378, 382, 381, 382, 381, 382, 1, 283, 317, 2, 2, 2, 326, 2, 326, 2, 2, 326, 326, 326, 318, 320, 326, 320, 326, 314, 326, 314, 326, 311, 312, 314, 326, 314, 326, 314, 326, 311, 312, 314, 326, 311, 312, 314, 326, 311, 312, 314, 326, 311, 312, 314, 326, 328, 281, 326, 282, 326, 279, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 4, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 282, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 271, 314, 326, 279, 314, 326, 314, 326, 314, 326, 314, 326, 278, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 39, 314, 326, 314, 326, 314, 326, 27, 314, 326, 314, 326, 3, 314, 326, 269, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 281, 314, 326, 314, 326, 314, 326, 314, 326, 280, 314, 326, 314, 326, 270, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 284, 314, 326, 314, 326, 314, 326, 283, 314, 326, 314, 326, 314, 326, 314, 326, 23, 314, 326, 314, 326, 8, 314, 326, 314, 326, 24, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 16, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 347, 342, 342, 347, 347, 345, 347, 341, 336, 341, 337, 341, 336, 341, 336, 337, 341, 341, 337, 341, 337, 338, 337, 330, 332,16733, 348,16733, 348, 356,16733, 356, 356, 351, 16733,16733, 354,16733, 354, 354, 353, 355,16733, 355, 355,16733, 359, 358, 359, 358, 362, 366, 367, 373, 370, 370, 374, 374, 374, 374, 381, 378, 381, 381, 315, 317, 2, 2, 326, 2, 326, 2, 319, 2, 319, 326, 319, 316, 318, 320, 326, 314, 326, 312, 314, 326, 312, 314, 326, 312, 314, 326, 312, 314, 326, 314, 326, 311, 312, 314, 326, 314, 326, 328, 311, 312, 314, 326, 328, 328, 328, 328, 328, 328, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 11, 314, 326, 314, 326, 5, 314, 326, 314, 326, 314, 326, 314, 326, 268, 314, 326, 314, 326, 314, 326, 22, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 190, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 288, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 134, 314, 326, 314, 326, 314, 326, 144, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 6, 314, 326, 314, 326, 314, 326, 314, 326, 125, 314, 326, 314, 326, 118, 314, 326, 173, 314, 326, 314, 326, 157, 314, 326, 314, 326, 314, 326, 314, 326, 12, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 58, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 240, 314, 326, 314, 326, 186, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 216, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 26, 314, 326, 314, 326, 255, 314, 326, 314, 326, 129, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 53, 314, 326, 314, 326, 314, 326, 314, 326, 156, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 138, 314, 326, 43, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 17, 314, 326, 314, 326, 314, 326, 314, 326, 102, 314, 326, 314, 326, 314, 326, 15, 314, 326, 314, 326, 314, 326, 42, 314, 326, 150, 314, 326, 314, 326, 314, 326, 104, 314, 326, 169, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 253, 314, 326, 314, 326, 14, 314, 326, 314, 326, 314, 326, 314, 326, 7, 314, 326, 314, 326, 20, 314, 326, 314, 326, 314, 326, 314, 326, 345, 339, 340, 333, 334, 356, 351,16733, 354, 350, 355, 352,16733, 352, 363, 364, 374, 374, 379, 381, 379, 380, 381, 380, 314, 326, 312, 314, 326, 312, 314, 326, 312, 314, 326, 312, 314, 326, 311, 312, 314, 326, 314, 326, 310, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 203, 314, 326, 314, 326, 314, 326, 268, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 189, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 247, 314, 326, 288, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 85, 314, 326, 314, 326, 25, 314, 326, 314, 326, 225, 314, 326, 251, 314, 326, 314, 326, 314, 326, 170, 314, 326, 314, 326, 314, 326, 209, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 267, 314, 326, 207, 314, 326, 314, 326, 314, 326, 271, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 119, 314, 326, 115, 314, 326, 287, 314, 326, 122, 314, 326, 221, 314, 326, 314, 326, 314, 326, 131, 314, 326, 314, 326, 81, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 98, 314, 326, 99, 314, 326, 269, 314, 326, 314, 326, 314, 326, 28, 314, 326, 314, 326, 280, 314, 326, 314, 326, 65, 314, 326, 148, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 270, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 162, 314, 326, 314, 326, 314, 326, 314, 326, 278, 314, 326, 153, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 136, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 137, 314, 326, 314, 326, 8, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 93, 314, 326, 314, 326, 314, 326, 208, 314, 326, 314, 326, 314, 326, 222, 314, 326, 130, 314, 326, 96, 314, 326, 314, 326, 256, 314, 326, 314, 326, 314, 326, 314, 326, 29, 314, 326, 314, 326, 86, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 226, 314, 326, 314, 326, 241, 314, 326, 314, 326, 314, 326, 210, 314, 326, 213, 314, 326, 126, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 95, 314, 326, 314, 326, 314, 326, 187, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 18, 314, 326, 40, 314, 326, 314, 326, 194, 314, 326, 314, 326, 314, 326, 100, 314, 326, 97, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 9, 314, 326, 314, 326, 8541, 8541, 356, 8541, 354, 8541, 355, 352, 374, 314, 326, 314, 326, 314, 326, 314, 326, 311, 312, 314, 326, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 314, 326, 314, 326, 314, 326, 314, 326, 105, 314, 326, 82, 314, 326, 314, 326, 290, 314, 326, 314, 326, 314, 326, 57, 314, 326, 314, 326, 314, 326, 268, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 192, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 257, 314, 326, 275, 276, 277, 314, 326, 314, 326, 242, 314, 326, 291, 314, 326, 110, 314, 326, 314, 326, 314, 326, 55, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 282, 314, 326, 314, 326, 295, 314, 326, 37, 314, 326, 245, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 322, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 287, 314, 326, 314, 326, 62, 314, 326, 123, 314, 326, 314, 326, 314, 326, 132, 314, 326, 314, 326, 205, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 145, 314, 326, 146, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 215, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 289, 314, 326, 292, 314, 326, 135, 314, 326, 314, 326, 280, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 278, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 38, 314, 326, 314, 326, 314, 326, 151, 314, 326, 314, 326, 223, 314, 326, 224, 314, 326, 314, 326, 314, 326, 314, 326, 101, 314, 326, 314, 326, 147, 314, 326, 314, 326, 314, 326, 314, 326, 139, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 112, 314, 326, 149, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 142, 314, 326, 314, 326, 213, 314, 326, 127, 314, 326, 206, 314, 326, 314, 326, 74, 314, 326, 314, 326, 196, 314, 326, 197, 314, 326, 94, 314, 326, 314, 326, 314, 326, 35, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 21, 314, 326, 198, 314, 326, 75, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 19, 314, 326, 314, 326, 13, 314, 326, 49, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 87, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 314, 326, 220, 314, 326, 163, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 67, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 297, 298, 314, 326, 314, 326, 202, 314, 326, 133, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 110, 314, 326, 54, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 46, 314, 326, 314, 326, 314, 326, 245, 314, 326, 227, 314, 326, 314, 326, 314, 326, 41, 314, 326, 314, 326, 322, 266, 314, 326, 314, 326, 314, 326, 314, 326, 308, 314, 326, 314, 326, 314, 326, 91, 314, 326, 217, 314, 326, 314, 326, 205, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 229, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 165, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 186, 314, 326, 314, 326, 117, 314, 326, 314, 326, 286, 314, 326, 252, 314, 326, 314, 326, 314, 326, 314, 326, 289, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 31, 314, 326, 154, 314, 326, 66, 314, 326, 249, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 158, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 83, 314, 326, 314, 326, 258, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 285, 314, 326, 175, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 34, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 120, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 60, 314, 326, 160, 314, 326, 103, 314, 326, 314, 326, 193, 314, 326, 314, 326, 314, 326, 199, 314, 326, 200, 314, 326, 201, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 71, 314, 326, 211, 314, 326, 314, 326, 48, 314, 326, 314, 326, 314, 326, 314, 326, 9, 314, 326, 314, 326, 314, 326, 327, 314, 326, 327, 314, 326, 327, 314, 326, 327, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 63, 314, 326, 314, 326, 314, 326, 314, 326, 212, 314, 326, 68, 314, 326, 314, 326, 314, 326, 314, 326, 79, 314, 326, 195, 314, 326, 314, 326, 314, 326, 202, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 254, 314, 326, 276, 275, 277, 314, 326, 314, 326, 121, 314, 326, 296, 314, 326, 47, 314, 326, 314, 326, 314, 326, 314, 326, 209, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 266, 314, 326, 314, 326, 314, 326, 278, 314, 326, 314, 326, 314, 326, 314, 326, 293, 314, 326, 314, 326, 314, 326, 246, 314, 326, 314, 326, 314, 326, 314, 326, 272, 314, 326, 59, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 286, 314, 326, 314, 326, 140, 314, 326, 314, 326, 106, 314, 326, 314, 326, 167, 314, 326, 314, 326, 314, 326, 314, 326, 31, 314, 326, 314, 326, 314, 326, 314, 326, 66, 314, 326, 164, 314, 326, 314, 326, 80, 314, 326, 313, 314, 326, 314, 326, 90, 314, 326, 314, 326, 314, 326, 10, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 174, 314, 326, 314, 326, 109, 314, 326, 314, 326, 285, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 204, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 193, 314, 326, 111, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 155, 314, 326, 314, 326, 314, 326, 9, 314, 326, 314, 326, 327, 314, 326, 327, 314, 326, 327, 314, 326, 327, 314, 326, 327, 314, 326, 327, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 314, 326, 314, 326, 314, 326, 314, 326, 30, 314, 326, 314, 326, 113, 314, 326, 192, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 178, 314, 326, 72, 314, 326, 314, 326, 314, 326, 61, 314, 326, 141, 314, 326, 314, 326, 271, 314, 326, 314, 326, 314, 326, 261, 314, 326, 314, 326, 260, 314, 326, 314, 326, 314, 326, 269, 314, 326, 314, 326, 272, 176, 314, 326, 314, 326, 314, 326, 215, 314, 326, 314, 326, 270, 314, 326, 159, 314, 326, 325, 314, 326, 314, 326, 314, 326, 244, 314, 326, 283, 314, 326, 166, 314, 326, 314, 326, 66, 314, 326, 69, 314, 326, 314, 326, 263, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 10, 314, 326, 314, 326, 101, 314, 326, 314, 326, 84, 314, 326, 314, 326, 265, 314, 326, 259, 314, 326, 314, 326, 314, 326, 314, 326, 108, 314, 326, 36, 314, 326, 314, 326, 109, 314, 326, 314, 326, 314, 326, 171, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 324, 314, 326, 56, 314, 326, 314, 326, 191, 314, 326, 188, 314, 326, 314, 326, 314, 326, 71, 314, 326, 262, 314, 326, 314, 326, 314, 326, 314, 326, 327, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 314, 326, 314, 326, 172, 314, 326, 314, 326, 314, 326, 314, 326, 239, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 296, 314, 326, 314, 326, 314, 326, 314, 326, 271, 314, 326, 314, 326, 314, 326, 314, 326, 64, 314, 326, 314, 326, 269, 314, 326, 168, 314, 326, 314, 326, 314, 326, 314, 326, 270, 314, 326, 325, 325, 314, 326, 314, 326, 314, 326, 244, 314, 326, 294, 89, 314, 326, 70, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 84, 314, 326, 248, 314, 326, 323, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 243, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 92, 314, 326, 314, 326, 314, 326, 324, 324, 250, 314, 326, 194, 314, 326, 191, 188, 314, 326, 314, 326, 219, 314, 326, 183, 314, 326, 152, 314, 326, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 314, 326, 314, 326, 172, 314, 326, 314, 326, 314, 326, 305, 301, 303, 314, 326, 314, 326, 177, 314, 326, 218, 314, 326, 314, 326, 296, 72, 314, 326, 45, 214, 314, 326, 314, 326, 314, 326, 314, 326, 116, 314, 326, 314, 326, 314, 326, 272, 273, 314, 326, 114, 314, 326, 161, 314, 326, 310, 325, 314, 326, 314, 326, 314, 326, 314, 326, 89, 314, 326, 208, 314, 326, 96, 314, 326, 314, 326, 314, 326, 314, 326, 323, 180, 314, 326, 314, 326, 314, 326, 314, 326, 73, 314, 326, 78, 314, 326, 314, 326, 314, 326, 314, 326, 44, 182, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 310, 324, 314, 326, 97, 314, 326, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 290, 314, 326, 314, 326, 314, 326, 50, 314, 326, 291, 314, 326, 314, 326, 264, 314, 326, 33, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 274, 107, 314, 326, 284, 314, 326, 314, 326, 292, 314, 326, 89, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 88, 314, 326, 314, 326, 32, 314, 326, 314, 326, 314, 326, 236, 314, 326, 188, 314, 326, 368, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 314, 326, 314, 326, 314, 326, 299, 307, 185, 314, 326, 314, 326, 228, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 284, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 181, 314, 326, 314, 326, 314, 326, 314, 326, 88, 143, 314, 326, 314, 326, 237, 314, 326, 188, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 314, 326, 124, 314, 326, 314, 326, 304, 306, 76, 314, 326, 314, 326, 184, 314, 326, 309, 314, 326, 314, 326, 314, 326, 314, 326, 233, 314, 326, 314, 326, 314, 326, 314, 326, 314, 326, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 314, 326, 314, 326, 314, 326, 297, 298, 314, 326, 314, 326, 179, 314, 326, 234, 314, 326, 128, 314, 326, 235, 314, 326, 314, 326, 238, 314, 326, 314, 326, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 314, 326, 314, 326, 314, 326, 302, 314, 326, 314, 326, 314, 326, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 290, 314, 326, 314, 326, 314, 326, 291, 300, 314, 326, 314, 326, 292, 230, 314, 326, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, 314, 326, 51, 314, 326, 52, 314, 326, 231, 314, 326, 232, 314, 326, 292, 328, 328, 328, 328, 328, 328, 328, 328, 328, 314, 326, 328, 328, 328, 328, 328, 328, 328, 328, 328, 314, 326, 328, 328, 328, 328, 328, 328, 328, 328, 314, 326, 328, 328, 314, 326, 77, 314, 326, 292 } ; static const flex_int16_t yy_accept[2620] = { 0, 1, 2, 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, 35, 40, 45, 50, 55, 57, 61, 65, 69, 72, 76, 79, 82, 85, 88, 91, 95, 98, 101, 104, 107, 111, 114, 117, 120, 123, 127, 130, 133, 136, 139, 143, 146, 149, 151, 155, 158, 162, 165, 167, 169, 172, 174, 177, 180, 182, 185, 188, 191, 194, 198, 201, 204, 208, 212, 216, 218, 222, 225, 228, 230, 234, 239, 245, 249, 253, 257, 258, 261, 264, 267, 270, 274, 277, 281, 284, 288, 290, 294, 297, 301, 305, 307, 309, 311, 313, 314, 315, 315, 316, 316, 317, 318, 320, 322, 323, 325, 326, 327, 327, 327, 328, 328, 330, 332, 334, 336, 340, 340, 342, 344, 348, 352, 356, 360, 361, 363, 365, 367, 369, 371, 373, 375, 377, 379, 381, 384, 386, 388, 390, 392, 394, 396, 398, 400, 402, 404, 406, 408, 410, 412, 414, 416, 418, 420, 422, 424, 426, 428, 430, 432, 434, 437, 439, 441, 443, 445, 447, 449, 451, 453, 455, 455, 458, 461, 463, 465, 467, 470, 472, 474, 476, 478, 480, 482, 485, 487, 489, 492, 494, 497, 500, 502, 504, 506, 508, 511, 513, 515, 517, 520, 522, 525, 527, 529, 531, 533, 535, 537, 540, 542, 544, 547, 549, 551, 553, 556, 558, 561, 563, 566, 568, 570, 572, 574, 576, 578, 580, 582, 584, 586, 588, 590, 592, 594, 596, 598, 600, 602, 604, 606, 608, 610, 612, 614, 616, 618, 620, 622, 624, 626, 629, 631, 633, 635, 637, 639, 641, 643, 645, 647, 649, 651, 653, 655, 657, 658, 659, 661, 662, 662, 664, 665, 667, 669, 671, 672, 674, 675, 677, 678, 678, 679, 679, 680, 681, 681, 682, 682, 683, 683, 685, 686, 688, 689, 690, 692, 693, 695, 696, 697, 697, 698, 700, 701, 702, 703, 703, 704, 706, 707, 707, 708, 708, 709, 709, 709, 710, 710, 711, 712, 713, 714, 715, 715, 716, 717, 718, 719, 720, 720, 721, 721, 721, 723, 724, 726, 728, 730, 732, 733, 734, 734, 736, 738, 740, 743, 746, 749, 752, 754, 758, 760, 760, 760, 761, 765, 766, 767, 768, 769, 770, 771, 773, 775, 777, 779, 781, 784, 786, 789, 791, 793, 795, 798, 800, 802, 805, 807, 809, 811, 813, 815, 817, 819, 821, 823, 825, 827, 829, 831, 833, 835, 838, 840, 842, 844, 846, 848, 850, 853, 855, 857, 859, 861, 864, 866, 868, 871, 873, 875, 877, 879, 881, 883, 885, 887, 889, 891, 893, 895, 897, 900, 902, 904, 906, 909, 911, 914, 917, 919, 922, 924, 926, 928, 931, 933, 935, 937, 939, 941, 943, 945, 947, 949, 951, 953, 955, 957, 959, 961, 963, 965, 967, 969, 971, 973, 975, 977, 979, 981, 984, 986, 988, 990, 992, 994, 997, 999, 1002, 1004, 1006, 1008, 1010, 1012, 1014, 1016, 1018, 1020, 1022, 1024, 1026, 1028, 1030, 1032, 1034, 1036, 1039, 1041, 1043, 1045, 1047, 1049, 1051, 1053, 1055, 1057, 1059, 1061, 1064, 1066, 1069, 1071, 1074, 1076, 1078, 1080, 1082, 1084, 1086, 1088, 1090, 1092, 1094, 1096, 1098, 1100, 1102, 1104, 1106, 1108, 1110, 1112, 1114, 1116, 1118, 1120, 1123, 1125, 1127, 1129, 1132, 1134, 1136, 1138, 1140, 1142, 1145, 1148, 1150, 1152, 1154, 1156, 1159, 1161, 1163, 1165, 1168, 1170, 1172, 1175, 1177, 1179, 1182, 1185, 1187, 1189, 1192, 1195, 1197, 1199, 1201, 1203, 1206, 1208, 1211, 1213, 1215, 1217, 1220, 1222, 1225, 1227, 1229, 1231, 1232, 1233, 1234, 1235, 1236, 1236, 1237, 1239, 1240, 1241, 1242, 1244, 1244, 1244, 1245, 1246, 1247, 1247, 1247, 1247, 1248, 1248, 1249, 1249, 1251, 1252, 1254, 1255, 1257, 1260, 1263, 1266, 1269, 1273, 1275, 1276, 1276, 1276, 1277, 1278, 1279, 1280, 1281, 1282, 1282, 1283, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1291, 1293, 1295, 1297, 1299, 1301, 1303, 1305, 1308, 1310, 1312, 1315, 1317, 1319, 1321, 1323, 1325, 1327, 1329, 1331, 1333, 1335, 1337, 1339, 1341, 1344, 1346, 1346, 1346, 1348, 1350, 1352, 1354, 1356, 1358, 1361, 1364, 1366, 1368, 1370, 1372, 1375, 1377, 1380, 1382, 1385, 1388, 1390, 1392, 1395, 1397, 1399, 1402, 1404, 1406, 1408, 1410, 1412, 1415, 1418, 1420, 1422, 1425, 1427, 1429, 1431, 1433, 1436, 1439, 1442, 1445, 1448, 1450, 1452, 1455, 1457, 1460, 1462, 1464, 1466, 1468, 1471, 1474, 1477, 1479, 1481, 1484, 1486, 1489, 1491, 1494, 1497, 1499, 1501, 1503, 1505, 1507, 1509, 1511, 1514, 1516, 1518, 1520, 1522, 1524, 1526, 1528, 1530, 1533, 1535, 1537, 1539, 1542, 1545, 1547, 1549, 1551, 1553, 1556, 1558, 1560, 1562, 1562, 1564, 1567, 1569, 1572, 1574, 1576, 1578, 1580, 1582, 1584, 1587, 1589, 1591, 1594, 1596, 1598, 1601, 1604, 1607, 1609, 1612, 1614, 1616, 1618, 1621, 1623, 1626, 1628, 1630, 1632, 1634, 1636, 1638, 1640, 1642, 1644, 1646, 1648, 1650, 1652, 1654, 1656, 1658, 1660, 1663, 1665, 1668, 1670, 1672, 1675, 1678, 1681, 1683, 1685, 1687, 1687, 1689, 1691, 1693, 1695, 1698, 1700, 1702, 1705, 1707, 1709, 1711, 1713, 1716, 1719, 1721, 1724, 1726, 1728, 1731, 1734, 1736, 1738, 1740, 1742, 1744, 1746, 1748, 1750, 1752, 1754, 1756, 1759, 1761, 1762, 1764, 1766, 1768, 1769, 1769, 1770, 1772, 1774, 1776, 1778, 1782, 1782, 1782, 1783, 1784, 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791, 1791, 1791, 1791, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1802, 1804, 1806, 1808, 1811, 1814, 1816, 1819, 1821, 1823, 1826, 1828, 1830, 1833, 1835, 1837, 1839, 1841, 1843, 1845, 1848, 1850, 1852, 1854, 1856, 1858, 1860, 1862, 1864, 1867, 1867, 1867, 1870, 1870, 1870, 1870, 1872, 1874, 1877, 1880, 1883, 1885, 1887, 1890, 1892, 1894, 1896, 1898, 1900, 1903, 1905, 1908, 1908, 1909, 1911, 1914, 1916, 1918, 1920, 1922, 1924, 1925, 1927, 1929, 1931, 1933, 1935, 1937, 1939, 1942, 1942, 1944, 1947, 1950, 1952, 1954, 1957, 1959, 1962, 1964, 1966, 1968, 1970, 1972, 1974, 1977, 1980, 1982, 1984, 1986, 1988, 1990, 1992, 1994, 1997, 1999, 2001, 2003, 2005, 2007, 2009, 2011, 2013, 2015, 2017, 2019, 2022, 2025, 2028, 2030, 2033, 2035, 2037, 2039, 2039, 2041, 2044, 2046, 2048, 2050, 2052, 2054, 2056, 2058, 2060, 2060, 2061, 2063, 2065, 2067, 2070, 2072, 2075, 2078, 2080, 2082, 2084, 2087, 2089, 2092, 2094, 2096, 2098, 2101, 2103, 2105, 2107, 2109, 2111, 2113, 2115, 2117, 2120, 2123, 2125, 2127, 2129, 2131, 2133, 2135, 2137, 2140, 2142, 2145, 2148, 2151, 2153, 2156, 2156, 2156, 2158, 2161, 2164, 2167, 2169, 2171, 2171, 2172, 2174, 2176, 2178, 2180, 2182, 2184, 2186, 2188, 2190, 2192, 2194, 2197, 2200, 2203, 2205, 2207, 2209, 2211, 2214, 2216, 2219, 2222, 2224, 2226, 2228, 2230, 2232, 2234, 2237, 2237, 2239, 2241, 2243, 2245, 2245, 2245, 2245, 2246, 2247, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 2260, 2260, 2260, 2260, 2260, 2261, 2262, 2263, 2263, 2264, 2264, 2265, 2266, 2267, 2268, 2269, 2271, 2274, 2277, 2279, 2281, 2283, 2285, 2287, 2290, 2292, 2294, 2296, 2298, 2300, 2302, 2304, 2306, 2308, 2311, 2314, 2316, 2318, 2320, 2322, 2324, 2326, 2326, 2326, 2326, 2326, 2328, 2330, 2333, 2336, 2338, 2340, 2342, 2344, 2346, 2349, 2351, 2353, 2356, 2359, 2361, 2363, 2366, 2368, 2369, 2372, 2374, 2376, 2378, 2379, 2381, 2383, 2383, 2385, 2388, 2391, 2393, 2396, 2398, 2400, 2402, 2404, 2406, 2408, 2411, 2413, 2415, 2417, 2419, 2421, 2424, 2426, 2428, 2430, 2432, 2435, 2437, 2440, 2442, 2445, 2448, 2450, 2452, 2454, 2457, 2459, 2461, 2463, 2465, 2465, 2467, 2469, 2471, 2474, 2477, 2480, 2483, 2485, 2487, 2489, 2491, 2493, 2495, 2497, 2499, 2501, 2503, 2506, 2508, 2510, 2512, 2514, 2517, 2519, 2522, 2524, 2526, 2528, 2530, 2532, 2534, 2537, 2540, 2542, 2544, 2546, 2548, 2550, 2552, 2552, 2552, 2554, 2554, 2555, 2557, 2559, 2561, 2563, 2565, 2568, 2568, 2568, 2568, 2570, 2572, 2574, 2576, 2579, 2582, 2585, 2587, 2590, 2592, 2594, 2597, 2600, 2603, 2603, 2605, 2607, 2609, 2611, 2614, 2617, 2619, 2622, 2624, 2626, 2628, 2631, 2633, 2633, 2636, 2639, 2642, 2645, 2645, 2645, 2646, 2647, 2647, 2648, 2649, 2650, 2651, 2652, 2653, 2654, 2655, 2656, 2657, 2657, 2658, 2659, 2660, 2661, 2662, 2662, 2662, 2662, 2662, 2663, 2663, 2663, 2663, 2663, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671, 2672, 2672, 2675, 2677, 2679, 2681, 2684, 2687, 2689, 2691, 2693, 2696, 2696, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2701, 2703, 2706, 2708, 2710, 2712, 2714, 2716, 2719, 2719, 2719, 2720, 2720, 2720, 2721, 2721, 2721, 2721, 2722, 2722, 2724, 2726, 2729, 2730, 2732, 2735, 2737, 2739, 2739, 2741, 2744, 2746, 2748, 2750, 2752, 2755, 2757, 2759, 2762, 2764, 2766, 2766, 2768, 2771, 2773, 2775, 2778, 2780, 2782, 2784, 2787, 2790, 2792, 2794, 2796, 2798, 2800, 2802, 2804, 2806, 2808, 2811, 2813, 2813, 2816, 2818, 2821, 2823, 2826, 2826, 2828, 2830, 2832, 2835, 2837, 2839, 2841, 2844, 2847, 2849, 2852, 2855, 2857, 2860, 2862, 2864, 2867, 2869, 2871, 2873, 2875, 2877, 2879, 2881, 2883, 2886, 2888, 2891, 2893, 2896, 2898, 2900, 2902, 2904, 2906, 2908, 2908, 2908, 2911, 2911, 2911, 2911, 2913, 2915, 2917, 2919, 2919, 2921, 2923, 2925, 2927, 2929, 2932, 2935, 2937, 2937, 2937, 2939, 2941, 2943, 2945, 2947, 2949, 2952, 2954, 2956, 2959, 2959, 2962, 2965, 2968, 2971, 2974, 2977, 2977, 2977, 2977, 2978, 2979, 2980, 2981, 2982, 2983, 2984, 2985, 2986, 2987, 2988, 2989, 2990, 2991, 2992, 2993, 2994, 2995, 2996, 2997, 2998, 2999, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3001, 3002, 3003, 3003, 3004, 3004, 3005, 3006, 3007, 3008, 3009, 3009, 3011, 3013, 3015, 3017, 3020, 3022, 3022, 3022, 3022, 3022, 3022, 3022, 3022, 3022, 3025, 3028, 3030, 3032, 3034, 3036, 3038, 3038, 3038, 3038, 3038, 3040, 3042, 3042, 3042, 3045, 3048, 3048, 3050, 3052, 3055, 3058, 3060, 3063, 3065, 3067, 3070, 3070, 3072, 3075, 3077, 3079, 3082, 3084, 3085, 3085, 3088, 3090, 3092, 3095, 3097, 3100, 3103, 3104, 3106, 3108, 3108, 3110, 3113, 3113, 3116, 3119, 3121, 3124, 3127, 3129, 3132, 3134, 3136, 3138, 3140, 3143, 3145, 3148, 3150, 3153, 3155, 3158, 3161, 3163, 3165, 3167, 3170, 3170, 3171, 3173, 3175, 3178, 3180, 3182, 3185, 3187, 3189, 3189, 3191, 3193, 3195, 3195, 3195, 3195, 3197, 3199, 3201, 3203, 3203, 3205, 3207, 3208, 3210, 3213, 3215, 3215, 3215, 3218, 3221, 3223, 3225, 3228, 3231, 3233, 3235, 3235, 3238, 3238, 3238, 3239, 3240, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 3250, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3259, 3260, 3261, 3262, 3263, 3264, 3265, 3266, 3267, 3268, 3268, 3268, 3268, 3268, 3268, 3268, 3268, 3268, 3269, 3270, 3271, 3272, 3273, 3274, 3275, 3276, 3277, 3277, 3279, 3281, 3284, 3286, 3288, 3288, 3288, 3288, 3288, 3288, 3288, 3288, 3288, 3288, 3290, 3293, 3295, 3297, 3299, 3299, 3299, 3299, 3301, 3302, 3302, 3304, 3304, 3306, 3308, 3310, 3313, 3315, 3317, 3317, 3319, 3322, 3324, 3327, 3330, 3330, 3330, 3330, 3332, 3334, 3336, 3339, 3340, 3341, 3343, 3345, 3345, 3347, 3350, 3351, 3354, 3357, 3359, 3361, 3363, 3365, 3367, 3370, 3373, 3374, 3376, 3378, 3378, 3378, 3378, 3380, 3382, 3384, 3386, 3388, 3388, 3390, 3393, 3395, 3395, 3395, 3395, 3397, 3399, 3401, 3404, 3404, 3406, 3408, 3409, 3410, 3413, 3416, 3417, 3418, 3420, 3422, 3425, 3428, 3431, 3431, 3431, 3431, 3431, 3432, 3433, 3434, 3435, 3436, 3437, 3438, 3439, 3440, 3441, 3442, 3443, 3444, 3445, 3446, 3447, 3448, 3449, 3450, 3451, 3452, 3453, 3454, 3455, 3456, 3457, 3458, 3459, 3460, 3461, 3462, 3463, 3464, 3465, 3466, 3467, 3467, 3467, 3467, 3467, 3467, 3467, 3467, 3467, 3468, 3469, 3470, 3470, 3471, 3471, 3472, 3473, 3474, 3475, 3476, 3476, 3478, 3480, 3483, 3485, 3487, 3487, 3487, 3487, 3488, 3489, 3490, 3490, 3490, 3490, 3490, 3492, 3494, 3497, 3500, 3500, 3502, 3503, 3503, 3506, 3507, 3510, 3512, 3514, 3516, 3519, 3519, 3521, 3523, 3523, 3524, 3524, 3524, 3524, 3525, 3525, 3527, 3530, 3533, 3535, 3537, 3539, 3539, 3541, 3543, 3546, 3549, 3552, 3554, 3556, 3558, 3559, 3562, 3564, 3564, 3566, 3568, 3571, 3574, 3576, 3576, 3578, 3580, 3580, 3581, 3581, 3584, 3586, 3588, 3588, 3590, 3592, 3594, 3594, 3596, 3599, 3599, 3599, 3599, 3600, 3601, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3620, 3621, 3622, 3623, 3624, 3625, 3626, 3627, 3628, 3629, 3629, 3630, 3631, 3632, 3633, 3634, 3635, 3636, 3637, 3638, 3639, 3639, 3639, 3639, 3639, 3639, 3639, 3639, 3639, 3640, 3641, 3642, 3643, 3644, 3645, 3646, 3647, 3648, 3649, 3651, 3653, 3655, 3658, 3659, 3659, 3659, 3659, 3659, 3659, 3659, 3659, 3661, 3663, 3666, 3667, 3669, 3671, 3673, 3673, 3675, 3677, 3677, 3678, 3678, 3678, 3678, 3678, 3678, 3681, 3684, 3686, 3687, 3689, 3692, 3694, 3696, 3698, 3700, 3700, 3702, 3704, 3706, 3706, 3709, 3711, 3712, 3712, 3714, 3716, 3716, 3718, 3721, 3721, 3724, 3724, 3725, 3725, 3725, 3725, 3726, 3727, 3728, 3729, 3730, 3731, 3732, 3733, 3734, 3735, 3736, 3737, 3738, 3739, 3740, 3741, 3742, 3743, 3744, 3745, 3746, 3747, 3748, 3749, 3750, 3751, 3752, 3753, 3754, 3755, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, 3765, 3766, 3767, 3768, 3769, 3770, 3770, 3770, 3770, 3770, 3770, 3770, 3770, 3770, 3771, 3772, 3773, 3773, 3774, 3774, 3775, 3776, 3777, 3778, 3779, 3779, 3781, 3783, 3785, 3785, 3786, 3786, 3786, 3786, 3786, 3786, 3787, 3790, 3792, 3795, 3797, 3799, 3799, 3801, 3803, 3803, 3803, 3803, 3803, 3806, 3808, 3808, 3810, 3812, 3814, 3816, 3819, 3819, 3821, 3823, 3825, 3826, 3829, 3829, 3831, 3834, 3834, 3834, 3835, 3835, 3835, 3835, 3835, 3835, 3836, 3836, 3837, 3837, 3838, 3839, 3840, 3841, 3842, 3843, 3844, 3845, 3846, 3847, 3847, 3848, 3849, 3850, 3851, 3852, 3853, 3854, 3855, 3856, 3856, 3857, 3858, 3859, 3860, 3861, 3862, 3863, 3864, 3865, 3865, 3866, 3867, 3868, 3869, 3870, 3871, 3872, 3873, 3874, 3874, 3875, 3876, 3877, 3878, 3879, 3880, 3881, 3882, 3883, 3884, 3884, 3884, 3884, 3884, 3884, 3884, 3884, 3884, 3885, 3886, 3887, 3888, 3889, 3890, 3891, 3892, 3893, 3893, 3895, 3898, 3900, 3900, 3900, 3900, 3901, 3901, 3902, 3905, 3907, 3910, 3911, 3913, 3915, 3915, 3915, 3915, 3917, 3919, 3922, 3924, 3924, 3926, 3928, 3930, 3930, 3930, 3930, 3930, 3930, 3930, 3930, 3930, 3930, 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, 3961, 3961, 3961, 3961, 3961, 3961, 3961, 3961, 3962, 3963, 3964, 3964, 3965, 3965, 3966, 3967, 3968, 3969, 3970, 3970, 3972, 3974, 3976, 3976, 3976, 3976, 3977, 3978, 3980, 3982, 3985, 3985, 3985, 3988, 3991, 3994, 3994, 3996, 3999, 4001, 4001, 4001, 4001, 4001, 4001, 4002, 4003, 4003, 4004, 4005, 4006, 4007, 4008, 4009, 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4036, 4036, 4036, 4036, 4036, 4036, 4036, 4036, 4037, 4038, 4039, 4040, 4041, 4041, 4043, 4045, 4047, 4047, 4048, 4048, 4050, 4052, 4052, 4052, 4052, 4052, 4054, 4054, 4054, 4054, 4054, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 4074, 4075, 4076, 4077, 4078, 4078, 4078, 4078, 4078, 4078, 4078, 4078, 4078, 4079, 4080, 4081, 4082, 4083, 4084, 4086, 4088, 4090, 4091, 4092, 4094, 4096, 4096, 4097, 4100, 4100, 4100, 4100, 4100, 4101, 4102, 4103, 4104, 4105, 4106, 4107, 4108, 4109, 4110, 4111, 4112, 4113, 4114, 4115, 4116, 4117, 4118, 4119, 4120, 4121, 4122, 4123, 4124, 4125, 4126, 4126, 4126, 4126, 4126, 4127, 4128, 4129, 4131, 4134, 4137, 4140, 4143, 4144, 4144, 4144, 4144, 4144, 4145, 4146, 4147, 4148, 4149, 4150, 4150, 4150, 4150, 4150, 4151, 4152, 4153, 4155, 4155, 4156, 4157, 4158, 4159, 4160, 4161, 4162, 4163, 4164, 4166, 4166, 4167, 4168, 4169, 4170, 4171, 4172, 4173, 4174, 4176, 4176, 4177, 4178, 4180, 4180, 4183, 4184, 4184 } ; 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[2821] = { 0, 0, 0, 89, 99, 110, 200, 290, 380, 470, 560, 650, 740, 830, 920, 1009, 1034, 127, 154, 142, 168, 3673,18225, 181,18225, 3640, 90, 1060, 101,18225, 87, 102, 1143, 198, 215, 223, 3623, 131, 135, 233, 1215, 1282, 1352, 1422, 1492, 1562, 1633, 1682, 1731, 272, 273, 1780, 1829, 294, 1883, 1932, 362, 1981, 2035, 2086, 363, 385, 157, 0, 122,18225, 193,18225, 249, 270, 360, 0, 0, 0, 505, 227,18225, 0, 0, 0, 3622, 253, 3611, 257, 326, 2167, 414, 470, 508, 2257,18225, 18225, 0, 145, 220,18225, 0,18225,18225, 0, 0, 0,18225, 263, 274, 502, 3555, 595,18225, 599, 341, 18225,18225, 0, 131, 279, 311, 629,18225, 3553,18225, 92, 227,18225, 2347, 2437, 2527, 2617, 159, 3526, 0, 3525,18225, 177, 254, 3485, 334, 523, 2700, 306, 641, 2772, 665, 675, 562, 3468, 2823, 341, 361, 387, 3393, 694, 712, 386, 125, 236, 271, 0, 379, 274, 626, 731, 278, 316, 773, 848, 743, 328, 812, 728, 381, 399, 463, 493, 2875, 901, 499, 524, 637, 546, 823, 544, 572, 555, 574, 579, 777, 907, 631, 567, 724, 580, 590, 3392, 3361, 587, 783, 621, 903, 0, 622, 724, 826, 707, 728, 749, 0, 771, 790, 1042, 772, 0, 3338, 821, 817, 814, 843, 830, 838, 833, 904, 0, 1032, 3315, 3290, 1058, 910, 839, 905, 847, 0, 892, 906, 908, 909, 1049, 927, 0, 940, 947, 1038, 953, 1063, 971, 944, 1206, 1193, 955, 967, 1210, 984, 2929, 961, 970, 1273, 1006, 1272, 1032, 1047, 1212, 1213, 1279, 1213, 1072, 1065, 1091, 1206, 1205, 1281, 1211, 1209, 1213, 1261, 1268, 1273, 1286, 1283, 1314, 1283, 1341, 1288, 1283, 1301, 1340, 1302, 1320, 1336, 0, 534, 548, 997, 3275, 0,18225, 1439, 1469, 1499, 1517, 1549, 1443, 1579, 1593, 3262, 0, 3255, 1661, 719, 3240, 0, 3213, 3169, 0, 759, 723, 1459, 1491, 0, 3011, 3101, 1540, 1555, 0, 3151, 1717, 1566, 1614, 0, 3191, 3281, 0, 1366, 0, 3149, 0, 3132, 892, 899, 1132, 1766, 3107,18225, 1675, 1825, 0, 1529, 1624, 1748, 1821, 0, 407, 763, 3110, 1136, 3095, 448,18225, 537, 3371, 3461, 3551, 3641, 3034, 0, 266,18225, 3011, 2997, 1967, 2122, 2183, 2198, 1919, 3724, 2213, 2981, 2969, 3795, 2967, 2167, 3847, 2221, 2229, 1686, 2257, 2273, 3899, 2283, 1338, 1343, 1342, 1567, 1345, 1382, 1408, 1677, 425, 1518, 1730, 1356, 1690, 2303, 1577, 1641, 1773, 1740, 1814, 1395, 1799, 1651, 1823, 1435, 1831, 1830, 1844, 1893, 1882, 1884, 1883, 1933, 2370, 1935, 1779, 2398, 1979, 1978, 1994, 1937, 1989, 1926, 1419, 1976, 2036, 1990, 2045, 2044, 2050, 2048, 2033, 2053, 2434, 2087, 2272, 2290, 1454, 2330, 2327, 2336, 1559, 2304, 1620, 1650, 2342, 1676, 2341, 2429, 2420, 1685, 2362, 2130, 1838, 2085, 2424, 1687, 2430, 2426, 2435, 2437, 2444, 2440, 2445, 2454, 2520, 2518, 2504, 2502, 2494, 2507, 2442, 1702, 2294, 2515, 2521, 2527, 2526, 2542, 2538, 2565, 2550, 1732, 2572, 2604, 2595, 2274, 2596, 2597, 2606, 2447, 2618, 2510, 2612, 2613, 2614, 2630, 2762, 2785, 2779, 2784, 2620, 2864, 2519, 2836, 2822, 2837, 2834, 1885, 2621, 2759, 2868, 2841, 2876, 2880, 2875, 2882, 2783, 2877, 2885, 2888, 2931, 2934, 1925, 2922, 2992, 2990, 2929, 1975, 2001, 2993, 2047, 3008, 2748, 3006, 2881, 3005, 2995, 3093, 2994, 3054, 3013, 2094, 3050, 3081, 3051, 2220, 3100, 3084, 3009, 3103, 3108, 2259, 3183, 3130, 3109, 3171, 3190, 2340, 3111, 3166, 3187, 3189, 3188, 3186, 3197, 3207, 3233, 3193, 2358, 3106, 3234, 2632, 2657, 3249, 3273, 3274, 2938, 3015, 3277, 3256, 3276, 3053, 3282, 3115, 3284, 3194, 3286, 3261, 3287,18225,18225, 2873,18225, 2866, 2833, 3358, 3970, 3384,18225, 3386, 2791, 4060, 2743, 2678, 18225,18225, 1151, 0, 0, 3393, 2689, 3418, 2668, 0, 18225, 0,18225, 3415, 3476, 3491, 3506, 3548, 3566, 3322, 18225, 2567, 2532, 4134, 3521, 3575, 2793, 3594, 3602, 3610, 4185, 3638, 3656, 3666, 0, 377, 2507, 0, 3376, 3651, 3385, 3372, 3283, 3360, 3408, 3208, 3288, 3416, 3436, 3968, 3962, 3629, 3534, 3450, 3533, 3630, 3784, 3663, 3964, 3781, 3808, 3838, 3860, 3338, 3613, 3437, 3938, 3656, 3861, 3835, 3967, 3970, 3898, 3353, 3373, 4023, 3665, 3975, 3972, 3462, 3463, 3568, 3782, 3668, 3783, 3982, 3983, 3807, 3976, 4028, 4093, 4043, 4065, 4010, 4095, 4067, 3858, 3859, 4075, 4071, 596, 4077, 4125, 4172, 4184, 3897, 4187, 4175, 4230, 4037, 4142, 4188, 4189, 4190, 4040, 4198, 4237, 4232, 4144, 4068, 4103, 788, 4242, 4243, 4235, 4267, 4123, 4222, 4239, 4244, 4256, 4249, 4250, 4281, 4283, 4287, 4276, 875, 4295, 4292, 4280, 4298, 4293, 4294, 4297, 4300, 4301, 4306, 4325, 4334, 4307, 4314, 4342, 4341, 4339, 4340, 4346, 4351, 4350, 4356, 4390, 4358, 4352, 4355, 4359, 4389, 4391, 4390, 4372, 4402, 4403, 4444, 4392, 4414, 4397, 4405, 4400, 4441, 4413, 4430, 4436, 4416, 4438, 4448, 4440, 4449, 4455, 4479, 4458, 4472, 4486, 4466, 4463, 4498, 4475, 4503, 4493, 4502, 4510, 4512, 4507, 4513, 4521, 4524, 4530, 4548, 4509, 4529, 4556, 4551, 4537, 4554, 4557, 4565, 4568, 4575, 4611, 4576, 4612, 4584, 4602, 4656, 4626, 4629, 4549, 4603, 4637, 4601, 4579, 4610, 4620, 4650, 4647, 4645, 4661, 4646, 4659, 4660, 4678, 4648, 4672, 4695, 4704, 4708, 4683, 4684, 4711, 4710, 4715, 4722, 18225, 0, 0, 0,18225, 1372,18225, 885, 3692, 4777, 4792, 4807, 2472, 2442, 4861, 4912, 3816, 3870, 3933, 0, 488, 2450, 0, 4815, 2429, 4831, 4841, 4851, 4963, 4882, 5015, 4890, 4933, 4158, 2410, 0, 2386, 4922, 4846, 4852, 5003, 4691, 5004, 4902, 4705, 5022, 4706, 4717, 4920, 4736, 4749, 5005, 4847, 4924, 4977, 5021, 5018, 5020, 5026, 5048, 5053, 5052, 5056, 5059, 5031, 5066, 4849, 4840, 5105,18225, 4883, 4890, 4909, 5078, 5069, 4923, 4973, 5073, 5075, 5084, 5072, 5110, 5108, 5089, 5114, 5125, 5097, 5123, 5106, 2863, 18225, 5127, 5132, 5130, 5124, 5136, 5133, 5145, 2208, 5166, 5147, 5172, 5177, 5215, 5183, 5189, 5155, 5169, 5182, 5185, 5187, 5194, 5200, 5191, 5204, 5203, 5221, 5227, 5205, 5235, 5230, 5236, 5222, 5231, 5239, 5241, 5237, 5248, 5282, 5262, 5271, 5243, 5280, 5282, 5290, 5285, 5288, 5297, 5294, 5299, 5296, 5306, 5310, 5302, 5316, 5320, 5329, 5332, 5337, 5340, 5343, 5329, 5344, 5347, 5348, 5353, 5350, 5357, 5359, 5365, 5374, 5390, 2981,18225, 5392, 5397, 5398, 5378, 5401, 5380, 5400, 5405, 5406, 5418, 5420, 5412, 5411, 5453, 5445, 5436, 5413, 5452, 5453, 5460, 5456, 5480, 5448, 5457, 5462, 5468, 5469, 5478, 5506, 5494, 5473, 5475, 5503, 5514, 5490, 5510, 5511, 5513, 5515, 5516, 5517, 5520, 5517, 5525, 5524, 5527, 5597, 5541, 5548, 5606,18225, 5601, 5572, 5573, 5580, 5582, 5588, 5595, 5590, 5591, 5621, 5618, 5612, 5660, 5664, 5599, 5614, 5649, 5636, 5646, 5656, 5651, 5653, 5654, 5657, 5655, 5672, 5662, 5669, 5671, 1632, 4985, 5734, 5749, 5764, 2361, 2359, 2352, 5781, 5770, 5802, 4823, 5812, 5832, 5853, 5884, 5861, 5905, 5725, 2349, 0, 2338,18225, 5913, 5936, 5946, 5956, 5963, 5973, 5983, 5992, 6001, 6022, 6030, 6053, 0, 529, 2318, 5771, 5679, 5690, 6019, 5772, 5846, 6038, 6040, 5694, 6041, 5738, 6042, 5769, 5870, 6080, 6150, 6044, 5822, 6045, 5770, 6047, 5991, 6057, 5819, 6061, 6066, 5829, 6088, 6125, 6097, 5873, 6089, 5872, 5874, 6091, 6148, 5992, 5989, 6107, 6124, 6103, 6137, 6063, 6130, 6114, 6146, 6065, 6135, 823, 6112, 6161, 6156, 6170, 1533, 6173, 6188, 6146, 6191, 6180, 6181, 6204, 6182, 6212, 6203, 6198, 6205, 6207, 6223, 6213, 6216, 6230, 6219, 6262, 6231, 6228, 6246, 6249, 6250, 6265, 6238, 6258, 6256, 6266, 6271, 6270, 6282, 6309, 6284, 6273, 6286, 6296, 6298, 6301, 6278, 6322, 6318, 6304, 6316, 6319, 6344, 6323, 6332, 6331, 6339, 6356, 6349, 6346, 6358, 6365, 6366, 6376, 6334, 6399, 6381, 6377, 6393, 6372, 6402, 6392, 6425, 6397, 6403, 6423, 6408, 6424, 6420, 6412, 6428, 6440, 6444, 6429, 6450, 6445, 6424, 6450, 6460, 6523,18225, 6515, 6447, 6472, 6470, 6487, 6492, 2606, 6484, 3479, 6494, 6498, 6496, 6508, 6497, 6504, 6505, 6517, 6514, 6528, 6520, 6513, 6515, 6518, 6541, 6548, 6554, 6558, 6540, 6560, 6561, 6562, 6563, 6565, 6567, 6573, 6572, 6582, 2693, 6636, 6652, 6668, 6684, 2306, 2304, 6700, 6751, 6721, 6729, 6774, 0, 611, 2250, 0, 6783, 6802, 6812, 6822, 6843, 6851, 6874, 0, 645, 2208, 2136, 6884, 6894, 6904, 6912, 2123, 6922, 6932, 6942, 6951, 6972, 7003, 6980, 7024, 6628, 2077, 0, 2023, 6586, 6624, 6685, 6648, 7009, 6625, 6640, 6689, 6994, 7017, 6641, 6631, 6690, 6812, 6691, 6734, 6745, 6733, 6793, 6937, 7013, 6810, 6939, 7015, 7016, 7031, 6811, 6813, 6940, 299,18225, 7051, 589,18225, 6931, 1037, 1412,18225, 6979, 7036, 6992, 7034, 7088, 7090, 7092, 7043, 7071, 7070, 7073, 7114, 7056, 7070, 7082, 7067, 7075, 7088, 7103, 7081, 7125, 7093, 7109, 7126, 7105, 7128, 7133, 7112, 7129, 7140, 7139, 7175, 7131, 7148, 7172, 7151, 7172, 7182, 7187, 7189, 7161, 7173, 7176, 7186, 7173, 7191, 7195, 7192, 7197, 7194, 7189, 7219, 7217, 7225, 7200, 7258, 7236, 7230, 7256, 7209, 7245, 7234, 7243, 7244, 7247, 7262, 7278, 7277, 7250, 7289, 7286, 7293, 7266, 7281, 7323, 7299, 7305, 7313, 7381, 7267, 7294, 7311, 7320, 7330, 7361, 7336, 7347, 7341, 7342, 7348, 2708, 7341, 3940, 7353, 7360, 7367, 7370, 7345, 7385, 7397, 7378, 7398, 7384, 7375, 7403, 7405, 7399, 7412, 7418, 7411, 7429, 7419, 7433, 7443, 7424, 7436, 7445, 7442, 2932, 7498, 7513, 7529, 7545, 7561, 7577, 1978, 1967, 1944, 7594, 7615, 7623, 7506, 7646, 7655, 7676, 7707, 7684, 7728, 7521, 1932, 0, 1920, 7758, 7736, 7810, 7779, 7787, 7537, 1906, 0, 1897, 7831, 7841, 7862, 7872, 7878, 7888, 7898, 7908, 7915, 7925, 7935, 7944, 7953, 7974, 7982, 8005, 0, 1056, 1895, 7533, 8024, 7572, 8085, 7584, 7539, 7589, 7582, 7628, 7633, 7998, 7633, 7633, 7639, 7636, 7673, 7697, 7748, 7997, 7977, 7749, 7998, 7698, 7699, 1470, 1495, 8057, 7805, 7691, 8007, 7701, 7750, 7737, 8007, 7802, 7804, 7943, 7944, 8029, 8033, 7946, 7947, 8002, 8010, 8020, 8022, 8038, 8090, 8042, 172, 1799, 8053, 8080, 8060, 8066, 8068, 8111, 8083, 1885, 8084, 8100, 8083, 8099, 8092, 8073, 8098, 8101, 8134, 1115, 8118, 8124, 8120, 8126, 8131, 8162, 8142, 8137, 8146, 8138, 8166, 8148, 8152, 8156, 8159, 4158, 8170, 8178, 8162, 8226,18225, 8230, 8200, 8169, 8201, 8204, 8183, 8206, 8219, 8195, 8216, 8221, 8222, 8226, 8217, 8216, 8227, 8238, 8228, 8232, 8239, 8258, 8244, 1881, 8263, 8247, 8264, 8243, 8260, 8272, 8274, 8277, 8281, 8278, 8279, 8280, 8290, 3533, 1843, 1842, 1815, 8355, 8406, 8344, 8376, 8386, 0, 1598, 1799, 0, 8428, 8438, 8457, 8467, 8488, 8496, 8519, 0, 1809, 1785, 8528, 8538, 8548, 8558, 8579, 8587, 8610, 0, 2124, 1776, 8619, 8628, 8637, 8646, 1764, 8656, 8666, 8676, 1685, 8686, 8696, 8706, 8715, 8736, 8767, 8744, 8788, 8363, 1678, 0, 1610, 8274, 8828, 8805, 8886, 8788, 8271, 8281, 8317, 8399, 8390, 8401, 8442, 8440, 8550, 8444, 8773, 8446, 8804, 8447, 8696, 8816, 8541, 1426, 8831, 1659, 8536, 8815, 8544, 8811, 8858, 8830, 8798, 8849, 8693, 8553, 8875, 8694, 8862, 8799, 8695, 1834, 8916, 8918, 8891, 8746, 8897, 8880, 0, 1594, 8890, 8903, 8725, 8898, 8766,18225, 8917, 8876, 8906, 8908, 8935, 8923, 8934, 1416, 8889, 1676, 8942, 8944, 3843, 8921, 4122, 8929, 8951, 8955, 8948, 8964, 8950, 8976, 8956, 8959, 8968, 8980, 8980, 8981, 8987, 8996, 8975, 8979, 9001, 8989, 0, 1547, 8998, 9000,18225, 9006, 9009, 9013, 9003, 9006, 9017, 3991, 1514, 1490, 1486, 9082, 9103, 9111, 9091, 9134, 9143, 9164, 9195, 9172, 9216, 9119, 1474, 0, 1451, 9246, 9224, 9298, 9267, 9275, 9152, 1438, 0, 1378, 9349, 9319, 9401, 9327, 9370, 9180, 1364, 0, 1351, 9379, 9423, 9432, 9452, 9460, 9470, 9480, 9490, 9496, 9506, 9516, 9526, 9533, 9543, 9553, 9562, 9571, 9592, 9600, 9623, 0, 2287, 1313, 9185, 9642, 9624, 9702, 9190, 9187, 9188, 9191, 9192,18225, 9222,18225, 9227, 9238, 9226, 9240, 9237, 9260, 0, 0, 1510, 9274, 2094, 9282, 0,18225, 0, 9290, 9276, 9284, 0, 9326, 9325, 9337, 9648,18225, 9649, 9650, 9671,18225, 9665, 9648, 0, 0, 0, 9343, 9333, 9344, 9392, 9695, 1293, 0, 0, 9680, 9382, 9394, 2209, 0, 9391, 9386, 9559, 9562, 0, 0, 9566, 9556, 9565, 9562, 9626,18225, 9616, 0, 9645, 9631, 9652, 9652, 9669, 0, 9675, 9679, 0, 7504, 1243, 1206, 9759, 9810, 9719, 9748, 9782, 0, 2400, 1141, 0, 9791, 9832, 9842, 9861, 9882, 9890, 9913, 0, 2405, 1137, 9922, 9932, 9942, 9952, 9973, 9981,10004, 0, 2409, 1126,10013,10023,10033,10043,10064,10072,10095, 0, 2495, 1105,10104,10113,10122,10131,10140, 1075,10150,10160,10170, 1069,10180,10190,10200,10209,10230,10261,10238,10282, 9737, 1051, 0, 1032, 9738,10322,10302,10395, 9738, 9740, 9803, 9789, 9785, 9838, 9838, 9857, 9846, 9840,10268, 9841,18225, 9929,10259,10290, 9929,10280,10311,10332,18225,10304, 1721, 9936, 2146, 9937, 1569,10019,10312, 9933,10189, 2572,10359, 10020,10318,10022,10036,10187,10357,10314,10201,10188,10361, 18225,10255,10324,10238,10247,10414,10281,10300,10307,10431, 18225, 1016, 980,10478,10530,10439,10449,10430,10459,10581, 10467,10633,10499,10507,10487, 986, 0, 984,10684,10551, 10736,10559,10602,10515, 965, 0, 919,10787,10610,10839, 10654,10662,10539, 881, 0, 822,10890,10705,10942,10713, 10757,10567, 799, 0, 790,10766,10809,10818,10861,10869, 10913,10923,10965,10971,10994,11004,11014,11021,11031,11041, 11050,11059,11080,11088,11111, 0, 2679, 763,10316,11130, 10414,11205,10338,18225,10369,10557,10566,10559,10566,18225, 10575,10576,10599,11091,11102, 5020,11111,10623, 2644,10615, 2815, 2868,10625,10936,10611,11112,11134,11115,11118,10674, 10662,10730,11126,10676,18225,10678,10671,11201,10702,10968, 11085,18225, 739, 432,11225,11234,10796,11255, 1573,11306, 0,11276,11286, 0, 2846, 709, 0,11328,11338,11357, 11367, 0,11388,11398, 0, 2965, 691,11418,11428,11438, 11448, 0,11469,11479, 0, 3064, 689,11499,11509,11519, 11529, 0,11550,11560, 0, 3190, 655,11580,11590,11600, 11610, 0,11631,11641, 0, 3380, 615,11661,11670,11679, 11688,11697, 613,11707,11717,11727, 611,11737,11747,11757, 11766,11787,11818,11795,11839,10848, 598, 0, 540,10731, 11879, 2609,11943,10732,10716,10868,18225, 2610, 2938,11103, 11147,11149, 7489,11850,11851, 3446,10869,10889,11852,11183, 11864,11909,10937,11868,11915,11877,11792,11821, 510,11847, 492, 488,11993, 0, 3444, 3476,12004,12025,12055,12033, 12106, 0, 489,12157,12076,12208, 0, 487,12259,12084, 12310, 0, 437,12361,12127,12412, 0, 372,12463,12135, 12514, 0, 351,12179,12188,12230,12239,12280,12290,12333, 12343,12382,12392,12435,12445,12485,12495,12536,12545,12565, 0,12586,12596, 0, 3523, 349,10937,12626,12687,11860, 11042,11033,11135,18225,18225,11245,11246,11133,11147,11165, 11191, 3052,11244,11291,12667,11296,11358, 317,12656,12711, 12740, 237,12749,12771, 3702,12800,12626, 0,12780,12822, 12832,12851,12720,12873,12883,12902,12912,12933,12942,12963, 12973,12983,13004,13013,13034,13044,13054,13075,13084,13105, 13115,13125,13146,13155,13176,13185,13194,13203, 191,13213, 13223,13233, 146,13243,13253,13263,13272,13293,13323, 0, 124,11290,11355,11435,11885,11349,18225,11353,11520,11601, 11432,11430,12030,12081,11873,13301,13346,13356,13375, 101, 13382,13403,13433,13411, 0,13484,13454, 0,13535,13462, 0,13586,13505, 0,13637,13513, 0,13688,13556, 0, 13565,13608,13617,13659,13667,13711,13721,13740,13746,13756, 13766,13776,13783,13793,13803,13813,13834,18225,11929,11808, 11518,18225,18225,11927,12612,11443,18225,11519, 92,13844, 13865,13875,13884,13905, 0,13914,13935,13944,13953,13962, 13971,13980,13989,13998,14007,14016,14025,14034,14043,14052, 14061,14070,14079,14088,14097,14106,14115,14124, 90,14134, 14144,14154,14163,14184, 0,12628,11598,11599,11600,11753, 11746,14192,14215,14225,14235,14242,14251,14260,14269,14278, 14287,14295,14305,14315,14325,14332,14341,14350,14335,11794, 14360,14371,14389,14400,14409,14418,14427,14436,14445,11806, 11815,14454,14463,14472,14481,14490,14499,14508,14517,12091, 11891,14526,14535,12651,11930,11938,18225,18225,14561,14588, 14615,14642,14669,14696,14723,14750,14777,14804,14831,14851, 14876,14896,14921,14948,14975,14998,15018,15039,15062,15082, 15103,15130,15157,15184,15211,15238,15265,15292,15315,15334, 15351,15367,15385,15403,15427,15444,15471,15498,15525,15552, 15579,15606,15633,15660,15687,15714,15734,15752,15770,15795, 15822,15842,15860,15878,15896, 9058,15921,15948,15975,16002, 16025,16045,16066,16089,16109,16130,16157,16184,16211,16238, 16265,16292,16319,16346,16373,16400,16427,16454,16481,16508, 16535,16562,16585,16604,16621,16638,16656,16674,16698,16715, 16742,16769,16796,16823,16850,16877,16904,16931,16958,16985, 17012,17039,17059,17077,17102,17122,17140, 3585,17158,17179, 17202,17229,17256,17283,17310,17337,17364,17391,17409,17433, 17450,17477,17504,17531,17558,17578, 4220, 4481, 297,17596, 17621,17648,17675,17701, 4995, 5553, 446,17717, 9074, 9665, 895, 9731,10423, 1629, 2392,17733,10879,11967, 3077,17743, 17761,17786,17812,17837,17847,11984,12044, 3137, 3343, 3390, 17865,17883,17908,17934,17959,12095,12168, 4101,17969,17987, 18012,18038,18063,12218,12270, 4166, 4173, 4277, 4607,18073, 18091,12320, 4748,18109,18127,12372,12693, 4999, 5044, 5388, 5604, 6481,18145,18163,12422,12474, 6623,18181,18199,12524 } ; static const flex_int16_t yy_def[2821] = { 0, 2618, 1, 2619, 2619, 2620, 2620, 2621, 2621, 2622, 2622, 2623, 2623, 2624, 2624, 2625, 2625, 2626, 2626, 2627, 2627, 2618, 2618, 2618, 2618, 2618, 2628, 2629, 2630, 2618, 2631, 2632, 2618, 32, 32, 32, 2618, 2630, 2630, 2630, 32, 32, 41, 41, 41, 41, 32, 46, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 54, 47, 47, 2630, 2633, 2618, 2618, 2633, 2618, 2634, 2635, 2635, 2636, 2637, 2638, 2618, 2618, 2618, 2639, 2640, 2641, 2642, 2642, 2642, 2618, 2643, 2644, 2645, 2646, 2647, 2648, 2618, 2618, 2649, 2650, 2650, 2618, 2651, 2618, 2618, 2652, 2653, 2654, 2618, 2618, 2655, 2618, 2656, 2618, 2618, 2656, 2657, 2618, 2618, 2658, 2618, 2659, 2660, 2618, 2618, 2661, 2618, 2662, 2663, 2618, 2664, 2665, 2666, 2664, 2667, 2668, 2669, 2670, 2618, 2671, 2672, 2673, 2674, 2675, 2618, 2676, 138, 138, 138, 138, 138, 138, 2618, 2667, 2667, 2667, 2675, 138, 138, 141, 141, 141, 141, 141, 141, 141, 2674, 138, 141, 141, 138, 138, 141, 141, 141, 141, 141, 141, 141, 141, 138, 174, 141, 141, 141, 141, 174, 141, 141, 141, 141, 141, 141, 174, 141, 141, 141, 141, 141, 2618, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 2677, 2618, 2677, 2678, 2679, 2677, 2618, 2680, 2680, 2618, 2618, 2680, 2680, 2618, 2618, 2681, 2682, 2683, 2618, 2618, 2684, 2685, 2686, 2687, 2688, 2687, 2618, 2689, 2690, 2691, 2692, 2693, 2694, 2695, 2696, 2697, 2697, 2698, 2699, 2700, 2701, 2702, 2703, 2704, 2705, 2706, 2707, 2708, 2618, 2709, 2709, 2618, 2710, 2618, 2618, 2710, 2711, 2711, 2618, 2712, 2713, 2714, 2618, 2715, 2716, 2717, 2718, 2719, 2618, 2720, 2721, 2721, 2722, 2722, 2723, 2724, 2725, 2618, 2726, 2727, 2727, 2727, 2727, 2727, 2727, 2618, 372, 2618, 2728, 2618, 372, 2618, 2618, 379, 379, 381, 381, 372, 372, 372, 385, 385, 385, 385, 385, 385, 385, 385, 2729, 385, 385, 385, 385, 372, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 372, 385, 385, 372, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 372, 385, 385, 385, 385, 385, 385, 385, 385, 2729, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2729, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2729, 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, 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, 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, 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, 2618, 2618, 2730, 2618, 2731, 2732, 2733, 2734, 2735, 2618, 2736, 2737, 2738, 2739, 2732, 2618, 2618, 2740, 2741, 2742, 2743, 2741, 2744, 2742, 2745, 2618, 2745, 2618, 2746, 2746, 2746, 2746, 2746, 385, 385, 2618, 2747, 2748, 2618, 634, 634, 636, 636, 2618, 2618, 2618, 2749, 641, 641, 644, 644, 641, 641, 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, 2618, 2618, 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, 385, 385, 385, 385, 385, 385, 2750, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2750, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2750, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2618, 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, 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, 385, 2618, 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, 385, 385, 385, 385, 385, 385, 2618, 2751, 2752, 2753, 2618, 2754, 2618, 2746, 2746, 2746, 2746, 385, 2755, 2756, 2618, 2618, 2757, 876, 876, 879, 879, 876, 876, 2618, 2618, 2618, 2618, 2618, 2618, 889, 2618, 891, 891, 893, 891, 889, 889, 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, 385, 385, 385, 2618, 2618, 2618, 2618, 2618, 2618, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2618, 2618, 385, 385, 385, 385, 385, 385, 385, 2618, 385, 385, 385, 385, 385, 385, 385, 385, 2618, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2750, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2618, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2618, 2618, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2750, 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, 2618, 2618, 385, 385, 385, 385, 385, 385, 2618, 2618, 2750, 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, 385, 2758, 2746, 2746, 2746, 2746, 2618, 2759, 2760, 2618, 1113, 1113, 1115, 1115, 2618, 1118, 2618, 1120, 1120, 1122, 1120, 1118, 1118, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2761, 1136, 1136, 1139, 1139, 1136, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2618, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2618, 2618, 2618, 2618, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2618, 385, 385, 385, 385, 2618, 385, 385, 2618, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2750, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2618, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2750, 385, 385, 385, 385, 385, 385, 2750, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2618, 2618, 385, 2618, 2618, 2750, 385, 385, 385, 385, 385, 2618, 2618, 2618, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2618, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2758, 2746, 2746, 2746, 2746, 2762, 2763, 2618, 2618, 2764, 1326, 1326, 1329, 1329, 1326, 1326, 2618, 2618, 2618, 2618, 2765, 1337, 1337, 1340, 1340, 1337, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 1353, 2618, 1355, 1355, 1357, 1355, 1353, 1353, 2618, 385, 385, 2750, 385, 385, 385, 385, 385, 385, 385, 2618, 385, 2618, 2618, 2618, 2618, 2618, 2618, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 385, 385, 385, 2618, 385, 385, 385, 385, 2618, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2618, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2750, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2618, 385, 385, 385, 385, 385, 2618, 385, 385, 385, 385, 2750, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2750, 385, 385, 385, 385, 2750, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2618, 2618, 385, 2618, 2618, 2618, 385, 385, 385, 385, 2618, 385, 385, 385, 385, 385, 385, 385, 385, 2618, 2618, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 2766, 2746, 2746, 2746, 2746, 2746, 2746, 2618, 2767, 2768, 2618, 1528, 1528, 1530, 1530, 2618, 1533, 2618, 1535, 1535, 1537, 1535, 1533, 1533, 2618, 1542, 2618, 1544, 1544, 1546, 1544, 1542, 1542, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2769, 1563, 1563, 1566, 1566, 1563, 2618, 2770, 2771, 2770, 1573, 1573, 1573, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 1573, 1573, 1573, 1573, 1573, 1573, 1573, 2618, 2618, 2618, 2618, 1573, 1573, 2618, 2618, 1573, 1573, 2618, 1573, 1573, 1573, 1573, 1573, 1573, 1573, 1573, 1573, 2618, 1573, 1573, 1573, 1573, 1573, 1573, 2618, 2618, 1573, 2771, 1573, 1573, 1573, 1573, 1573, 2772, 1573, 1573, 2618, 1573, 1573, 2618, 1573, 1573, 1573, 2771, 1573, 1573, 1573, 1573, 1573, 2771, 1573, 1573, 1573, 1573, 2771, 1573, 1573, 1573, 1573, 2771, 1573, 1573, 1573, 2618, 2618, 2771, 1573, 1573, 1573, 1573, 1573, 1573, 1573, 2618, 1573, 1573, 1573, 2618, 2618, 2618, 1573, 1573, 1573, 1573, 2618, 1573, 1573, 2773, 1573, 1573, 1573, 2618, 2618, 1573, 1573, 1573, 1573, 1573, 1573, 1573, 1573, 2774, 2775, 2776, 2777, 2618, 2618, 2778, 1701, 1701, 1704, 1704, 1701, 1701, 2618, 2618, 2618, 2618, 2779, 1712, 1712, 1715, 1715, 1712, 2618, 2618, 2618, 2618, 2780, 1722, 1722, 1725, 1725, 1722, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 1741, 2618, 1743, 1743, 1745, 1743, 1741, 1741, 2618, 2781, 2782, 2781, 1753, 1753, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 1753, 1753, 1753, 1753, 1753, 2618, 2618, 2618, 1753, 2618, 2618, 1753, 2618, 1753, 1753, 1753, 1753, 1753, 1753, 2618, 1753, 1753, 1753, 1753, 1753, 2618, 2618, 2618, 2782, 1753, 1753, 1753, 2783, 2783, 1753, 1753, 2618, 1753, 1753, 2618, 1753, 1753, 1753, 1753, 2782, 1753, 1753, 2782, 1753, 2618, 1753, 1753, 2618, 2618, 2618, 1753, 1753, 1753, 1753, 1753, 2618, 1753, 1753, 1753, 2618, 2618, 2618, 1753, 1753, 1753, 1753, 2618, 1753, 1753, 2784, 2784, 1753, 1753, 2618, 2618, 1753, 1753, 1753, 1753, 1753, 2785, 2618, 2786, 2787, 2618, 1854, 1854, 1856, 1856, 2618, 1859, 2618, 1861, 1861, 1863, 1861, 1859, 1859, 2618, 1868, 2618, 1870, 1870, 1872, 1870, 1868, 1868, 2618, 1877, 2618, 1879, 1879, 1881, 1879, 1877, 1877, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2788, 1902, 1902, 1905, 1905, 1902, 2618, 2789, 2790, 2789, 1912, 1912, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 1912, 1912, 1912, 1912, 2618, 1912, 2618, 2618, 1912, 2618, 1912, 1912, 1912, 1912, 1912, 2618, 1912, 1912, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2790, 1912, 1912, 2791, 1912, 1912, 2618, 1912, 2790, 1912, 1912, 1912, 2790, 1912, 1912, 2618, 1912, 1912, 2618, 1912, 1912, 1912, 1912, 1912, 2618, 1912, 1912, 2618, 2618, 2618, 1912, 1912, 1912, 2618, 1912, 1912, 2792, 2618, 1912, 1912, 2793, 2794, 2795, 2618, 2618, 2796, 1994, 1994, 1997, 1997, 1994, 1994, 2618, 2618, 2618, 2618, 2797, 2005, 2005, 2008, 2008, 2005, 2618, 2618, 2618, 2618, 2798, 2015, 2015, 2018, 2018, 2015, 2618, 2618, 2618, 2618, 2799, 2025, 2025, 2028, 2028, 2025, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2045, 2618, 2047, 2047, 2049, 2047, 2045, 2045, 2618, 2800, 2801, 2800, 2057, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2057, 2057, 2057, 2618, 2057, 2057, 2057, 2618, 2057, 2057, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2801, 2057, 2057, 2618, 2057, 2801, 2801, 2057, 2057, 2057, 2618, 2057, 2057, 2057, 2618, 2057, 2057, 2618, 2618, 2057, 2057, 2618, 2057, 2057, 2618, 2057, 2618, 2618, 2618, 2802, 2618, 2618, 2115, 2115, 2117, 2117, 2618, 2120, 2618, 2122, 2122, 2124, 2122, 2120, 2120, 2618, 2129, 2618, 2131, 2131, 2133, 2131, 2129, 2129, 2618, 2138, 2618, 2140, 2140, 2142, 2140, 2138, 2138, 2618, 2147, 2618, 2149, 2149, 2151, 2149, 2147, 2147, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2803, 2172, 2172, 2175, 2175, 2172, 2618, 2804, 2805, 2804, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2182, 2182, 2182, 2182, 2182, 2618, 2182, 2182, 2618, 2618, 2618, 2618, 2182, 2182, 2618, 2182, 2805, 2182, 2182, 2182, 2618, 2182, 2182, 2182, 2618, 2182, 2618, 2182, 2182, 2618, 2618, 2618, 2806, 2807, 2807, 2225, 2226, 2618, 2807, 2618, 2808, 2230, 2230, 2233, 2233, 2230, 2230, 2618, 2618, 2618, 2618, 2809, 2241, 2241, 2244, 2244, 2241, 2618, 2618, 2618, 2618, 2810, 2251, 2251, 2254, 2254, 2251, 2618, 2618, 2618, 2618, 2811, 2261, 2261, 2264, 2264, 2261, 2618, 2618, 2618, 2618, 2812, 2271, 2271, 2274, 2274, 2271, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2291, 2618, 2293, 2293, 2295, 2293, 2291, 2291, 2618, 2813, 2814, 2813, 2618, 2618, 2618, 2618, 2618, 2618, 2303, 2303, 2303, 2618, 2303, 2303, 2618, 2618, 2618, 2303, 2814, 2303, 2303, 2618, 2303, 2303, 2303, 2618, 2618, 2618, 2618, 2815, 2816, 2815, 2333, 2333, 2815, 2618, 2337, 2618, 2339, 2618, 2339, 2339, 2618, 2344, 2618, 2344, 2344, 2618, 2349, 2618, 2349, 2349, 2618, 2354, 2618, 2354, 2354, 2618, 2359, 2618, 2359, 2359, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2817, 2380, 2380, 2383, 2383, 2380, 2618, 2818, 2818, 2389, 2618, 2618, 2618, 2618, 2618, 2389, 2389, 2389, 2618, 2618, 2389, 2819, 2389, 2618, 2389, 2389, 2389, 2618, 2618, 2618, 2618, 2820, 2618, 2618, 2820, 2618, 2416, 2416, 2618, 2618, 2618, 2618, 2422, 2618, 2618, 2618, 2618, 2427, 2618, 2618, 2618, 2618, 2432, 2618, 2618, 2618, 2618, 2437, 2618, 2618, 2618, 2618, 2442, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2457, 2618, 2457, 2457, 2618, 2389, 2389, 2389, 2618, 2618, 2618, 2389, 2389, 2618, 2618, 2618, 2618, 2389, 2618, 2618, 2618, 2618, 2618, 2618, 2481, 2618, 2483, 2483, 2618, 2486, 2486, 2618, 2489, 2489, 2618, 2492, 2492, 2618, 2495, 2495, 2618, 2498, 2498, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2516, 2618, 2389, 2389, 2389, 2618, 2618, 2389, 2389, 2618, 2618, 2389, 2618, 2618, 2618, 2618, 2618, 2533, 2533, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2563, 2563, 2389, 2389, 2389, 2389, 2389, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2389, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2389, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2389, 2618, 2618, 2618, 2389, 2618, 2389, 2618, 0, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618 } ; static const flex_int16_t yy_nxt[18316] = { 0, 22, 23, 24, 23, 23, 25, 26, 27, 28, 29, 30, 23, 23, 28, 23, 28, 28, 31, 32, 33, 34, 35, 35, 35, 35, 35, 36, 23, 37, 38, 39, 28, 22, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 49, 56, 57, 58, 59, 60, 61, 49, 49, 49, 28, 62, 28, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 49, 56, 57, 58, 59, 60, 61, 49, 49, 49, 22, 22, 64, 65, 66, 64, 119, 67, 120, 132, 355, 68, 64, 65, 66, 64, 133, 67, 2582, 121, 2572, 68, 22, 69, 70, 69, 69, 22, 71, 129, 135, 22, 73, 74, 74, 288, 74, 288, 288, 2332, 107, 108, 107, 109, 349, 130, 130, 349, 22, 74, 109, 109, 2379, 107, 22, 114, 98, 98, 114, 129, 115, 329, 329, 129, 116, 110, 109, 107, 108, 107, 109, 123, 147, 389, 2509, 130, 148, 109, 109, 130, 107, 114, 98, 98, 114, 129, 115, 129, 1619, 331, 116, 131, 110, 109, 117, 1620, 117, 117, 111, 364, 112, 130, 389, 130, 117, 117, 288, 117, 289, 288, 22, 22, 22, 69, 70, 69, 69, 22, 71, 2505, 117, 22, 73, 74, 74, 111, 74, 112, 142, 142, 142, 142, 142, 142, 142, 142, 329, 329, 22, 74, 306, 123, 306, 306, 22, 143, 143, 143, 143, 143, 144, 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, 129, 291, 291, 331, 291, 312, 291, 312, 313, 313, 292, 313, 313, 149, 2332, 335, 130, 335, 335, 131, 390, 135, 294, 295, 294, 294, 336, 364, 336, 336, 311, 351, 296, 296, 351, 297, 348, 130, 356, 22, 22, 22, 75, 76, 75, 75, 22, 77, 296, 390, 22, 79, 22, 22, 1391, 22, 141, 141, 212, 391, 141, 213, 1392, 353, 895, 214, 353, 22, 22, 895, 141, 141, 348, 22, 374, 141, 141, 394, 141, 310, 310, 398, 233, 376, 2476, 141, 141, 212, 391, 141, 213, 234, 235, 344, 214, 345, 344, 236, 346, 141, 141, 150, 347, 315, 141, 141, 394, 141, 129, 316, 398, 233, 298, 299, 298, 298, 2379, 130, 2171, 399, 234, 235, 300, 300, 130, 301, 236, 406, 129, 22, 22, 22, 75, 76, 75, 75, 22, 77, 300, 1901, 22, 79, 22, 22, 130, 22, 249, 280, 399, 250, 251, 281, 889, 889, 129, 282, 406, 22, 22, 349, 141, 141, 349, 22, 252, 141, 141, 310, 310, 283, 130, 392, 310, 284, 387, 249, 280, 285, 250, 251, 281, 388, 393, 141, 282, 414, 286, 415, 141, 141, 141, 320, 150, 252, 141, 141, 310, 321, 283, 2330, 392, 119, 284, 387, 1562, 355, 285, 416, 130, 2332, 388, 393, 141, 1124, 414, 286, 415, 141, 1124, 22, 22, 80, 81, 82, 81, 83, 80, 80, 84, 80, 80, 80, 80, 80, 80, 80, 416, 80, 86, 323, 323, 323, 323, 323, 323, 323, 323, 87, 80, 80, 80, 80, 88, 22, 1135, 417, 640, 297, 305, 297, 297, 310, 310, 1118, 1118, 2414, 310, 297, 297, 2332, 297, 338, 338, 338, 338, 338, 338, 338, 338, 418, 89, 80, 80, 297, 417, 325, 288, 2114, 288, 288, 123, 326, 367, 368, 369, 370, 370, 370, 370, 370, 288, 425, 289, 288, 1353, 1353, 130, 2171, 418, 80, 80, 80, 81, 82, 81, 83, 80, 80, 84, 80, 80, 80, 80, 80, 80, 80, 426, 80, 86, 137, 425, 377, 377, 377, 377, 377, 377, 87, 80, 80, 80, 80, 88, 22, 1394, 429, 431, 341, 356, 341, 341, 341, 1395, 341, 342, 426, 432, 341, 341, 433, 341, 342, 342, 150, 341, 2618, 434, 435, 443, 446, 89, 80, 80, 341, 429, 431, 340, 342, 2372, 130, 2368, 117, 2171, 117, 117, 432, 1533, 1533, 433, 447, 449, 117, 117, 150, 117, 434, 435, 443, 446, 80, 80, 90, 90, 91, 90, 92, 92, 117, 150, 130, 373, 373, 373, 373, 373, 373, 373, 373, 447, 449, 1542, 1542, 1901, 452, 456, 427, 441, 94, 395, 95, 442, 95, 137, 96, 377, 377, 377, 377, 377, 377, 377, 377, 137, 428, 377, 377, 377, 377, 377, 377, 377, 377, 452, 456, 427, 441, 1562, 395, 1135, 442, 95, 150, 95, 373, 373, 373, 373, 373, 373, 373, 373, 306, 428, 306, 306, 313, 640, 313, 313, 150, 384, 373, 373, 373, 373, 373, 373, 373, 373, 90, 97, 90, 90, 91, 90, 92, 92, 385, 150, 386, 373, 373, 373, 373, 373, 373, 373, 373, 457, 384, 460, 312, 444, 312, 313, 351, 2114, 94, 351, 95, 620, 95, 445, 96, 461, 411, 385, 403, 386, 412, 2171, 404, 413, 396, 397, 405, 311, 457, 462, 460, 150, 444, 373, 373, 373, 373, 373, 373, 373, 373, 95, 445, 95, 461, 411, 150, 403, 1901, 412, 400, 404, 413, 396, 397, 405, 436, 2618, 462, 463, 437, 450, 130, 401, 451, 464, 1191, 438, 471, 1191, 90, 97, 22, 22, 98, 22, 22, 22, 99, 400, 1562, 22, 101, 22, 22, 436, 22, 407, 463, 437, 450, 408, 401, 451, 464, 409, 438, 471, 22, 22, 473, 410, 373, 474, 22, 430, 150, 475, 373, 373, 373, 373, 373, 373, 373, 373, 407, 141, 476, 458, 408, 459, 141, 477, 409, 478, 479, 480, 495, 473, 410, 373, 474, 150, 430, 335, 475, 335, 335, 2618, 402, 499, 336, 1106, 336, 336, 141, 476, 458, 130, 459, 141, 477, 1359, 478, 479, 480, 495, 1359, 130, 22, 22, 22, 22, 98, 22, 22, 22, 99, 402, 499, 22, 101, 22, 22, 500, 22, 1135, 453, 481, 373, 422, 454, 496, 439, 482, 373, 423, 22, 22, 440, 424, 455, 497, 22, 141, 493, 498, 494, 501, 141, 141, 502, 504, 500, 503, 141, 453, 481, 373, 422, 454, 496, 439, 482, 373, 423, 509, 510, 440, 424, 455, 497, 2618, 141, 493, 498, 494, 501, 141, 141, 502, 504, 511, 503, 141, 515, 521, 527, 512, 291, 291, 640, 291, 2618, 291, 509, 510, 2114, 292, 22, 22, 103, 98, 103, 103, 528, 104, 519, 531, 542, 104, 511, 520, 543, 515, 521, 527, 512, 105, 105, 105, 105, 105, 105, 105, 105, 103, 98, 103, 103, 549, 104, 1394, 1853, 528, 104, 519, 531, 542, 1901, 1395, 520, 543, 105, 105, 105, 105, 105, 105, 105, 105, 122, 122, 123, 122, 122, 122, 122, 2618, 549, 122, 122, 122, 122, 483, 122, 513, 125, 465, 484, 554, 1741, 1741, 505, 466, 485, 2164, 122, 122, 486, 467, 514, 2160, 126, 468, 469, 506, 470, 489, 516, 555, 507, 508, 483, 490, 513, 565, 465, 484, 554, 491, 492, 505, 466, 485, 517, 518, 566, 486, 467, 514, 127, 1901, 468, 469, 506, 470, 489, 516, 555, 507, 508, 150, 490, 613, 565, 613, 613, 353, 491, 492, 353, 567, 1562, 517, 518, 566, 622, 130, 122, 122, 136, 136, 613, 1135, 613, 613, 136, 640, 136, 137, 136, 138, 138, 138, 138, 138, 138, 138, 138, 139, 567, 136, 136, 136, 136, 130, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 136, 136, 136, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 150, 2114, 140, 140, 140, 140, 140, 140, 140, 140, 524, 522, 525, 526, 556, 529, 562, 563, 557, 151, 152, 523, 558, 568, 569, 573, 559, 564, 153, 574, 154, 530, 155, 575, 156, 157, 158, 159, 1853, 524, 522, 525, 526, 556, 529, 562, 563, 557, 151, 152, 523, 558, 568, 569, 573, 559, 564, 153, 574, 154, 530, 155, 575, 156, 157, 158, 159, 150, 160, 140, 140, 140, 140, 140, 140, 140, 140, 544, 550, 1958, 551, 560, 576, 570, 161, 577, 545, 571, 546, 552, 578, 579, 547, 580, 548, 561, 584, 581, 1901, 553, 572, 588, 589, 590, 162, 593, 544, 550, 163, 551, 560, 576, 570, 161, 577, 545, 571, 546, 552, 578, 579, 547, 580, 548, 561, 584, 581, 582, 553, 572, 588, 589, 590, 162, 593, 583, 1562, 163, 136, 329, 329, 594, 1105, 585, 1105, 1105, 595, 586, 141, 2618, 591, 587, 141, 141, 164, 141, 582, 652, 165, 653, 592, 166, 167, 1135, 583, 168, 141, 331, 169, 170, 594, 171, 585, 172, 141, 595, 586, 141, 173, 591, 587, 141, 141, 164, 141, 1398, 652, 165, 653, 592, 166, 167, 141, 1399, 168, 141, 655, 169, 170, 1772, 171, 150, 172, 141, 667, 141, 677, 173, 136, 294, 295, 294, 294, 299, 299, 299, 299, 130, 141, 296, 296, 141, 297, 2618, 174, 655, 2618, 656, 175, 141, 310, 310, 176, 667, 141, 296, 640, 177, 178, 298, 299, 298, 298, 1394, 141, 141, 179, 141, 141, 300, 300, 1395, 301, 174, 315, 671, 656, 175, 141, 2618, 316, 176, 601, 601, 141, 300, 177, 178, 1398, 297, 305, 297, 297, 141, 141, 179, 1399, 141, 136, 297, 297, 1993, 297, 1391, 671, 1853, 316, 297, 305, 297, 297, 1392, 316, 141, 140, 297, 180, 297, 297, 344, 297, 345, 344, 1196, 346, 181, 1196, 182, 347, 1527, 183, 310, 310, 297, 184, 185, 310, 186, 141, 298, 299, 298, 298, 140, 658, 180, 601, 601, 141, 300, 300, 601, 301, 1986, 181, 320, 182, 310, 310, 183, 310, 321, 310, 184, 185, 300, 186, 141, 136, 301, 321, 301, 301, 658, 150, 601, 321, 141, 2618, 301, 301, 325, 301, 301, 187, 301, 301, 326, 2332, 141, 130, 654, 188, 301, 301, 301, 301, 141, 189, 662, 1953, 190, 191, 192, 141, 601, 601, 141, 141, 301, 601, 1859, 1859, 187, 345, 1562, 345, 345, 141, 614, 654, 188, 1105, 615, 1105, 1105, 141, 189, 662, 326, 190, 191, 192, 141, 1539, 326, 141, 141, 150, 1539, 141, 141, 141, 141, 141, 141, 141, 141, 193, 1931, 141, 301, 1931, 301, 301, 141, 194, 141, 141, 195, 141, 301, 301, 196, 301, 341, 1965, 341, 341, 1965, 197, 141, 198, 669, 199, 341, 341, 301, 341, 141, 141, 141, 663, 2618, 141, 194, 141, 141, 195, 141, 1894, 341, 196, 647, 647, 647, 647, 647, 647, 197, 141, 198, 669, 199, 200, 141, 141, 141, 201, 141, 141, 663, 141, 657, 2080, 141, 660, 721, 202, 141, 141, 141, 1944, 203, 323, 323, 323, 323, 323, 323, 323, 323, 738, 200, 141, 141, 141, 201, 605, 617, 617, 141, 657, 343, 141, 660, 721, 202, 141, 141, 141, 617, 203, 141, 659, 204, 205, 141, 206, 207, 141, 738, 141, 617, 665, 208, 209, 141, 210, 1890, 141, 211, 141, 338, 338, 338, 338, 338, 338, 338, 338, 1562, 141, 659, 204, 205, 141, 206, 207, 141, 1135, 141, 1790, 665, 208, 209, 141, 210, 617, 141, 211, 141, 215, 141, 640, 216, 217, 1791, 664, 141, 218, 1792, 619, 619, 219, 341, 220, 341, 342, 685, 343, 221, 1868, 1868, 619, 342, 342, 1790, 341, 141, 1853, 215, 141, 668, 216, 217, 619, 664, 141, 218, 340, 342, 1791, 219, 141, 220, 1792, 666, 685, 670, 221, 222, 223, 141, 224, 225, 674, 1527, 141, 226, 141, 141, 668, 227, 130, 228, 672, 229, 141, 230, 231, 619, 673, 141, 141, 232, 666, 718, 670, 675, 222, 223, 141, 224, 225, 674, 676, 1840, 226, 141, 141, 1798, 227, 677, 228, 672, 229, 141, 230, 231, 1562, 673, 1135, 141, 232, 141, 718, 679, 675, 141, 237, 2618, 141, 141, 141, 778, 238, 681, 239, 141, 240, 680, 241, 141, 141, 640, 625, 625, 625, 625, 625, 625, 625, 625, 141, 678, 679, 2618, 141, 237, 130, 141, 141, 141, 778, 238, 681, 239, 141, 240, 680, 241, 141, 141, 242, 795, 141, 684, 243, 1700, 244, 693, 245, 141, 678, 141, 682, 141, 246, 247, 691, 248, 624, 141, 625, 625, 625, 625, 625, 625, 625, 625, 1527, 242, 795, 141, 684, 243, 130, 244, 693, 245, 141, 1112, 141, 682, 141, 246, 247, 691, 248, 687, 141, 253, 688, 800, 141, 254, 141, 141, 255, 256, 694, 696, 257, 258, 689, 141, 259, 141, 141, 260, 261, 262, 141, 263, 690, 264, 1135, 692, 687, 801, 253, 688, 800, 141, 254, 141, 141, 255, 256, 694, 696, 257, 258, 689, 141, 259, 141, 141, 260, 261, 262, 141, 263, 690, 264, 265, 692, 266, 801, 267, 695, 141, 268, 269, 141, 697, 270, 698, 271, 272, 701, 702, 141, 141, 141, 803, 141, 703, 141, 273, 2618, 141, 1931, 699, 265, 1931, 266, 700, 267, 695, 141, 268, 269, 141, 697, 270, 698, 271, 272, 701, 702, 141, 141, 141, 803, 141, 703, 141, 273, 274, 141, 141, 699, 141, 275, 141, 700, 141, 705, 276, 719, 277, 141, 278, 279, 624, 1555, 626, 626, 626, 626, 626, 626, 626, 626, 1877, 1877, 2082, 274, 1551, 141, 130, 141, 275, 141, 1948, 141, 705, 276, 719, 277, 141, 278, 279, 310, 310, 310, 310, 141, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 717, 318, 310, 639, 639, 639, 639, 639, 639, 639, 639, 311, 310, 310, 310, 310, 310, 624, 141, 627, 627, 627, 627, 627, 628, 367, 367, 1191, 1965, 717, 1191, 1965, 624, 130, 367, 367, 367, 367, 367, 367, 367, 367, 1135, 374, 310, 310, 310, 150, 130, 630, 630, 630, 630, 630, 630, 630, 630, 644, 644, 644, 644, 644, 644, 644, 644, 645, 645, 645, 645, 645, 646, 647, 647, 310, 310, 310, 310, 310, 310, 141, 310, 310, 310, 310, 640, 310, 310, 310, 310, 310, 310, 2618, 310, 648, 648, 648, 648, 648, 648, 648, 648, 328, 310, 310, 310, 310, 310, 150, 141, 630, 630, 630, 630, 630, 630, 630, 630, 150, 141, 630, 630, 630, 630, 630, 630, 630, 630, 706, 649, 2045, 2045, 141, 753, 141, 310, 310, 310, 150, 150, 630, 630, 630, 630, 630, 630, 630, 630, 141, 1527, 141, 1112, 651, 1135, 141, 130, 739, 706, 649, 661, 707, 141, 753, 141, 310, 310, 122, 122, 123, 122, 122, 122, 122, 640, 711, 122, 122, 122, 122, 141, 122, 651, 125, 141, 2618, 739, 708, 141, 661, 707, 141, 709, 122, 122, 712, 713, 141, 1325, 126, 710, 141, 141, 141, 711, 1112, 150, 633, 630, 630, 630, 630, 630, 630, 630, 630, 708, 141, 716, 141, 141, 709, 640, 141, 712, 713, 141, 127, 1548, 710, 141, 141, 141, 1548, 150, 683, 630, 630, 630, 630, 630, 630, 630, 630, 2120, 2120, 2618, 716, 141, 2129, 2129, 686, 141, 2138, 2138, 122, 122, 122, 122, 123, 122, 122, 122, 122, 683, 1128, 122, 122, 122, 122, 150, 122, 630, 630, 630, 630, 630, 630, 630, 630, 686, 141, 714, 122, 122, 141, 640, 141, 1112, 126, 141, 141, 720, 715, 723, 704, 141, 722, 141, 724, 726, 141, 728, 141, 757, 141, 141, 729, 758, 725, 141, 714, 727, 737, 141, 141, 141, 358, 633, 141, 141, 720, 715, 723, 704, 141, 722, 141, 724, 726, 141, 728, 141, 757, 141, 141, 729, 758, 725, 2147, 2147, 727, 737, 640, 141, 122, 122, 122, 122, 123, 122, 122, 122, 122, 150, 141, 122, 122, 122, 122, 773, 122, 730, 141, 731, 141, 735, 761, 141, 734, 130, 141, 733, 122, 122, 736, 141, 741, 875, 122, 141, 141, 141, 740, 141, 742, 150, 141, 141, 732, 744, 743, 141, 746, 141, 735, 761, 141, 734, 141, 141, 733, 130, 141, 736, 141, 741, 360, 150, 141, 141, 141, 740, 633, 742, 745, 141, 141, 732, 744, 743, 748, 746, 747, 130, 749, 141, 1289, 141, 1289, 1289, 2394, 141, 141, 2394, 122, 122, 122, 122, 123, 122, 122, 122, 122, 745, 150, 122, 122, 122, 122, 748, 122, 747, 125, 749, 141, 141, 141, 141, 750, 754, 130, 141, 122, 122, 141, 752, 141, 2199, 126, 755, 751, 756, 141, 141, 141, 2078, 759, 763, 141, 779, 141, 141, 764, 762, 141, 141, 141, 750, 754, 760, 141, 770, 141, 141, 752, 141, 127, 867, 755, 751, 756, 141, 141, 141, 765, 759, 763, 141, 779, 141, 141, 764, 762, 1518, 867, 1518, 1518, 141, 760, 141, 770, 141, 2291, 2291, 122, 122, 136, 136, 1492, 861, 1492, 1492, 136, 765, 136, 371, 136, 372, 372, 372, 372, 372, 372, 372, 372, 139, 141, 136, 136, 136, 136, 130, 373, 373, 373, 373, 373, 373, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 136, 136, 136, 373, 373, 373, 373, 373, 373, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 150, 141, 141, 141, 141, 141, 141, 141, 141, 141, 193, 766, 141, 806, 780, 141, 865, 141, 141, 141, 141, 141, 141, 882, 882, 882, 882, 882, 882, 311, 141, 2080, 141, 769, 788, 768, 141, 141, 141, 1944, 766, 141, 806, 780, 141, 767, 141, 141, 141, 141, 141, 141, 378, 379, 380, 381, 382, 382, 382, 382, 382, 141, 769, 788, 768, 141, 141, 141, 383, 383, 383, 383, 383, 383, 767, 141, 950, 861, 950, 950, 771, 951, 2339, 2339, 2082, 774, 776, 141, 600, 141, 141, 775, 1948, 782, 141, 598, 777, 383, 383, 383, 383, 383, 383, 150, 141, 373, 373, 373, 373, 373, 373, 373, 373, 772, 774, 776, 141, 141, 141, 141, 775, 141, 782, 141, 419, 777, 783, 784, 141, 141, 141, 781, 787, 141, 141, 141, 786, 785, 141, 420, 789, 141, 772, 809, 421, 1518, 141, 1518, 1518, 790, 141, 2395, 791, 419, 2395, 783, 784, 141, 141, 141, 781, 787, 141, 141, 141, 786, 785, 141, 420, 789, 141, 796, 809, 421, 532, 141, 533, 534, 790, 792, 535, 791, 141, 536, 141, 793, 537, 141, 799, 538, 539, 850, 540, 541, 1023, 137, 1023, 1023, 794, 1024, 796, 2344, 2344, 532, 141, 533, 534, 633, 792, 535, 631, 141, 536, 141, 793, 537, 141, 799, 538, 539, 850, 540, 541, 310, 310, 310, 310, 794, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 798, 318, 310, 130, 802, 141, 815, 141, 141, 141, 141, 311, 310, 310, 310, 310, 310, 130, 797, 804, 141, 141, 811, 141, 141, 810, 805, 807, 141, 798, 141, 823, 808, 802, 141, 815, 141, 141, 141, 141, 130, 817, 150, 818, 310, 310, 310, 797, 804, 141, 141, 811, 141, 141, 810, 805, 807, 141, 130, 141, 823, 808, 2349, 2349, 816, 141, 141, 1747, 854, 141, 817, 820, 1747, 310, 310, 310, 310, 310, 310, 623, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 621, 310, 310, 816, 141, 141, 141, 854, 141, 141, 820, 311, 310, 310, 310, 310, 310, 340, 141, 819, 822, 821, 824, 845, 812, 141, 612, 813, 141, 826, 814, 141, 825, 141, 141, 141, 141, 1865, 141, 611, 141, 832, 1865, 835, 310, 310, 310, 141, 819, 822, 821, 824, 845, 812, 141, 141, 813, 141, 826, 814, 141, 825, 141, 141, 830, 141, 831, 605, 827, 141, 832, 827, 835, 310, 310, 310, 310, 310, 310, 311, 310, 310, 310, 310, 141, 310, 310, 310, 310, 310, 310, 141, 310, 830, 836, 831, 141, 833, 2354, 2354, 828, 328, 310, 310, 310, 310, 310, 600, 141, 834, 837, 141, 141, 141, 141, 141, 840, 839, 141, 141, 141, 829, 141, 836, 838, 141, 833, 841, 842, 828, 599, 844, 141, 906, 310, 310, 607, 141, 834, 837, 141, 141, 141, 141, 141, 840, 839, 141, 141, 598, 829, 141, 597, 838, 843, 846, 841, 842, 141, 141, 844, 141, 906, 310, 310, 601, 601, 601, 601, 596, 601, 601, 601, 601, 141, 601, 601, 601, 601, 601, 601, 141, 601, 843, 846, 859, 141, 141, 141, 847, 852, 609, 601, 601, 601, 601, 601, 488, 141, 141, 851, 141, 141, 141, 848, 849, 853, 855, 141, 141, 141, 141, 141, 141, 859, 141, 487, 856, 847, 852, 857, 858, 903, 860, 601, 601, 610, 141, 141, 851, 141, 141, 139, 848, 849, 853, 855, 141, 141, 472, 141, 141, 141, 1874, 601, 601, 856, 141, 1874, 857, 858, 903, 860, 601, 601, 122, 122, 123, 122, 122, 122, 122, 448, 141, 122, 122, 122, 122, 316, 122, 601, 601, 601, 601, 862, 601, 141, 601, 141, 617, 617, 122, 122, 343, 904, 141, 139, 126, 2359, 2359, 1883, 617, 141, 374, 321, 1883, 326, 141, 141, 601, 863, 141, 864, 617, 619, 619, 901, 141, 902, 130, 141, 898, 343, 904, 141, 358, 619, 868, 869, 870, 871, 871, 871, 871, 871, 676, 141, 141, 619, 905, 141, 130, 677, 141, 2199, 901, 907, 902, 617, 141, 898, 141, 2078, 122, 122, 122, 122, 123, 122, 122, 122, 122, 2412, 2412, 122, 122, 122, 122, 905, 122, 908, 141, 141, 619, 1289, 907, 1289, 1289, 137, 1075, 141, 122, 122, 916, 928, 141, 2330, 126, 625, 625, 625, 625, 625, 625, 625, 625, 2332, 141, 944, 908, 141, 624, 130, 367, 367, 367, 367, 367, 367, 367, 367, 130, 916, 928, 141, 358, 624, 130, 367, 367, 367, 367, 367, 367, 367, 367, 141, 944, 1850, 132, 1850, 1850, 130, 879, 879, 879, 879, 879, 879, 879, 879, 2457, 2457, 122, 122, 122, 122, 123, 122, 122, 122, 122, 130, 120, 122, 122, 122, 122, 624, 122, 367, 367, 367, 367, 367, 367, 625, 625, 141, 914, 917, 122, 122, 915, 130, 340, 371, 122, 872, 872, 872, 872, 872, 872, 872, 872, 139, 880, 880, 880, 880, 880, 881, 882, 882, 632, 632, 141, 914, 917, 632, 141, 915, 141, 2618, 360, 883, 883, 883, 883, 883, 883, 883, 883, 884, 884, 884, 884, 884, 884, 884, 884, 885, 886, 887, 888, 888, 888, 888, 888, 141, 311, 141, 122, 122, 122, 122, 123, 122, 122, 122, 122, 311, 146, 122, 122, 122, 122, 141, 122, 891, 892, 893, 894, 894, 894, 894, 894, 913, 927, 918, 122, 122, 118, 141, 141, 2618, 122, 896, 896, 896, 896, 896, 896, 896, 896, 640, 141, 897, 897, 897, 897, 897, 897, 897, 897, 141, 913, 927, 918, 920, 141, 899, 141, 141, 360, 2618, 2618, 141, 900, 141, 934, 1106, 141, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 2330, 2618, 2618, 141, 941, 2618, 130, 920, 141, 899, 2332, 122, 122, 136, 136, 141, 900, 141, 934, 136, 141, 136, 371, 136, 629, 629, 629, 629, 629, 629, 629, 629, 139, 941, 136, 136, 136, 136, 130, 630, 630, 630, 630, 630, 630, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 136, 136, 136, 630, 630, 630, 630, 630, 630, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 378, 634, 635, 636, 637, 637, 637, 637, 637, 919, 141, 141, 141, 141, 945, 923, 638, 638, 638, 638, 638, 638, 1120, 1121, 1122, 1123, 1123, 1123, 1123, 1123, 2618, 2618, 1819, 924, 1819, 1819, 141, 141, 919, 141, 141, 141, 141, 945, 923, 638, 638, 638, 638, 638, 638, 640, 378, 641, 641, 641, 641, 641, 641, 641, 641, 642, 924, 925, 141, 141, 141, 141, 643, 643, 643, 643, 643, 643, 2618, 936, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 2618, 926, 935, 141, 141, 141, 141, 2618, 925, 141, 2618, 2618, 141, 643, 643, 643, 643, 643, 643, 150, 936, 141, 141, 141, 141, 141, 141, 141, 141, 193, 926, 935, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 650, 1492, 929, 1492, 1492, 939, 1280, 2618, 2618, 640, 930, 1126, 1126, 1126, 1126, 1126, 1126, 1126, 1126, 2618, 2618, 141, 141, 141, 141, 141, 141, 141, 141, 650, 310, 310, 310, 310, 939, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 160, 318, 310, 139, 931, 2618, 932, 1850, 933, 1850, 1850, 311, 310, 310, 310, 310, 310, 2618, 141, 937, 141, 943, 938, 141, 909, 921, 141, 912, 141, 922, 910, 141, 141, 931, 911, 932, 942, 933, 141, 141, 2618, 946, 947, 948, 310, 310, 310, 141, 937, 141, 943, 938, 141, 909, 921, 141, 912, 141, 922, 910, 141, 141, 2618, 911, 139, 942, 141, 141, 141, 955, 946, 947, 948, 310, 310, 601, 601, 601, 601, 141, 601, 601, 601, 601, 141, 601, 601, 601, 601, 601, 601, 940, 601, 141, 2618, 141, 141, 2618, 955, 141, 949, 609, 601, 601, 601, 601, 601, 861, 141, 950, 953, 950, 950, 141, 951, 954, 959, 958, 2618, 960, 940, 141, 141, 141, 141, 141, 961, 141, 141, 949, 956, 141, 2051, 141, 601, 601, 610, 2051, 1819, 953, 1819, 1819, 2618, 1659, 954, 2618, 958, 957, 960, 141, 141, 141, 141, 141, 2618, 961, 141, 2618, 2618, 141, 141, 952, 141, 601, 601, 640, 378, 876, 876, 876, 876, 876, 876, 876, 876, 877, 957, 962, 141, 141, 141, 141, 878, 878, 878, 878, 878, 878, 141, 150, 952, 1142, 1142, 1142, 1142, 1142, 1142, 2126, 141, 1814, 141, 972, 2126, 979, 2135, 130, 962, 2618, 141, 2135, 141, 878, 878, 878, 878, 878, 878, 378, 889, 889, 889, 889, 889, 889, 889, 889, 642, 141, 141, 141, 972, 141, 979, 890, 890, 890, 890, 890, 890, 963, 141, 967, 965, 141, 141, 141, 141, 964, 966, 968, 976, 873, 873, 973, 141, 974, 873, 141, 975, 2618, 141, 2618, 890, 890, 890, 890, 890, 890, 963, 141, 967, 965, 141, 141, 141, 141, 964, 966, 141, 976, 969, 970, 973, 141, 974, 977, 141, 975, 141, 985, 980, 141, 981, 141, 2618, 141, 971, 978, 141, 141, 141, 982, 983, 984, 986, 987, 988, 141, 2144, 969, 970, 989, 141, 2144, 977, 141, 2618, 141, 985, 980, 141, 981, 141, 141, 141, 971, 978, 141, 141, 141, 982, 991, 141, 986, 987, 988, 141, 141, 993, 141, 995, 141, 992, 141, 994, 996, 997, 990, 141, 141, 999, 141, 141, 141, 141, 998, 1001, 141, 2618, 1002, 991, 141, 141, 141, 1000, 141, 141, 993, 141, 995, 141, 992, 141, 994, 996, 997, 990, 141, 141, 999, 141, 141, 141, 141, 998, 1001, 141, 1003, 1002, 1004, 141, 141, 141, 1000, 1005, 141, 141, 141, 141, 141, 1006, 1007, 141, 1009, 1011, 1008, 141, 141, 141, 771, 141, 141, 141, 2618, 141, 141, 1003, 2618, 1004, 141, 1014, 1010, 1013, 1005, 141, 141, 141, 141, 1018, 1006, 1007, 141, 1009, 1011, 1008, 141, 141, 141, 1015, 1016, 141, 141, 1012, 141, 141, 141, 141, 141, 1025, 1014, 1010, 1013, 1017, 1027, 1019, 1020, 1029, 1018, 141, 1021, 1023, 141, 1023, 1023, 1028, 1024, 1026, 1015, 1016, 141, 141, 1012, 141, 1022, 141, 141, 141, 1025, 1030, 2618, 1031, 1017, 1027, 1019, 1020, 1029, 141, 141, 1021, 1033, 141, 1032, 141, 1028, 141, 1026, 141, 141, 141, 141, 141, 141, 1022, 1034, 141, 141, 2618, 1037, 1036, 1038, 1035, 141, 874, 874, 141, 141, 1043, 874, 1033, 141, 1032, 141, 141, 141, 1044, 141, 141, 1040, 141, 141, 2618, 141, 1034, 141, 141, 141, 1037, 1036, 1041, 1035, 141, 1039, 141, 141, 2618, 1043, 1045, 1046, 141, 141, 1049, 141, 1042, 1044, 141, 1047, 1040, 141, 141, 141, 141, 1048, 1051, 141, 141, 1058, 141, 1041, 141, 141, 1039, 141, 1052, 1054, 1053, 1045, 1046, 141, 141, 1049, 141, 1042, 1050, 141, 1047, 141, 141, 141, 141, 1055, 1048, 1051, 141, 141, 1058, 141, 1056, 141, 141, 1060, 1057, 1052, 1054, 1053, 141, 141, 141, 141, 1059, 141, 141, 1050, 141, 141, 141, 141, 1064, 1063, 1055, 2618, 1061, 141, 141, 1062, 141, 1056, 1065, 827, 1060, 1057, 827, 141, 141, 141, 141, 1084, 141, 1059, 2153, 141, 141, 141, 141, 2153, 1068, 1064, 1063, 1069, 1070, 1061, 141, 1071, 1062, 141, 1072, 1065, 2618, 141, 141, 141, 141, 141, 1066, 1067, 1084, 1081, 141, 1083, 141, 141, 1073, 2618, 1074, 1068, 1074, 1074, 141, 1075, 1079, 1088, 1071, 1080, 141, 1072, 2618, 141, 141, 141, 141, 1082, 2618, 1066, 1067, 141, 1081, 141, 1083, 141, 1085, 1073, 1076, 141, 141, 141, 141, 141, 141, 1079, 1093, 1086, 1080, 141, 141, 1087, 141, 141, 141, 141, 1082, 1077, 1089, 1091, 141, 1078, 1094, 1090, 1092, 1085, 141, 2618, 141, 141, 141, 141, 141, 141, 1098, 1093, 1086, 141, 1099, 141, 1087, 2618, 141, 141, 141, 141, 1077, 1089, 1091, 141, 1078, 1094, 1090, 1092, 1095, 141, 1096, 1097, 141, 141, 1150, 141, 141, 1098, 141, 141, 141, 1099, 1100, 1102, 1101, 141, 1104, 2618, 141, 1103, 141, 2297, 141, 160, 2618, 2618, 2297, 1095, 2618, 1096, 1097, 141, 141, 1150, 141, 141, 2618, 141, 141, 2618, 2618, 1100, 1102, 1101, 141, 1104, 1152, 141, 1103, 141, 1106, 2618, 1108, 1108, 1108, 1108, 1108, 1109, 868, 868, 2618, 2618, 2618, 141, 2618, 1106, 130, 868, 868, 868, 868, 868, 868, 868, 868, 1152, 141, 2618, 2618, 2618, 371, 130, 872, 872, 872, 872, 872, 872, 872, 872, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1332, 1332, 1332, 1332, 1332, 1332, 1128, 141, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1128, 2618, 1130, 1130, 1130, 1130, 1130, 1131, 885, 885, 1128, 2618, 885, 885, 885, 885, 885, 885, 885, 885, 141, 378, 1113, 1114, 1115, 1116, 1116, 1116, 1116, 1116, 141, 1154, 1145, 141, 1169, 1144, 141, 1117, 1117, 1117, 1117, 1117, 1117, 1134, 1134, 1134, 1134, 1134, 1134, 1134, 1134, 1139, 1139, 1139, 1139, 1139, 1139, 1139, 1139, 141, 1154, 1145, 141, 1169, 1144, 141, 1117, 1117, 1117, 1117, 1117, 1117, 378, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 877, 1148, 1170, 1171, 1172, 141, 2618, 1119, 1119, 1119, 1119, 1119, 1119, 1140, 1140, 1140, 1140, 1140, 1141, 1142, 1142, 2618, 2618, 141, 1155, 141, 141, 141, 1151, 2618, 1148, 1170, 1171, 1172, 141, 1143, 1119, 1119, 1119, 1119, 1119, 1119, 378, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 642, 141, 1155, 141, 141, 141, 1151, 1133, 1133, 1133, 1133, 1133, 1133, 1143, 1319, 1320, 1321, 1322, 1322, 1322, 1322, 1322, 1110, 1110, 1156, 141, 2341, 1110, 130, 141, 1158, 2341, 2313, 1158, 2313, 2313, 1133, 1133, 1133, 1133, 1133, 1133, 1135, 378, 1136, 1136, 1136, 1136, 1136, 1136, 1136, 1136, 1137, 1156, 141, 141, 141, 141, 141, 1138, 1138, 1138, 1138, 1138, 1138, 1146, 1147, 1149, 1153, 1157, 141, 2346, 141, 141, 141, 2618, 2346, 1167, 141, 2618, 1159, 1160, 2618, 141, 141, 141, 141, 1161, 1138, 1138, 1138, 1138, 1138, 1138, 1146, 1147, 1149, 1153, 1157, 141, 141, 141, 141, 141, 141, 141, 1167, 141, 141, 1159, 1160, 141, 141, 1162, 1166, 1164, 1161, 1163, 141, 1165, 929, 141, 1173, 1168, 141, 141, 1174, 141, 930, 141, 141, 2618, 1176, 141, 141, 1175, 141, 141, 2618, 1177, 141, 141, 1162, 1166, 1164, 1180, 1163, 141, 1165, 141, 141, 1173, 1168, 141, 141, 1174, 141, 1178, 141, 141, 141, 1176, 141, 1179, 1175, 141, 141, 931, 1177, 932, 141, 933, 1181, 1182, 1180, 141, 1187, 141, 141, 141, 1189, 1188, 141, 1183, 141, 141, 1178, 141, 141, 141, 1184, 141, 1179, 1186, 1185, 141, 931, 141, 932, 141, 933, 1181, 1182, 1190, 141, 1187, 141, 141, 141, 1189, 1188, 141, 1183, 141, 141, 1193, 1192, 141, 141, 1184, 1199, 1194, 1186, 1185, 141, 1195, 141, 1196, 141, 141, 1196, 1197, 1190, 1198, 141, 141, 141, 141, 2618, 141, 1200, 141, 1201, 141, 1193, 1192, 141, 141, 1202, 1199, 1194, 1203, 141, 141, 1195, 141, 141, 1207, 141, 2618, 1197, 2618, 1198, 141, 141, 1204, 141, 141, 141, 1200, 141, 1201, 141, 141, 141, 141, 1206, 1202, 1205, 141, 1203, 141, 141, 141, 141, 141, 1207, 141, 141, 141, 1208, 141, 1213, 141, 1204, 1218, 141, 2618, 1209, 1210, 141, 1211, 141, 141, 1214, 1206, 1212, 1205, 141, 150, 1216, 141, 141, 2618, 141, 2618, 141, 141, 141, 1208, 141, 1213, 141, 141, 1218, 130, 1217, 1209, 1210, 141, 1211, 1215, 141, 1214, 141, 1212, 1221, 141, 1223, 1216, 141, 1219, 141, 141, 1224, 2618, 141, 1226, 141, 141, 1220, 141, 141, 1222, 141, 1217, 1225, 1230, 1228, 1227, 1215, 141, 141, 141, 1231, 1221, 141, 1223, 141, 141, 1219, 141, 141, 1224, 1229, 141, 1226, 141, 141, 1220, 141, 141, 1222, 141, 141, 1225, 1230, 1228, 1227, 141, 1232, 141, 1234, 1231, 1236, 141, 141, 141, 1233, 141, 141, 141, 141, 1229, 1235, 141, 1238, 1240, 1237, 141, 141, 141, 1243, 141, 1241, 2351, 1239, 141, 141, 1232, 2351, 1234, 1242, 1236, 141, 141, 141, 1233, 141, 141, 141, 141, 141, 1235, 141, 1238, 1240, 1237, 141, 1244, 141, 1243, 141, 1241, 141, 1239, 141, 1246, 1245, 141, 141, 1242, 141, 141, 1247, 141, 1249, 141, 1251, 141, 1248, 141, 1252, 141, 141, 141, 1253, 2618, 1244, 1250, 141, 141, 141, 141, 1254, 2618, 1246, 1245, 141, 141, 150, 141, 141, 1247, 1257, 1249, 141, 1251, 141, 1248, 2618, 1252, 141, 141, 141, 1253, 130, 141, 1250, 141, 141, 141, 1256, 1254, 141, 141, 1262, 1260, 141, 141, 1264, 1255, 141, 1257, 141, 1258, 1259, 141, 1265, 1261, 141, 141, 1267, 1266, 2618, 1270, 141, 1271, 2618, 141, 141, 1256, 141, 141, 141, 1263, 1260, 141, 141, 1264, 1255, 141, 141, 141, 1258, 1259, 141, 1265, 1261, 141, 141, 1267, 1266, 1268, 1270, 141, 1271, 1269, 141, 141, 1273, 141, 141, 141, 1263, 141, 141, 141, 141, 141, 1272, 141, 1276, 1274, 1277, 141, 141, 141, 1275, 141, 1111, 1111, 1268, 2618, 141, 1111, 1269, 141, 1278, 1273, 1285, 141, 141, 141, 141, 141, 141, 141, 141, 1272, 141, 1276, 1274, 1277, 2618, 141, 141, 1275, 141, 1279, 1286, 1279, 1279, 1289, 1280, 1289, 1289, 1278, 1074, 1285, 1074, 1074, 141, 1075, 141, 1291, 1292, 2618, 150, 141, 1293, 2356, 141, 1290, 141, 2618, 2356, 1281, 1294, 1286, 141, 2618, 141, 141, 130, 1296, 1287, 141, 1297, 141, 2618, 141, 1282, 141, 1291, 1292, 1283, 1307, 1295, 1293, 1284, 141, 1290, 141, 141, 1288, 1308, 1294, 1298, 141, 141, 141, 141, 141, 1296, 1300, 141, 1297, 141, 1304, 141, 1282, 1299, 2618, 1310, 1283, 1307, 1295, 141, 1284, 1301, 1302, 1303, 141, 1288, 1308, 1309, 1298, 141, 141, 1311, 141, 141, 141, 1300, 141, 141, 1314, 141, 141, 1305, 1299, 141, 1310, 141, 1313, 141, 141, 1315, 1316, 1306, 141, 1312, 141, 141, 1309, 2618, 141, 2618, 1311, 141, 141, 141, 1317, 141, 141, 1314, 141, 141, 1305, 2618, 141, 141, 141, 1313, 141, 141, 1315, 1316, 1306, 141, 1312, 141, 141, 1343, 1343, 1343, 1343, 1343, 1343, 141, 1106, 1317, 868, 868, 868, 868, 868, 868, 868, 868, 141, 2618, 2618, 2618, 141, 1106, 130, 868, 868, 868, 868, 868, 868, 868, 868, 1362, 2618, 2618, 2618, 1369, 1106, 130, 868, 868, 868, 868, 868, 868, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 130, 640, 378, 1326, 1326, 1326, 1326, 1326, 1326, 1326, 1326, 1327, 1369, 1364, 1371, 141, 141, 141, 1328, 1328, 1328, 1328, 1328, 1328, 1330, 1330, 1330, 1330, 1330, 1331, 1332, 1332, 2618, 2618, 1333, 1333, 1333, 1333, 1333, 1333, 1333, 1333, 1364, 1371, 141, 141, 141, 1328, 1328, 1328, 1328, 1328, 1328, 378, 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334, 877, 1382, 1387, 1365, 1390, 141, 2618, 1335, 1335, 1335, 1335, 1335, 1335, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 141, 1382, 1387, 2618, 1390, 141, 1372, 1335, 1335, 1335, 1335, 1335, 1335, 1135, 378, 1337, 1337, 1337, 1337, 1337, 1337, 1337, 1337, 1338, 141, 1401, 141, 141, 141, 141, 1339, 1339, 1339, 1339, 1339, 1339, 1341, 1341, 1341, 1341, 1341, 1342, 1343, 1343, 1344, 1345, 1346, 1347, 1347, 1347, 1347, 1347, 2618, 141, 1401, 141, 141, 141, 2618, 1339, 1339, 1339, 1339, 1339, 1339, 1128, 2618, 885, 885, 885, 885, 885, 885, 885, 885, 1128, 2618, 885, 885, 885, 885, 885, 885, 885, 885, 1128, 2618, 885, 885, 885, 885, 885, 885, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 642, 378, 639, 639, 639, 639, 639, 639, 639, 639, 642, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 642, 1349, 1350, 1351, 1352, 1352, 1352, 1352, 1352, 378, 1353, 1353, 1353, 1353, 1353, 1353, 1353, 1353, 1137, 1385, 1406, 1407, 2618, 141, 141, 1354, 1354, 1354, 1354, 1354, 1354, 1355, 1356, 1357, 1358, 1358, 1358, 1358, 1358, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 1360, 2618, 1385, 1406, 1407, 141, 141, 141, 1354, 1354, 1354, 1354, 1354, 1354, 1135, 1363, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 1361, 141, 2618, 141, 141, 141, 1373, 141, 141, 2618, 141, 141, 1367, 1366, 1391, 1368, 1370, 1384, 1383, 1381, 141, 1363, 1392, 1398, 141, 2618, 141, 1386, 141, 141, 141, 1399, 141, 141, 141, 1388, 141, 141, 1374, 141, 1389, 1367, 1366, 141, 1368, 1370, 1384, 1383, 1381, 141, 1409, 1394, 141, 141, 141, 141, 1386, 141, 141, 1395, 1400, 1393, 1408, 1402, 1388, 1403, 141, 1374, 2618, 1389, 141, 1404, 141, 1158, 1404, 141, 1158, 141, 1410, 2618, 2618, 141, 2618, 141, 1396, 1416, 1412, 141, 1413, 1400, 1393, 1408, 1402, 141, 1403, 141, 1411, 1397, 141, 141, 141, 1414, 2618, 1415, 141, 1422, 141, 1410, 1375, 141, 1376, 141, 1377, 1396, 1416, 1412, 141, 1413, 1378, 141, 1379, 1405, 141, 1380, 141, 1411, 1397, 141, 1420, 141, 1414, 1418, 1415, 141, 1422, 1417, 141, 1375, 141, 1376, 141, 1377, 1419, 141, 141, 141, 2618, 1378, 141, 1379, 1405, 141, 1380, 141, 141, 1421, 1427, 1420, 1426, 1423, 1418, 141, 141, 1424, 1417, 141, 141, 141, 1428, 1425, 141, 1419, 141, 141, 141, 141, 141, 1431, 1430, 141, 141, 1429, 1433, 141, 1421, 1427, 141, 1426, 1423, 1432, 141, 141, 1424, 141, 141, 141, 141, 1428, 1425, 141, 150, 141, 2618, 1435, 141, 141, 1431, 1430, 141, 141, 1429, 1433, 141, 141, 1436, 141, 130, 1440, 1432, 141, 141, 141, 141, 141, 1438, 1441, 1437, 1439, 141, 141, 141, 1434, 1435, 141, 141, 1444, 141, 1450, 141, 1443, 1445, 141, 141, 1436, 1442, 141, 1440, 141, 141, 141, 141, 1446, 2618, 1438, 1441, 1437, 1439, 141, 141, 141, 1434, 141, 141, 141, 141, 141, 1450, 1453, 1443, 1445, 1447, 1448, 141, 1442, 141, 1449, 141, 1451, 141, 141, 1446, 141, 141, 1455, 2618, 141, 141, 1452, 141, 1454, 141, 1459, 2618, 141, 141, 141, 1453, 141, 1461, 1447, 1448, 141, 141, 1460, 1449, 1464, 1451, 1456, 141, 141, 141, 141, 141, 1457, 141, 141, 1452, 1458, 1454, 141, 1459, 141, 1463, 141, 141, 1465, 141, 1461, 141, 141, 1462, 141, 1460, 1467, 1464, 141, 1456, 150, 141, 141, 141, 141, 1457, 1466, 141, 1468, 1458, 1470, 141, 1471, 141, 1463, 1472, 130, 1465, 141, 141, 141, 141, 1462, 1475, 1473, 1467, 150, 141, 141, 141, 1469, 141, 141, 2618, 141, 1466, 141, 1468, 141, 1470, 1476, 1471, 130, 1477, 1472, 1478, 141, 141, 141, 141, 141, 1484, 1475, 1473, 141, 141, 1480, 141, 141, 1469, 1487, 1479, 1474, 141, 1482, 1481, 141, 141, 1488, 1476, 141, 141, 1477, 1493, 1478, 141, 141, 1483, 141, 141, 1484, 1486, 2361, 141, 141, 1480, 141, 2361, 1485, 1487, 1479, 1474, 1489, 1482, 1481, 141, 1495, 1488, 141, 141, 141, 1492, 1493, 1492, 1492, 141, 1483, 1494, 2618, 1279, 1486, 1279, 1279, 1496, 1280, 141, 150, 1485, 141, 1497, 141, 1489, 141, 141, 141, 1495, 1498, 141, 1499, 1501, 141, 141, 130, 1500, 141, 1502, 1494, 1490, 1505, 141, 141, 141, 1496, 141, 141, 2618, 141, 141, 1497, 141, 1503, 141, 141, 141, 141, 1498, 1491, 1499, 1501, 141, 141, 1506, 1500, 141, 1502, 1504, 141, 1505, 141, 141, 141, 1507, 141, 141, 141, 141, 1509, 1511, 1510, 1503, 141, 1508, 1512, 141, 141, 1491, 141, 141, 141, 141, 1506, 141, 1513, 141, 1504, 141, 1514, 1515, 141, 141, 1507, 1516, 2618, 141, 2618, 1509, 1511, 1510, 141, 141, 1508, 1512, 2618, 141, 2618, 141, 141, 141, 141, 1517, 141, 1513, 141, 1570, 2459, 1514, 1515, 141, 141, 2459, 1516, 1569, 1569, 1569, 1569, 1569, 1569, 141, 1519, 1520, 1520, 1520, 1520, 1520, 1520, 1520, 1520, 2618, 1517, 150, 141, 141, 1570, 130, 1519, 1521, 1521, 1521, 1521, 1521, 1521, 1521, 1521, 2618, 2618, 130, 141, 141, 1577, 130, 1519, 1522, 1522, 1522, 1522, 1522, 1523, 1524, 1524, 141, 141, 2618, 2618, 2618, 1572, 130, 1519, 1524, 1524, 1524, 1524, 1524, 1524, 1524, 1524, 141, 141, 1577, 2618, 2618, 2618, 130, 378, 1528, 1529, 1530, 1531, 1531, 1531, 1531, 1531, 141, 1574, 1572, 1571, 141, 141, 1580, 1532, 1532, 1532, 1532, 1532, 1532, 1535, 1536, 1537, 1538, 1538, 1538, 1538, 1538, 1540, 1540, 1540, 1540, 1540, 1540, 1540, 1540, 141, 1574, 2618, 1571, 141, 141, 1580, 1532, 1532, 1532, 1532, 1532, 1532, 378, 1533, 1533, 1533, 1533, 1533, 1533, 1533, 1533, 1327, 2618, 2618, 2618, 1581, 1582, 1583, 1534, 1534, 1534, 1534, 1534, 1534, 640, 2618, 1541, 1541, 1541, 1541, 1541, 1541, 1541, 1541, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 877, 1581, 1582, 1583, 1534, 1534, 1534, 1534, 1534, 1534, 378, 639, 639, 639, 639, 639, 639, 639, 639, 877, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 877, 378, 1542, 1542, 1542, 1542, 1542, 1542, 1542, 1542, 1338, 1578, 1584, 141, 1591, 1579, 141, 1543, 1543, 1543, 1543, 1543, 1543, 1544, 1545, 1546, 1547, 1547, 1547, 1547, 1547, 1549, 1549, 1549, 1549, 1549, 1549, 1549, 1549, 2618, 1578, 1584, 141, 1591, 1579, 141, 1543, 1543, 1543, 1543, 1543, 1543, 1135, 2618, 1550, 1550, 1550, 1550, 1550, 1550, 1550, 1550, 1551, 2618, 1552, 1552, 1552, 1552, 1552, 1552, 1552, 1552, 1551, 2618, 1553, 1553, 1553, 1553, 1553, 1554, 1344, 1344, 1551, 2618, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 884, 884, 884, 884, 884, 884, 884, 884, 1555, 2618, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1555, 2618, 1557, 1557, 1557, 1557, 1557, 1558, 1349, 1349, 1555, 2618, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 378, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1137, 141, 1592, 141, 1594, 1585, 1587, 1560, 1560, 1560, 1560, 1560, 1560, 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 2618, 141, 1592, 141, 1594, 1585, 1587, 1560, 1560, 1560, 1560, 1560, 1560, 1562, 378, 1563, 1563, 1563, 1563, 1563, 1563, 1563, 1563, 1564, 2618, 1595, 2618, 1597, 2618, 141, 1565, 1565, 1565, 1565, 1565, 1565, 1567, 1567, 1567, 1567, 1567, 1568, 1569, 1569, 141, 1575, 1576, 1589, 141, 1391, 141, 141, 141, 1586, 1595, 1573, 1597, 1392, 141, 1565, 1565, 1565, 1565, 1565, 1565, 1588, 141, 1596, 1409, 141, 1590, 141, 2618, 141, 1575, 1576, 1589, 141, 141, 141, 141, 141, 1586, 1404, 1573, 1404, 1404, 1599, 1404, 1600, 1599, 141, 2618, 2618, 1588, 141, 1596, 1593, 141, 1590, 141, 1601, 141, 1604, 1603, 141, 141, 141, 141, 950, 141, 950, 950, 1607, 951, 1602, 141, 141, 1600, 1608, 141, 1605, 1606, 141, 1611, 141, 1593, 141, 141, 1598, 1601, 141, 1604, 1603, 141, 141, 1612, 141, 141, 141, 141, 1609, 1607, 2618, 1602, 141, 141, 141, 1608, 141, 1605, 1606, 141, 1611, 141, 1610, 141, 141, 1598, 1614, 141, 141, 1615, 141, 141, 1612, 141, 141, 141, 141, 1609, 1617, 1613, 1619, 141, 141, 141, 1616, 141, 2618, 1620, 1628, 150, 141, 1610, 1618, 141, 2618, 1614, 141, 141, 1615, 141, 141, 1621, 141, 141, 141, 130, 1623, 1617, 1613, 1629, 141, 141, 1624, 1616, 141, 141, 1625, 141, 141, 141, 1630, 1618, 141, 1622, 141, 1626, 1631, 1627, 141, 141, 1621, 141, 141, 141, 141, 1623, 141, 141, 1629, 141, 1634, 1624, 141, 141, 141, 1625, 141, 141, 1632, 1630, 1633, 141, 1622, 141, 1626, 1631, 1627, 141, 141, 141, 141, 141, 141, 141, 1635, 141, 141, 141, 141, 1634, 1636, 141, 141, 1637, 1455, 150, 141, 1632, 141, 1633, 141, 2618, 1641, 1639, 1640, 141, 1642, 141, 141, 141, 141, 130, 141, 1635, 1644, 1648, 141, 1643, 141, 1636, 2618, 141, 1637, 2618, 141, 141, 150, 141, 141, 1664, 1638, 1641, 1639, 1640, 141, 1642, 141, 1652, 141, 141, 141, 141, 130, 141, 1648, 1645, 1643, 141, 141, 1646, 1647, 1651, 1653, 141, 1649, 141, 141, 141, 1664, 1638, 150, 141, 2618, 2618, 1650, 1655, 1652, 141, 141, 141, 1656, 1657, 141, 141, 1645, 141, 130, 141, 1646, 1647, 1651, 1653, 141, 1649, 141, 141, 1668, 1666, 1667, 1665, 141, 1654, 141, 1650, 1655, 1672, 141, 1673, 141, 1656, 1657, 1671, 141, 1658, 141, 1658, 1658, 1670, 1659, 141, 141, 141, 1674, 1679, 2618, 141, 1666, 1667, 1665, 1675, 1654, 141, 141, 141, 1672, 1682, 1673, 141, 1676, 141, 1671, 1660, 141, 1677, 1669, 1678, 1670, 141, 141, 141, 141, 1674, 1679, 141, 141, 1680, 141, 141, 1675, 1684, 1661, 141, 141, 1662, 1663, 1681, 1683, 1676, 141, 141, 141, 141, 1677, 1669, 1678, 141, 141, 141, 1686, 141, 1687, 1685, 141, 141, 1680, 141, 141, 1689, 1684, 1661, 141, 141, 1662, 1663, 1681, 1683, 141, 1691, 141, 141, 1692, 141, 1688, 1690, 141, 141, 141, 1686, 1694, 1687, 1685, 1693, 141, 1695, 141, 141, 1689, 141, 2618, 141, 141, 2313, 2618, 2313, 2313, 141, 1691, 2618, 2618, 1692, 141, 1688, 1690, 2618, 141, 2618, 2110, 1694, 2110, 2110, 1693, 2111, 1695, 141, 141, 2111, 141, 1520, 1520, 1520, 1520, 1520, 1520, 1520, 1520, 1707, 1707, 1707, 1707, 1707, 1707, 130, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1697, 1718, 1718, 1718, 1718, 1718, 1718, 130, 1519, 1524, 1524, 1524, 1524, 1524, 1524, 1524, 1524, 1728, 1728, 1728, 1728, 1728, 1728, 130, 1519, 1524, 1524, 1524, 1524, 1524, 1524, 1524, 1524, 2618, 2618, 2618, 1750, 2618, 141, 130, 1519, 1524, 1524, 1524, 1524, 1524, 1524, 1520, 1520, 2618, 150, 2618, 2618, 2618, 2618, 130, 1519, 1520, 1520, 1520, 1520, 1520, 1520, 1520, 1520, 1750, 130, 141, 2618, 2618, 2618, 130, 640, 378, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1702, 141, 1755, 1756, 1752, 1754, 141, 1703, 1703, 1703, 1703, 1703, 1703, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1705, 1705, 1705, 1705, 1705, 1706, 1707, 1707, 2618, 141, 1755, 1756, 1752, 1754, 141, 1703, 1703, 1703, 1703, 1703, 1703, 2618, 2618, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 1708, 378, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1327, 1757, 1758, 1761, 1762, 1763, 1764, 1710, 1710, 1710, 1710, 1710, 1710, 1711, 1711, 1711, 1711, 1711, 1711, 1711, 1711, 1715, 1715, 1715, 1715, 1715, 1715, 1715, 1715, 141, 1757, 1758, 1761, 1762, 1763, 1764, 1710, 1710, 1710, 1710, 1710, 1710, 1135, 378, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1713, 141, 1770, 1771, 1774, 141, 141, 1714, 1714, 1714, 1714, 1714, 1714, 1716, 1716, 1716, 1716, 1716, 1717, 1718, 1718, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 2618, 141, 1770, 1771, 1774, 141, 2618, 1714, 1714, 1714, 1714, 1714, 1714, 378, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1338, 141, 141, 1776, 1777, 1765, 1768, 1720, 1720, 1720, 1720, 1720, 1720, 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1726, 1726, 1726, 1726, 1726, 1727, 1728, 1728, 2618, 141, 141, 1776, 1777, 1765, 1768, 1720, 1720, 1720, 1720, 1720, 1720, 1562, 378, 1722, 1722, 1722, 1722, 1722, 1722, 1722, 1722, 1723, 2618, 1773, 141, 1779, 141, 141, 1724, 1724, 1724, 1724, 1724, 1724, 1729, 1730, 1731, 1732, 1732, 1732, 1732, 1732, 1551, 2618, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1773, 141, 1779, 141, 141, 1724, 1724, 1724, 1724, 1724, 1724, 1551, 2618, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1551, 2618, 1344, 1344, 1344, 1344, 1344, 1344, 1733, 1734, 1735, 1736, 1736, 1736, 1736, 1736, 1555, 2618, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1555, 2618, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1555, 2618, 1349, 1349, 1349, 1349, 1349, 1349, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1137, 378, 639, 639, 639, 639, 639, 639, 639, 639, 1137, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1137, 1737, 1738, 1739, 1740, 1740, 1740, 1740, 1740, 378, 1741, 1741, 1741, 1741, 1741, 1741, 1741, 1741, 1564, 141, 1780, 2618, 1783, 141, 2618, 1742, 1742, 1742, 1742, 1742, 1742, 1743, 1744, 1745, 1746, 1746, 1746, 1746, 1746, 1748, 1748, 1748, 1748, 1748, 1748, 1748, 1748, 1599, 141, 1780, 1599, 1783, 141, 141, 1742, 1742, 1742, 1742, 1742, 1742, 1562, 1767, 1749, 1749, 1749, 1749, 1749, 1749, 1749, 1749, 136, 136, 2618, 141, 141, 1759, 136, 1784, 136, 150, 136, 1760, 141, 141, 1769, 448, 1785, 2618, 1766, 193, 1767, 136, 136, 136, 136, 130, 141, 1775, 1786, 1778, 1772, 1751, 141, 141, 1759, 141, 1784, 677, 2618, 141, 1760, 2618, 141, 1769, 1787, 1785, 1782, 1766, 1789, 1781, 2618, 2618, 136, 136, 136, 141, 1775, 1786, 1778, 141, 1751, 136, 136, 141, 141, 150, 1794, 136, 141, 136, 150, 136, 141, 1787, 141, 1782, 472, 1789, 1781, 678, 193, 130, 136, 136, 136, 136, 130, 1795, 141, 141, 141, 1753, 141, 1801, 1793, 1794, 141, 487, 141, 1804, 1799, 141, 2618, 141, 141, 141, 141, 141, 678, 1802, 1788, 2618, 1803, 136, 136, 136, 1795, 141, 141, 141, 1753, 1800, 1801, 1793, 141, 141, 141, 141, 1804, 1799, 141, 1796, 141, 141, 141, 141, 141, 1808, 1802, 1788, 141, 1803, 1807, 141, 141, 1806, 141, 150, 141, 1805, 1800, 150, 141, 141, 141, 141, 1811, 1813, 141, 141, 1796, 141, 141, 130, 1810, 141, 1808, 130, 141, 141, 2618, 1807, 141, 141, 1806, 141, 141, 141, 1805, 1809, 1815, 141, 2618, 141, 141, 1811, 1813, 141, 1816, 141, 2618, 141, 1812, 1810, 141, 2618, 1658, 141, 1658, 1658, 1819, 1659, 1819, 1819, 141, 141, 141, 141, 1809, 1815, 141, 1821, 1823, 141, 2618, 150, 1825, 1816, 141, 1820, 1822, 1812, 141, 1824, 1817, 141, 1826, 1827, 141, 1829, 1830, 130, 1831, 141, 1834, 141, 141, 1832, 1835, 141, 1821, 1823, 1828, 1818, 141, 1825, 1833, 1836, 1820, 1822, 141, 141, 1824, 141, 141, 1826, 1827, 141, 1829, 1830, 1838, 1831, 141, 1834, 141, 1843, 1832, 1835, 1841, 141, 141, 1828, 1818, 141, 1844, 1833, 1836, 1837, 141, 141, 141, 1842, 141, 1846, 141, 141, 141, 141, 1909, 1838, 1845, 141, 1914, 141, 1843, 1915, 141, 1841, 141, 141, 1847, 1848, 2618, 1844, 2618, 2618, 1837, 141, 2618, 141, 1842, 1849, 1846, 141, 141, 141, 141, 1909, 2618, 1845, 141, 1914, 2618, 2618, 1915, 141, 2618, 1916, 2618, 1847, 1848, 1861, 1862, 1863, 1864, 1864, 1864, 1864, 1864, 2618, 1849, 378, 1854, 1855, 1856, 1857, 1857, 1857, 1857, 1857, 1908, 1908, 1908, 1908, 1908, 1908, 1916, 1858, 1858, 1858, 1858, 1858, 1858, 1866, 1866, 1866, 1866, 1866, 1866, 1866, 1866, 640, 2618, 1867, 1867, 1867, 1867, 1867, 1867, 1867, 1867, 2618, 2618, 2618, 2618, 2618, 1858, 1858, 1858, 1858, 1858, 1858, 378, 1859, 1859, 1859, 1859, 1859, 1859, 1859, 1859, 1702, 2618, 2618, 2618, 1917, 1918, 1919, 1860, 1860, 1860, 1860, 1860, 1860, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1327, 378, 639, 639, 639, 639, 639, 639, 639, 639, 1327, 1917, 1918, 1919, 1860, 1860, 1860, 1860, 1860, 1860, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1327, 378, 1868, 1868, 1868, 1868, 1868, 1868, 1868, 1868, 1713, 1920, 1921, 1924, 141, 141, 1927, 1869, 1869, 1869, 1869, 1869, 1869, 1870, 1871, 1872, 1873, 1873, 1873, 1873, 1873, 1875, 1875, 1875, 1875, 1875, 1875, 1875, 1875, 2618, 1920, 1921, 1924, 141, 141, 1927, 1869, 1869, 1869, 1869, 1869, 1869, 1135, 2618, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 1876, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1338, 378, 639, 639, 639, 639, 639, 639, 639, 639, 1338, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1338, 378, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1723, 1922, 1929, 1932, 1934, 1923, 1940, 1878, 1878, 1878, 1878, 1878, 1878, 1879, 1880, 1881, 1882, 1882, 1882, 1882, 1882, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 1884, 2618, 1922, 1929, 1932, 1934, 1923, 1940, 1878, 1878, 1878, 1878, 1878, 1878, 1562, 2618, 1885, 1885, 1885, 1885, 1885, 1885, 1885, 1885, 378, 639, 639, 639, 639, 639, 639, 639, 639, 378, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 378, 1887, 1887, 1887, 1887, 1887, 1888, 1889, 1889, 378, 1889, 1889, 1889, 1889, 1889, 1889, 1889, 1889, 1890, 2618, 1891, 1891, 1891, 1891, 1891, 1891, 1891, 1891, 1890, 2618, 1892, 1892, 1892, 1892, 1892, 1893, 1733, 1733, 1890, 2618, 1733, 1733, 1733, 1733, 1733, 1733, 1733, 1733, 1894, 2618, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1894, 2618, 1896, 1896, 1896, 1896, 1896, 1897, 1737, 1737, 1894, 2618, 1737, 1737, 1737, 1737, 1737, 1737, 1737, 1737, 378, 1898, 1898, 1898, 1898, 1898, 1898, 1898, 1898, 1564, 1928, 1939, 141, 141, 141, 141, 1899, 1899, 1899, 1899, 1899, 1899, 1900, 1900, 1900, 1900, 1900, 1900, 1900, 1900, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1956, 1928, 1939, 141, 141, 141, 141, 1899, 1899, 1899, 1899, 1899, 1899, 1901, 378, 1902, 1902, 1902, 1902, 1902, 1902, 1902, 1902, 1903, 2618, 2618, 1951, 141, 2618, 1956, 1904, 1904, 1904, 1904, 1904, 1904, 1906, 1906, 1906, 1906, 1906, 1907, 1908, 1908, 2618, 448, 472, 141, 1925, 2618, 1772, 150, 2618, 1913, 141, 1951, 141, 677, 2618, 1904, 1904, 1904, 1904, 1904, 1904, 136, 136, 130, 1911, 141, 2618, 136, 1926, 136, 150, 136, 141, 1925, 1935, 141, 141, 1933, 1913, 141, 193, 141, 136, 136, 136, 136, 130, 2618, 141, 1910, 2618, 2618, 141, 1911, 141, 928, 2618, 1926, 2618, 2618, 2618, 1930, 1937, 1935, 141, 141, 1933, 141, 141, 2618, 141, 2618, 2618, 136, 136, 136, 1938, 141, 1910, 136, 136, 141, 1936, 487, 928, 136, 141, 136, 150, 136, 1930, 1937, 1942, 150, 2618, 141, 141, 141, 193, 141, 136, 136, 136, 136, 130, 1938, 1943, 1941, 1947, 130, 1950, 1936, 141, 141, 1944, 141, 1948, 141, 2618, 1952, 1958, 1942, 1954, 1912, 141, 1945, 141, 141, 141, 1957, 1955, 136, 136, 136, 141, 141, 1941, 150, 1960, 1950, 141, 141, 141, 141, 1961, 141, 141, 1946, 1952, 1949, 2618, 1954, 1912, 130, 1959, 141, 141, 1968, 1957, 1955, 141, 1963, 1969, 141, 141, 1964, 141, 1960, 1962, 141, 1972, 141, 141, 1961, 141, 1967, 1946, 1974, 1949, 141, 1966, 141, 1970, 1959, 2618, 141, 1968, 1971, 141, 141, 1963, 1969, 141, 141, 1964, 141, 1976, 1962, 1977, 1972, 141, 141, 1973, 1978, 1967, 1979, 1974, 1975, 141, 1966, 141, 1970, 141, 141, 141, 1983, 1971, 141, 141, 1980, 1984, 141, 141, 1981, 141, 1976, 141, 1977, 1985, 1982, 141, 1973, 1978, 141, 1979, 141, 1975, 141, 141, 1987, 141, 141, 141, 141, 1983, 1988, 141, 141, 1980, 1984, 141, 1989, 1981, 141, 141, 141, 2618, 1985, 1982, 375, 375, 375, 141, 2618, 141, 375, 141, 141, 1987, 141, 2618, 2618, 141, 2618, 1988, 141, 1323, 1323, 2618, 141, 1989, 1323, 2618, 141, 640, 378, 1994, 1994, 1994, 1994, 1994, 1994, 1994, 1994, 1995, 2000, 2000, 2000, 2000, 2000, 2000, 1996, 1996, 1996, 1996, 1996, 1996, 1997, 1997, 1997, 1997, 1997, 1997, 1997, 1997, 1998, 1998, 1998, 1998, 1998, 1999, 2000, 2000, 2011, 2011, 2011, 2011, 2011, 2011, 2618, 1996, 1996, 1996, 1996, 1996, 1996, 2618, 2618, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 2001, 378, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 1702, 2021, 2021, 2021, 2021, 2021, 2021, 2003, 2003, 2003, 2003, 2003, 2003, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2031, 2031, 2031, 2031, 2031, 2031, 2618, 2003, 2003, 2003, 2003, 2003, 2003, 1135, 378, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2006, 2054, 2057, 2058, 2059, 2060, 2061, 2007, 2007, 2007, 2007, 2007, 2007, 2009, 2009, 2009, 2009, 2009, 2010, 2011, 2011, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2618, 2054, 2057, 2058, 2059, 2060, 2061, 2007, 2007, 2007, 2007, 2007, 2007, 378, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 1713, 2062, 2063, 2064, 2065, 2066, 2067, 2013, 2013, 2013, 2013, 2013, 2013, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2019, 2019, 2019, 2019, 2019, 2020, 2021, 2021, 2068, 2062, 2063, 2064, 2065, 2066, 2067, 2013, 2013, 2013, 2013, 2013, 2013, 1562, 378, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2015, 2016, 2069, 2070, 2071, 2072, 2073, 2068, 2017, 2017, 2017, 2017, 2017, 2017, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2618, 2069, 2070, 2071, 2072, 2073, 2618, 2017, 2017, 2017, 2017, 2017, 2017, 378, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 1723, 2074, 2075, 2076, 2085, 2086, 2087, 2023, 2023, 2023, 2023, 2023, 2023, 2029, 2029, 2029, 2029, 2029, 2030, 2031, 2031, 378, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2074, 2075, 2076, 2085, 2086, 2087, 2023, 2023, 2023, 2023, 2023, 2023, 1901, 378, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2026, 2618, 2088, 2091, 2092, 2093, 2094, 2027, 2027, 2027, 2027, 2027, 2027, 378, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 378, 2032, 2032, 2032, 2032, 2032, 2032, 1348, 1348, 2088, 2091, 2092, 2093, 2094, 2027, 2027, 2027, 2027, 2027, 2027, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2033, 2034, 2035, 2036, 2036, 2036, 2036, 2036, 1890, 2618, 1733, 1733, 1733, 1733, 1733, 1733, 1733, 1733, 1890, 2618, 1733, 1733, 1733, 1733, 1733, 1733, 1733, 1733, 1890, 2618, 1733, 1733, 1733, 1733, 1733, 1733, 2037, 2038, 2039, 2040, 2040, 2040, 2040, 2040, 1894, 2618, 1737, 1737, 1737, 1737, 1737, 1737, 1737, 1737, 1894, 2618, 1737, 1737, 1737, 1737, 1737, 1737, 1737, 1737, 1894, 2618, 1737, 1737, 1737, 1737, 1737, 1737, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1564, 378, 639, 639, 639, 639, 639, 639, 639, 639, 1564, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1564, 2041, 2042, 2043, 2044, 2044, 2044, 2044, 2044, 378, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 1903, 2095, 2096, 2097, 2098, 2099, 2100, 2046, 2046, 2046, 2046, 2046, 2046, 2047, 2048, 2049, 2050, 2050, 2050, 2050, 2050, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2618, 2095, 2096, 2097, 2098, 2099, 2100, 2046, 2046, 2046, 2046, 2046, 2046, 1901, 150, 2053, 2053, 2053, 2053, 2053, 2053, 2053, 2053, 136, 136, 2618, 1943, 2077, 2080, 136, 130, 136, 150, 136, 1944, 2078, 1944, 2101, 150, 2618, 2102, 2618, 193, 2082, 136, 136, 136, 136, 130, 1947, 2056, 1948, 2103, 2055, 130, 1324, 1324, 1948, 2104, 2105, 1324, 2618, 2618, 2618, 2618, 2081, 2101, 1946, 2079, 2102, 150, 2106, 2618, 2618, 2084, 136, 136, 136, 2618, 2056, 2083, 2103, 2055, 136, 136, 150, 130, 2104, 2105, 136, 1949, 136, 150, 136, 2081, 2107, 1946, 2079, 2090, 2108, 2106, 130, 193, 2084, 136, 136, 136, 136, 130, 2083, 2109, 2122, 2123, 2124, 2125, 2125, 2125, 2125, 2125, 1949, 2089, 1525, 1525, 2618, 2107, 2618, 1525, 2090, 2108, 2178, 2178, 2178, 2178, 2178, 2178, 136, 136, 136, 2618, 2109, 2127, 2127, 2127, 2127, 2127, 2127, 2127, 2127, 2618, 2089, 378, 2115, 2116, 2117, 2118, 2118, 2118, 2118, 2118, 2618, 2618, 2618, 2618, 2179, 141, 2183, 2119, 2119, 2119, 2119, 2119, 2119, 640, 2618, 2128, 2128, 2128, 2128, 2128, 2128, 2128, 2128, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1702, 2179, 141, 2183, 2119, 2119, 2119, 2119, 2119, 2119, 378, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 1995, 2618, 2618, 2618, 2184, 2185, 2186, 2121, 2121, 2121, 2121, 2121, 2121, 378, 639, 639, 639, 639, 639, 639, 639, 639, 1702, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1702, 2184, 2185, 2186, 2121, 2121, 2121, 2121, 2121, 2121, 378, 2129, 2129, 2129, 2129, 2129, 2129, 2129, 2129, 2006, 2187, 2188, 2189, 2190, 2191, 141, 2130, 2130, 2130, 2130, 2130, 2130, 2131, 2132, 2133, 2134, 2134, 2134, 2134, 2134, 2136, 2136, 2136, 2136, 2136, 2136, 2136, 2136, 2618, 2187, 2188, 2189, 2190, 2191, 141, 2130, 2130, 2130, 2130, 2130, 2130, 1135, 2618, 2137, 2137, 2137, 2137, 2137, 2137, 2137, 2137, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1713, 378, 639, 639, 639, 639, 639, 639, 639, 639, 1713, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1713, 378, 2138, 2138, 2138, 2138, 2138, 2138, 2138, 2138, 2016, 2193, 2196, 141, 2201, 2202, 2205, 2139, 2139, 2139, 2139, 2139, 2139, 2140, 2141, 2142, 2143, 2143, 2143, 2143, 2143, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2145, 2618, 2193, 2196, 141, 2201, 2202, 2205, 2139, 2139, 2139, 2139, 2139, 2139, 1562, 2618, 2146, 2146, 2146, 2146, 2146, 2146, 2146, 2146, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1723, 378, 639, 639, 639, 639, 639, 639, 639, 639, 1723, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1723, 378, 2147, 2147, 2147, 2147, 2147, 2147, 2147, 2147, 2026, 2203, 141, 141, 2208, 2210, 2211, 2148, 2148, 2148, 2148, 2148, 2148, 2149, 2150, 2151, 2152, 2152, 2152, 2152, 2152, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2618, 2203, 141, 141, 2208, 2210, 2211, 2148, 2148, 2148, 2148, 2148, 2148, 1901, 2618, 2155, 2155, 2155, 2155, 2155, 2155, 2155, 2155, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 639, 639, 639, 639, 639, 639, 639, 639, 378, 2156, 2156, 2156, 2156, 2156, 2156, 2156, 2156, 378, 2157, 2157, 2157, 2157, 2157, 2158, 2159, 2159, 378, 2159, 2159, 2159, 2159, 2159, 2159, 2159, 2159, 2160, 2618, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2160, 2618, 2162, 2162, 2162, 2162, 2162, 2163, 2037, 2037, 2160, 2618, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2164, 2618, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2164, 2618, 2166, 2166, 2166, 2166, 2166, 2167, 2041, 2041, 2164, 2618, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 378, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 1903, 2206, 2212, 2215, 141, 141, 141, 2169, 2169, 2169, 2169, 2169, 2169, 2170, 2170, 2170, 2170, 2170, 2170, 2170, 2170, 2175, 2175, 2175, 2175, 2175, 2175, 2175, 2175, 2618, 2206, 2212, 2215, 141, 141, 141, 2169, 2169, 2169, 2169, 2169, 2169, 2171, 378, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2173, 2217, 2618, 2219, 2618, 2220, 2194, 2174, 2174, 2174, 2174, 2174, 2174, 2176, 2176, 2176, 2176, 2176, 2177, 2178, 2178, 2199, 2618, 2618, 141, 2192, 2618, 2197, 2618, 2078, 2217, 150, 2219, 141, 2220, 2194, 2174, 2174, 2174, 2174, 2174, 2174, 136, 136, 2195, 141, 141, 130, 136, 2077, 136, 150, 136, 141, 2192, 141, 2197, 2078, 2200, 2618, 2618, 193, 141, 136, 136, 136, 136, 130, 2181, 2198, 2222, 2204, 141, 2195, 141, 141, 141, 141, 2209, 141, 2214, 2300, 2218, 141, 141, 2180, 2618, 2200, 150, 141, 2079, 2618, 2618, 2618, 136, 136, 136, 2181, 2198, 2222, 2204, 141, 2618, 2304, 130, 141, 141, 2209, 141, 2214, 2300, 2218, 141, 2207, 2180, 136, 136, 2213, 141, 2079, 2216, 136, 141, 136, 150, 136, 141, 2618, 2221, 2305, 2221, 2221, 2304, 1075, 193, 2618, 136, 136, 136, 136, 130, 2618, 2207, 150, 2618, 2110, 2213, 2110, 2110, 2216, 2111, 141, 1526, 1526, 2111, 141, 1076, 1526, 2305, 130, 2182, 2236, 2236, 2236, 2236, 2236, 2236, 136, 136, 136, 2233, 2233, 2233, 2233, 2233, 2233, 2233, 2233, 2302, 141, 2234, 2234, 2234, 2234, 2234, 2235, 2236, 2236, 2618, 2182, 2237, 2237, 2237, 2237, 2237, 2237, 2237, 2237, 2240, 2240, 2240, 2240, 2240, 2240, 2240, 2240, 2618, 2302, 141, 2224, 2225, 2226, 2227, 2227, 2227, 2227, 2227, 2228, 2247, 2247, 2247, 2247, 2247, 2247, 2229, 2229, 2229, 2229, 2229, 2229, 2244, 2244, 2244, 2244, 2244, 2244, 2244, 2244, 2245, 2245, 2245, 2245, 2245, 2246, 2247, 2247, 2257, 2257, 2257, 2257, 2257, 2257, 2618, 2229, 2229, 2229, 2229, 2229, 2229, 640, 378, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2231, 2267, 2267, 2267, 2267, 2267, 2267, 2232, 2232, 2232, 2232, 2232, 2232, 2250, 2250, 2250, 2250, 2250, 2250, 2250, 2250, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2277, 2277, 2277, 2277, 2277, 2277, 2618, 2232, 2232, 2232, 2232, 2232, 2232, 378, 2238, 2238, 2238, 2238, 2238, 2238, 2238, 2238, 1995, 2306, 2307, 2308, 2309, 141, 2310, 2239, 2239, 2239, 2239, 2239, 2239, 2255, 2255, 2255, 2255, 2255, 2256, 2257, 2257, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 141, 2306, 2307, 2308, 2309, 141, 2310, 2239, 2239, 2239, 2239, 2239, 2239, 1135, 378, 2241, 2241, 2241, 2241, 2241, 2241, 2241, 2241, 2242, 141, 2316, 141, 2318, 2315, 141, 2243, 2243, 2243, 2243, 2243, 2243, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2265, 2265, 2265, 2265, 2265, 2266, 2267, 2267, 2618, 141, 2316, 141, 2318, 2315, 2618, 2243, 2243, 2243, 2243, 2243, 2243, 378, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2006, 141, 2323, 141, 2326, 141, 2327, 2249, 2249, 2249, 2249, 2249, 2249, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 141, 141, 2323, 141, 2326, 141, 2327, 2249, 2249, 2249, 2249, 2249, 2249, 1562, 378, 2251, 2251, 2251, 2251, 2251, 2251, 2251, 2251, 2252, 2324, 2387, 2391, 2392, 141, 141, 2253, 2253, 2253, 2253, 2253, 2253, 2275, 2275, 2275, 2275, 2275, 2276, 2277, 2277, 378, 2278, 2278, 2278, 2278, 2278, 2278, 2278, 2278, 2324, 2387, 2391, 2392, 141, 2618, 2253, 2253, 2253, 2253, 2253, 2253, 378, 2258, 2258, 2258, 2258, 2258, 2258, 2258, 2258, 2016, 2336, 2336, 2336, 2336, 2336, 2336, 2259, 2259, 2259, 2259, 2259, 2259, 378, 2278, 2278, 2278, 2278, 2278, 2278, 2278, 2278, 378, 2278, 2278, 2278, 2278, 2278, 2278, 1348, 1348, 2618, 2618, 2618, 2618, 2618, 2259, 2259, 2259, 2259, 2259, 2259, 1901, 378, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2262, 2386, 2386, 2386, 2386, 2386, 2386, 2263, 2263, 2263, 2263, 2263, 2263, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2279, 2280, 2281, 2282, 2282, 2282, 2282, 2282, 1698, 1698, 2618, 2618, 2618, 1698, 2263, 2263, 2263, 2263, 2263, 2263, 378, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2026, 2618, 2618, 2618, 2393, 2399, 2400, 2269, 2269, 2269, 2269, 2269, 2269, 2160, 2618, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2160, 2317, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2393, 2399, 2400, 2269, 2269, 2269, 2269, 2269, 2269, 2171, 378, 2271, 2271, 2271, 2271, 2271, 2271, 2271, 2271, 2272, 2221, 2404, 2221, 2221, 141, 1075, 2273, 2273, 2273, 2273, 2273, 2273, 2160, 2462, 2037, 2037, 2037, 2037, 2037, 2037, 2283, 2284, 2285, 2286, 2286, 2286, 2286, 2286, 1287, 2618, 2404, 2618, 2618, 141, 2618, 2273, 2273, 2273, 2273, 2273, 2273, 2164, 2462, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2164, 2618, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2164, 2618, 2041, 2041, 2041, 2041, 2041, 2041, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1903, 378, 639, 639, 639, 639, 639, 639, 639, 639, 1903, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1903, 2287, 2288, 2289, 2290, 2290, 2290, 2290, 2290, 378, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2173, 2221, 2466, 2221, 2221, 2467, 1075, 2292, 2292, 2292, 2292, 2292, 2292, 2293, 2294, 2295, 2296, 2296, 2296, 2296, 2296, 2298, 2298, 2298, 2298, 2298, 2298, 2298, 2298, 1287, 2618, 2466, 2618, 2618, 2467, 2618, 2292, 2292, 2292, 2292, 2292, 2292, 2171, 141, 2299, 2299, 2299, 2299, 2299, 2299, 2299, 2299, 136, 136, 141, 2618, 141, 2618, 136, 2311, 136, 150, 136, 141, 141, 150, 141, 141, 2618, 2312, 141, 193, 141, 136, 136, 136, 136, 130, 141, 2314, 2319, 130, 2321, 141, 2320, 141, 2322, 2468, 2311, 141, 2618, 2618, 141, 141, 2325, 141, 141, 2301, 2312, 141, 2396, 2618, 141, 2471, 136, 136, 136, 141, 2314, 2319, 141, 2321, 141, 2320, 150, 2322, 2468, 2328, 141, 2328, 2328, 2618, 1280, 2325, 2618, 2472, 2301, 136, 136, 2396, 130, 141, 2471, 136, 2618, 136, 150, 136, 2618, 141, 2618, 141, 2618, 2618, 2618, 1281, 193, 141, 136, 136, 136, 136, 130, 141, 2472, 2402, 2330, 2303, 2333, 2333, 2333, 2333, 2333, 2333, 2333, 2333, 2332, 2334, 2334, 2334, 2334, 2334, 2335, 2336, 2336, 2618, 141, 2618, 2618, 136, 136, 136, 141, 2618, 2402, 2618, 2303, 378, 2337, 2337, 2337, 2337, 2337, 2337, 2337, 2337, 2618, 2618, 2469, 2470, 141, 141, 141, 2338, 2338, 2338, 2338, 2338, 2338, 2342, 2342, 2342, 2342, 2342, 2342, 2342, 2342, 640, 2618, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2469, 2470, 141, 141, 141, 2338, 2338, 2338, 2338, 2338, 2338, 378, 2339, 2339, 2339, 2339, 2339, 2339, 2339, 2339, 2231, 2618, 2618, 2618, 2473, 141, 2518, 2340, 2340, 2340, 2340, 2340, 2340, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1995, 378, 639, 639, 639, 639, 639, 639, 639, 639, 1995, 2473, 141, 2518, 2340, 2340, 2340, 2340, 2340, 2340, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1995, 378, 2344, 2344, 2344, 2344, 2344, 2344, 2344, 2344, 2242, 2618, 2475, 2519, 2522, 2523, 141, 2345, 2345, 2345, 2345, 2345, 2345, 2347, 2347, 2347, 2347, 2347, 2347, 2347, 2347, 1135, 2618, 2348, 2348, 2348, 2348, 2348, 2348, 2348, 2348, 2475, 2519, 2522, 2523, 141, 2345, 2345, 2345, 2345, 2345, 2345, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2006, 378, 639, 639, 639, 639, 639, 639, 639, 639, 2006, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2006, 378, 2349, 2349, 2349, 2349, 2349, 2349, 2349, 2349, 2252, 2618, 141, 2526, 2527, 2520, 2571, 2350, 2350, 2350, 2350, 2350, 2350, 2352, 2352, 2352, 2352, 2352, 2352, 2352, 2352, 1562, 2618, 2353, 2353, 2353, 2353, 2353, 2353, 2353, 2353, 141, 2526, 2527, 2520, 2571, 2350, 2350, 2350, 2350, 2350, 2350, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2016, 378, 639, 639, 639, 639, 639, 639, 639, 639, 2016, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2016, 378, 2354, 2354, 2354, 2354, 2354, 2354, 2354, 2354, 2262, 2618, 2524, 2568, 141, 141, 141, 2355, 2355, 2355, 2355, 2355, 2355, 2357, 2357, 2357, 2357, 2357, 2357, 2357, 2357, 1901, 2618, 2358, 2358, 2358, 2358, 2358, 2358, 2358, 2358, 2524, 2568, 141, 141, 141, 2355, 2355, 2355, 2355, 2355, 2355, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2026, 378, 639, 639, 639, 639, 639, 639, 639, 639, 2026, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2026, 378, 2359, 2359, 2359, 2359, 2359, 2359, 2359, 2359, 2272, 2618, 2525, 141, 141, 141, 141, 2360, 2360, 2360, 2360, 2360, 2360, 2362, 2362, 2362, 2362, 2362, 2362, 2362, 2362, 2171, 2618, 2363, 2363, 2363, 2363, 2363, 2363, 2363, 2363, 2525, 141, 141, 141, 141, 2360, 2360, 2360, 2360, 2360, 2360, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 639, 639, 639, 639, 639, 639, 639, 639, 378, 2364, 2364, 2364, 2364, 2364, 2364, 2364, 2364, 378, 2365, 2365, 2365, 2365, 2365, 2366, 2367, 2367, 378, 2367, 2367, 2367, 2367, 2367, 2367, 2367, 2367, 2368, 2618, 2369, 2369, 2369, 2369, 2369, 2369, 2369, 2369, 2368, 2618, 2370, 2370, 2370, 2370, 2370, 2371, 2283, 2283, 2368, 2618, 2283, 2283, 2283, 2283, 2283, 2283, 2283, 2283, 2372, 2618, 2373, 2373, 2373, 2373, 2373, 2373, 2373, 2373, 2372, 2618, 2374, 2374, 2374, 2374, 2374, 2375, 2287, 2287, 2372, 2618, 2287, 2287, 2287, 2287, 2287, 2287, 2287, 2287, 378, 2376, 2376, 2376, 2376, 2376, 2376, 2376, 2376, 2173, 2328, 141, 2328, 2328, 2590, 1280, 2377, 2377, 2377, 2377, 2377, 2377, 2378, 2378, 2378, 2378, 2378, 2378, 2378, 2378, 2383, 2383, 2383, 2383, 2383, 2383, 2383, 2383, 1490, 2328, 141, 2328, 2328, 2590, 1280, 2377, 2377, 2377, 2377, 2377, 2377, 2379, 378, 2380, 2380, 2380, 2380, 2380, 2380, 2380, 2380, 2381, 2567, 2601, 2610, 2611, 141, 1490, 2382, 2382, 2382, 2382, 2382, 2382, 2384, 2384, 2384, 2384, 2384, 2385, 2386, 2386, 2408, 2409, 2410, 2411, 2411, 2411, 2411, 2411, 2618, 2567, 2601, 2610, 2611, 141, 2618, 2382, 2382, 2382, 2382, 2382, 2382, 136, 136, 2397, 141, 141, 2618, 136, 2465, 136, 150, 136, 2618, 141, 141, 141, 141, 141, 2398, 2401, 193, 141, 136, 136, 136, 136, 130, 141, 2405, 141, 2407, 141, 2397, 141, 141, 2388, 2618, 2465, 2528, 2618, 141, 141, 141, 141, 141, 141, 141, 2398, 2401, 2618, 141, 2615, 2521, 136, 136, 136, 141, 2405, 141, 2407, 141, 2618, 141, 2618, 2388, 136, 136, 2528, 141, 141, 141, 136, 141, 136, 150, 136, 2403, 2618, 141, 2566, 2615, 2521, 2406, 141, 193, 141, 136, 136, 136, 136, 130, 141, 2569, 2617, 141, 2618, 2389, 141, 1699, 1699, 2618, 141, 2618, 1699, 2618, 2403, 2390, 141, 2566, 2618, 2618, 2406, 141, 2618, 141, 1851, 1851, 136, 136, 136, 1851, 2569, 2617, 141, 2330, 2389, 2415, 2415, 2415, 2415, 2415, 2415, 2415, 2415, 2332, 2390, 378, 2416, 2416, 2416, 2416, 2416, 2416, 2416, 2416, 2618, 2474, 2618, 2474, 2474, 2618, 1659, 2417, 2417, 2417, 2417, 2417, 2417, 2418, 2418, 2418, 2418, 2418, 2418, 2418, 2418, 2421, 2421, 2421, 2421, 2421, 2421, 2421, 2421, 1817, 1852, 1852, 2618, 2618, 2618, 1852, 2417, 2417, 2417, 2417, 2417, 2417, 378, 2419, 2419, 2419, 2419, 2419, 2419, 2419, 2419, 2231, 2474, 2618, 2474, 2474, 2618, 1659, 2420, 2420, 2420, 2420, 2420, 2420, 2426, 2426, 2426, 2426, 2426, 2426, 2426, 2426, 2431, 2431, 2431, 2431, 2431, 2431, 2431, 2431, 1817, 1991, 1991, 2618, 2618, 2618, 1991, 2420, 2420, 2420, 2420, 2420, 2420, 378, 2422, 2422, 2422, 2422, 2422, 2422, 2422, 2422, 141, 2618, 2618, 2618, 2618, 2618, 2614, 2423, 2423, 2423, 2423, 2423, 2423, 2436, 2436, 2436, 2436, 2436, 2436, 2436, 2436, 2441, 2441, 2441, 2441, 2441, 2441, 2441, 2441, 141, 2618, 2618, 2618, 2618, 2618, 2614, 2423, 2423, 2423, 2423, 2423, 2423, 378, 2424, 2424, 2424, 2424, 2424, 2424, 2424, 2424, 2242, 1992, 1992, 2618, 2618, 2618, 1992, 2425, 2425, 2425, 2425, 2425, 2425, 378, 2444, 2444, 2444, 2444, 2444, 2444, 2444, 2444, 378, 2444, 2444, 2444, 2444, 2444, 2444, 2444, 2444, 2618, 2618, 2618, 2618, 2618, 2425, 2425, 2425, 2425, 2425, 2425, 378, 2427, 2427, 2427, 2427, 2427, 2427, 2427, 2427, 2112, 2112, 2618, 2618, 2618, 2112, 2618, 2428, 2428, 2428, 2428, 2428, 2428, 378, 2444, 2444, 2444, 2444, 2444, 2444, 1348, 1348, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2618, 2618, 2618, 2618, 2618, 2428, 2428, 2428, 2428, 2428, 2428, 378, 2429, 2429, 2429, 2429, 2429, 2429, 2429, 2429, 2252, 2113, 2113, 2618, 2618, 2618, 2113, 2430, 2430, 2430, 2430, 2430, 2430, 2445, 2446, 2447, 2448, 2448, 2448, 2448, 2448, 2368, 2618, 2283, 2283, 2283, 2283, 2283, 2283, 2283, 2283, 2618, 2618, 2618, 2618, 2618, 2430, 2430, 2430, 2430, 2430, 2430, 378, 2432, 2432, 2432, 2432, 2432, 2432, 2432, 2432, 2223, 2223, 2618, 2618, 2618, 2223, 2618, 2433, 2433, 2433, 2433, 2433, 2433, 2368, 2618, 2283, 2283, 2283, 2283, 2283, 2283, 2283, 2283, 2368, 2618, 2283, 2283, 2283, 2283, 2283, 2283, 2618, 2618, 2618, 2618, 2618, 2433, 2433, 2433, 2433, 2433, 2433, 378, 2434, 2434, 2434, 2434, 2434, 2434, 2434, 2434, 2262, 2329, 2329, 2618, 2618, 2618, 2329, 2435, 2435, 2435, 2435, 2435, 2435, 2449, 2450, 2451, 2452, 2452, 2452, 2452, 2452, 2372, 2618, 2287, 2287, 2287, 2287, 2287, 2287, 2287, 2287, 2618, 2618, 2618, 2618, 2618, 2435, 2435, 2435, 2435, 2435, 2435, 378, 2437, 2437, 2437, 2437, 2437, 2437, 2437, 2437, 2412, 2412, 2618, 2618, 2618, 2412, 2618, 2438, 2438, 2438, 2438, 2438, 2438, 2372, 2618, 2287, 2287, 2287, 2287, 2287, 2287, 2287, 2287, 2372, 2618, 2287, 2287, 2287, 2287, 2287, 2287, 2618, 2618, 2618, 2618, 2618, 2438, 2438, 2438, 2438, 2438, 2438, 378, 2439, 2439, 2439, 2439, 2439, 2439, 2439, 2439, 2272, 2413, 2413, 2618, 2618, 2618, 2413, 2440, 2440, 2440, 2440, 2440, 2440, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2173, 378, 639, 639, 639, 639, 639, 639, 639, 639, 2173, 2618, 2618, 2618, 2440, 2440, 2440, 2440, 2440, 2440, 378, 2442, 2442, 2442, 2442, 2442, 2442, 2442, 2442, 2480, 2480, 2618, 2618, 2618, 2480, 2618, 2443, 2443, 2443, 2443, 2443, 2443, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2173, 2453, 2454, 2455, 2456, 2456, 2456, 2456, 2456, 2618, 2618, 2618, 2618, 2618, 2443, 2443, 2443, 2443, 2443, 2443, 378, 2457, 2457, 2457, 2457, 2457, 2457, 2457, 2457, 2381, 2618, 2618, 2618, 2618, 2618, 2618, 2458, 2458, 2458, 2458, 2458, 2458, 2460, 2460, 2460, 2460, 2460, 2460, 2460, 2460, 2379, 2618, 2461, 2461, 2461, 2461, 2461, 2461, 2461, 2461, 2618, 2618, 2618, 2618, 2618, 2458, 2458, 2458, 2458, 2458, 2458, 136, 136, 2618, 2618, 2618, 2618, 136, 2618, 136, 150, 136, 2485, 2485, 2485, 2485, 2485, 2485, 2485, 2485, 193, 141, 136, 136, 136, 136, 130, 2618, 2618, 2589, 2570, 2618, 2463, 2618, 2618, 2618, 2474, 141, 2474, 2474, 2476, 1659, 2477, 2477, 2477, 2477, 2477, 2477, 2477, 2477, 141, 2618, 2618, 136, 136, 136, 2618, 2618, 2589, 2570, 141, 2463, 136, 136, 1660, 2616, 141, 2618, 136, 2618, 136, 150, 136, 2618, 2618, 2331, 141, 2331, 2331, 2618, 2618, 193, 2331, 136, 136, 136, 136, 130, 2618, 141, 2618, 2618, 2618, 2618, 2616, 2476, 2464, 2478, 2478, 2478, 2478, 2478, 2479, 2408, 2408, 141, 2488, 2488, 2488, 2488, 2488, 2488, 2488, 2488, 136, 136, 136, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2476, 2464, 2408, 2408, 2408, 2408, 2408, 2408, 2408, 2408, 378, 2481, 2481, 2481, 2481, 2481, 2481, 2481, 2481, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2482, 2482, 2482, 2482, 2482, 2482, 378, 639, 639, 639, 639, 639, 639, 639, 639, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2231, 2618, 2618, 2618, 2618, 2482, 2482, 2482, 2482, 2482, 2482, 378, 2483, 2483, 2483, 2483, 2483, 2483, 2483, 2483, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2484, 2484, 2484, 2484, 2484, 2484, 378, 639, 639, 639, 639, 639, 639, 639, 639, 2231, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2231, 2618, 2618, 2618, 2484, 2484, 2484, 2484, 2484, 2484, 378, 2486, 2486, 2486, 2486, 2486, 2486, 2486, 2486, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2487, 2487, 2487, 2487, 2487, 2487, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2242, 378, 639, 639, 639, 639, 639, 639, 639, 639, 2242, 2618, 2618, 2618, 2487, 2487, 2487, 2487, 2487, 2487, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2242, 378, 2489, 2489, 2489, 2489, 2489, 2489, 2489, 2489, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2490, 2490, 2490, 2490, 2490, 2490, 2491, 2491, 2491, 2491, 2491, 2491, 2491, 2491, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2252, 2618, 2618, 2618, 2618, 2618, 2490, 2490, 2490, 2490, 2490, 2490, 378, 639, 639, 639, 639, 639, 639, 639, 639, 2252, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2252, 378, 2492, 2492, 2492, 2492, 2492, 2492, 2492, 2492, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2493, 2493, 2493, 2493, 2493, 2493, 2494, 2494, 2494, 2494, 2494, 2494, 2494, 2494, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2262, 2618, 2618, 2618, 2618, 2618, 2493, 2493, 2493, 2493, 2493, 2493, 378, 639, 639, 639, 639, 639, 639, 639, 639, 2262, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2262, 378, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2496, 2496, 2496, 2496, 2496, 2496, 2497, 2497, 2497, 2497, 2497, 2497, 2497, 2497, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2272, 2618, 2618, 2618, 2618, 2618, 2496, 2496, 2496, 2496, 2496, 2496, 378, 639, 639, 639, 639, 639, 639, 639, 639, 2272, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2272, 378, 2498, 2498, 2498, 2498, 2498, 2498, 2498, 2498, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2499, 2499, 2499, 2499, 2499, 2499, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 2500, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2618, 2618, 2618, 2618, 2618, 2618, 2499, 2499, 2499, 2499, 2499, 2499, 378, 639, 639, 639, 639, 639, 639, 639, 639, 378, 2501, 2501, 2501, 2501, 2501, 2501, 2501, 2501, 378, 2502, 2502, 2502, 2502, 2502, 2503, 2504, 2504, 378, 2504, 2504, 2504, 2504, 2504, 2504, 2504, 2504, 2505, 2618, 2506, 2506, 2506, 2506, 2506, 2506, 2506, 2506, 2505, 2618, 2507, 2507, 2507, 2507, 2507, 2508, 2449, 2449, 2505, 2618, 2449, 2449, 2449, 2449, 2449, 2449, 2449, 2449, 2509, 2618, 2510, 2510, 2510, 2510, 2510, 2510, 2510, 2510, 2509, 2618, 2511, 2511, 2511, 2511, 2511, 2512, 2453, 2453, 2509, 2618, 2453, 2453, 2453, 2453, 2453, 2453, 2453, 2453, 378, 2513, 2513, 2513, 2513, 2513, 2513, 2513, 2513, 2381, 2618, 2618, 2618, 2618, 2618, 2618, 2514, 2514, 2514, 2514, 2514, 2514, 2515, 2515, 2515, 2515, 2515, 2515, 2515, 2515, 2529, 2530, 2531, 2532, 2532, 2532, 2532, 2532, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2514, 2514, 2514, 2514, 2514, 2514, 378, 2516, 2516, 2516, 2516, 2516, 2516, 2516, 2516, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2517, 2517, 2517, 2517, 2517, 2517, 2476, 2618, 2408, 2408, 2408, 2408, 2408, 2408, 2408, 2408, 2476, 2618, 2408, 2408, 2408, 2408, 2408, 2408, 2408, 2408, 2618, 2618, 2618, 2517, 2517, 2517, 2517, 2517, 2517, 2476, 2618, 2408, 2408, 2408, 2408, 2408, 2408, 378, 2533, 2533, 2533, 2533, 2533, 2533, 2533, 2533, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2534, 2534, 2534, 2534, 2534, 2534, 2535, 2535, 2535, 2535, 2535, 2535, 2535, 2535, 2538, 2538, 2538, 2538, 2538, 2538, 2538, 2538, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2534, 2534, 2534, 2534, 2534, 2534, 378, 2536, 2536, 2536, 2536, 2536, 2536, 2536, 2536, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2537, 2537, 2537, 2537, 2537, 2537, 2541, 2541, 2541, 2541, 2541, 2541, 2541, 2541, 2544, 2544, 2544, 2544, 2544, 2544, 2544, 2544, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2537, 2537, 2537, 2537, 2537, 2537, 378, 2539, 2539, 2539, 2539, 2539, 2539, 2539, 2539, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2540, 2540, 2540, 2540, 2540, 2540, 2547, 2547, 2547, 2547, 2547, 2547, 2547, 2547, 2550, 2550, 2550, 2550, 2550, 2550, 2550, 2550, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2540, 2540, 2540, 2540, 2540, 2540, 378, 2542, 2542, 2542, 2542, 2542, 2542, 2542, 2542, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2543, 2543, 2543, 2543, 2543, 2543, 2553, 2553, 2553, 2553, 2553, 2553, 2553, 2553, 378, 2554, 2554, 2554, 2554, 2554, 2554, 2554, 2554, 2618, 2618, 2618, 2618, 2618, 2618, 2543, 2543, 2543, 2543, 2543, 2543, 378, 2545, 2545, 2545, 2545, 2545, 2545, 2545, 2545, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2546, 2546, 2546, 2546, 2546, 2546, 378, 2554, 2554, 2554, 2554, 2554, 2554, 2554, 2554, 378, 2554, 2554, 2554, 2554, 2554, 2554, 1348, 1348, 2618, 2618, 2618, 2618, 2618, 2546, 2546, 2546, 2546, 2546, 2546, 378, 2548, 2548, 2548, 2548, 2548, 2548, 2548, 2548, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2549, 2549, 2549, 2549, 2549, 2549, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2555, 2556, 2557, 2558, 2558, 2558, 2558, 2558, 2618, 2618, 2618, 2618, 2618, 2618, 2549, 2549, 2549, 2549, 2549, 2549, 378, 2551, 2551, 2551, 2551, 2551, 2551, 2551, 2551, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2552, 2552, 2552, 2552, 2552, 2552, 2505, 2618, 2449, 2449, 2449, 2449, 2449, 2449, 2449, 2449, 2505, 2618, 2449, 2449, 2449, 2449, 2449, 2449, 2449, 2449, 2618, 2618, 2618, 2552, 2552, 2552, 2552, 2552, 2552, 2505, 2618, 2449, 2449, 2449, 2449, 2449, 2449, 2559, 2560, 2561, 2562, 2562, 2562, 2562, 2562, 2509, 2618, 2453, 2453, 2453, 2453, 2453, 2453, 2453, 2453, 2509, 2618, 2453, 2453, 2453, 2453, 2453, 2453, 2453, 2453, 2509, 2618, 2453, 2453, 2453, 2453, 2453, 2453, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2381, 378, 639, 639, 639, 639, 639, 639, 639, 639, 2381, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2381, 378, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2564, 2564, 2564, 2564, 2564, 2564, 2565, 2565, 2565, 2565, 2565, 2565, 2565, 2565, 2572, 2618, 2573, 2573, 2573, 2573, 2573, 2573, 2573, 2573, 2618, 2618, 2618, 2618, 2618, 2564, 2564, 2564, 2564, 2564, 2564, 2572, 2618, 2574, 2574, 2574, 2574, 2574, 2575, 2529, 2529, 2572, 2618, 2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529, 378, 2576, 2576, 2576, 2576, 2576, 2576, 2576, 2576, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2414, 2414, 2414, 2414, 2414, 2414, 2577, 2577, 2577, 2577, 2577, 2577, 2577, 2577, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2618, 2618, 2618, 2618, 2618, 2618, 2414, 2414, 2414, 2414, 2414, 2414, 378, 639, 639, 639, 639, 639, 639, 639, 639, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 639, 639, 639, 639, 639, 639, 639, 639, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 639, 639, 639, 639, 639, 639, 639, 639, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 639, 639, 639, 639, 639, 639, 639, 639, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 639, 639, 639, 639, 639, 639, 639, 639, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 639, 639, 639, 639, 639, 639, 639, 639, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 639, 639, 639, 639, 639, 639, 639, 639, 378, 2578, 2578, 2578, 2578, 2578, 2578, 2578, 2578, 378, 2579, 2579, 2579, 2579, 2579, 2580, 2581, 2581, 378, 2581, 2581, 2581, 2581, 2581, 2581, 2581, 2581, 2582, 2618, 2583, 2583, 2583, 2583, 2583, 2583, 2583, 2583, 2582, 2618, 2584, 2584, 2584, 2584, 2584, 2585, 2559, 2559, 2582, 2618, 2559, 2559, 2559, 2559, 2559, 2559, 2559, 2559, 378, 2586, 2586, 2586, 2586, 2586, 2586, 2586, 2586, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2587, 2587, 2587, 2587, 2587, 2587, 2588, 2588, 2588, 2588, 2588, 2588, 2588, 2588, 2591, 2592, 2593, 2594, 2594, 2594, 2594, 2594, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2587, 2587, 2587, 2587, 2587, 2587, 2572, 2618, 2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529, 2572, 2618, 2529, 2529, 2529, 2529, 2529, 2529, 2529, 2529, 2572, 2618, 2529, 2529, 2529, 2529, 2529, 2529, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 2595, 2595, 2595, 2595, 2595, 2595, 2595, 2595, 378, 2595, 2595, 2595, 2595, 2595, 2595, 2595, 2595, 378, 2595, 2595, 2595, 2595, 2595, 2595, 1348, 1348, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 2596, 2597, 2598, 2599, 2599, 2599, 2599, 2599, 2582, 2618, 2559, 2559, 2559, 2559, 2559, 2559, 2559, 2559, 2582, 2618, 2559, 2559, 2559, 2559, 2559, 2559, 2559, 2559, 2582, 2618, 2559, 2559, 2559, 2559, 2559, 2559, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 639, 639, 639, 639, 639, 639, 639, 639, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 141, 378, 639, 639, 639, 639, 639, 639, 639, 639, 2618, 2600, 378, 2602, 2602, 2602, 2602, 2602, 2602, 2602, 2602, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 141, 378, 2603, 2603, 2603, 2603, 2603, 2604, 2605, 2605, 2618, 2600, 378, 2605, 2605, 2605, 2605, 2605, 2605, 2605, 2605, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 639, 639, 639, 639, 639, 639, 639, 639, 378, 2606, 2606, 2606, 2606, 2606, 2606, 2606, 2606, 378, 2607, 2607, 2607, 2607, 2607, 2608, 2609, 2609, 378, 2609, 2609, 2609, 2609, 2609, 2609, 2609, 2609, 378, 2612, 2612, 2612, 2612, 2612, 2612, 2612, 2612, 378, 2612, 2612, 2612, 2612, 2612, 2612, 2612, 2612, 378, 2612, 2612, 2612, 2612, 2612, 2612, 1348, 1348, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 378, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 378, 2613, 2613, 2613, 2613, 2613, 2613, 1348, 1348, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 378, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 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, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 128, 128, 2618, 2618, 2618, 128, 2618, 128, 128, 128, 2618, 128, 128, 128, 128, 128, 128, 128, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 134, 134, 2618, 2618, 2618, 134, 2618, 134, 134, 134, 2618, 134, 134, 134, 134, 134, 134, 134, 287, 2618, 2618, 287, 2618, 287, 2618, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 302, 302, 2618, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 303, 303, 2618, 2618, 2618, 303, 2618, 303, 303, 303, 2618, 303, 303, 2618, 303, 303, 303, 303, 304, 304, 2618, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 307, 307, 2618, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 308, 308, 2618, 2618, 2618, 308, 2618, 308, 308, 308, 2618, 308, 308, 2618, 308, 308, 308, 308, 309, 309, 2618, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 310, 310, 310, 310, 2618, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 2618, 310, 310, 310, 310, 310, 310, 314, 314, 314, 314, 2618, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 317, 317, 317, 317, 2618, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 2618, 317, 317, 317, 317, 317, 317, 319, 319, 319, 319, 2618, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 322, 322, 322, 322, 2618, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 2618, 322, 322, 322, 322, 322, 322, 324, 324, 324, 324, 2618, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 327, 327, 327, 327, 2618, 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, 2618, 327, 327, 327, 327, 327, 327, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 2618, 329, 2618, 329, 329, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 2618, 330, 330, 330, 330, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 2618, 331, 331, 331, 331, 332, 332, 2618, 2618, 2618, 332, 2618, 332, 332, 332, 2618, 332, 332, 2618, 332, 332, 332, 332, 333, 333, 2618, 2618, 2618, 333, 2618, 333, 333, 333, 2618, 333, 333, 2618, 333, 333, 333, 333, 334, 334, 2618, 2618, 2618, 334, 2618, 334, 334, 334, 2618, 334, 334, 2618, 334, 334, 334, 334, 337, 2618, 337, 337, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 337, 337, 2618, 2618, 337, 339, 2618, 2618, 2618, 339, 339, 339, 339, 339, 339, 339, 339, 339, 2618, 339, 339, 339, 339, 339, 339, 339, 339, 339, 2618, 2618, 339, 339, 343, 343, 2618, 343, 343, 343, 343, 343, 343, 343, 343, 343, 343, 2618, 343, 343, 343, 2618, 343, 343, 343, 343, 343, 343, 2618, 343, 343, 348, 2618, 2618, 2618, 2618, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 350, 350, 2618, 2618, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 352, 352, 2618, 2618, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 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, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 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, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 128, 128, 2618, 2618, 2618, 128, 2618, 128, 128, 128, 2618, 128, 128, 128, 128, 128, 128, 128, 361, 361, 2618, 2618, 2618, 361, 2618, 361, 361, 361, 2618, 361, 361, 361, 361, 361, 361, 361, 362, 362, 2618, 2618, 2618, 362, 2618, 362, 362, 362, 2618, 362, 362, 2618, 362, 362, 362, 362, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 134, 134, 2618, 2618, 2618, 134, 2618, 134, 134, 134, 2618, 134, 134, 134, 134, 134, 134, 134, 365, 365, 2618, 2618, 2618, 365, 2618, 365, 365, 365, 2618, 365, 365, 365, 365, 365, 365, 365, 136, 136, 2618, 2618, 2618, 136, 2618, 136, 136, 136, 2618, 136, 136, 136, 136, 136, 136, 136, 366, 366, 2618, 2618, 2618, 366, 2618, 366, 366, 366, 2618, 366, 366, 366, 366, 366, 366, 366, 287, 2618, 2618, 287, 2618, 287, 2618, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 287, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 303, 303, 2618, 2618, 2618, 303, 2618, 303, 303, 303, 2618, 303, 303, 2618, 303, 303, 303, 303, 304, 304, 2618, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 308, 308, 2618, 2618, 2618, 308, 2618, 308, 308, 308, 2618, 308, 308, 2618, 308, 308, 308, 308, 309, 309, 2618, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 310, 310, 310, 310, 2618, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 2618, 310, 310, 310, 310, 310, 310, 601, 601, 601, 601, 2618, 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, 2618, 601, 601, 2618, 601, 601, 601, 601, 601, 601, 314, 314, 314, 314, 2618, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 314, 602, 602, 602, 602, 2618, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 316, 316, 2618, 2618, 2618, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 317, 317, 317, 317, 2618, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 2618, 317, 317, 317, 317, 317, 317, 603, 603, 603, 603, 2618, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 2618, 603, 603, 603, 603, 603, 603, 319, 319, 319, 319, 2618, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, 604, 604, 604, 604, 2618, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 321, 321, 2618, 2618, 2618, 321, 321, 2618, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 2618, 321, 321, 321, 321, 321, 321, 321, 322, 322, 322, 322, 2618, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, 324, 324, 324, 324, 2618, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 324, 606, 606, 606, 606, 2618, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 326, 326, 2618, 2618, 2618, 326, 326, 2618, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 327, 327, 327, 327, 2618, 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, 2618, 327, 327, 327, 327, 327, 327, 608, 608, 608, 608, 2618, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 2618, 608, 608, 608, 608, 608, 608, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, 2618, 329, 2618, 329, 329, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 330, 2618, 330, 330, 330, 330, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 2618, 331, 331, 331, 331, 332, 332, 332, 2618, 2618, 2618, 332, 2618, 332, 332, 332, 2618, 332, 332, 2618, 332, 332, 332, 332, 333, 333, 2618, 2618, 2618, 333, 2618, 333, 333, 333, 2618, 333, 333, 2618, 333, 333, 333, 333, 334, 334, 2618, 334, 2618, 334, 2618, 334, 334, 334, 2618, 334, 334, 2618, 334, 334, 334, 334, 337, 2618, 337, 337, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 337, 337, 2618, 2618, 337, 339, 2618, 2618, 2618, 339, 339, 339, 339, 339, 339, 339, 339, 339, 2618, 339, 339, 339, 339, 339, 339, 339, 339, 339, 2618, 2618, 339, 339, 343, 343, 2618, 2618, 343, 343, 343, 343, 343, 343, 343, 343, 343, 2618, 343, 343, 343, 2618, 343, 343, 343, 343, 343, 343, 2618, 343, 343, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 348, 2618, 2618, 2618, 2618, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 350, 350, 2618, 2618, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 350, 351, 351, 2618, 2618, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, 352, 352, 2618, 2618, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 353, 353, 2618, 2618, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 353, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 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, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 359, 361, 361, 2618, 2618, 2618, 361, 2618, 361, 361, 361, 2618, 361, 361, 361, 361, 361, 361, 361, 362, 362, 2618, 2618, 2618, 362, 2618, 362, 362, 362, 2618, 362, 362, 2618, 362, 362, 362, 362, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 365, 365, 2618, 2618, 2618, 365, 2618, 365, 365, 365, 2618, 365, 365, 365, 365, 365, 365, 365, 366, 366, 2618, 2618, 2618, 366, 2618, 366, 366, 366, 2618, 366, 366, 366, 366, 366, 366, 366, 136, 136, 2618, 2618, 2618, 136, 2618, 136, 136, 136, 2618, 136, 136, 136, 136, 136, 136, 136, 304, 304, 2618, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 309, 309, 2618, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, 601, 601, 601, 601, 2618, 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, 2618, 601, 601, 601, 601, 601, 601, 601, 601, 601, 602, 602, 602, 602, 2618, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 603, 603, 603, 603, 2618, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 2618, 603, 603, 603, 603, 603, 603, 604, 604, 604, 604, 2618, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 606, 606, 606, 606, 2618, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 310, 310, 310, 310, 2618, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, 2618, 310, 310, 310, 310, 310, 310, 608, 608, 608, 608, 2618, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 609, 2618, 2618, 2618, 2618, 609, 2618, 609, 609, 2618, 2618, 2618, 609, 609, 2618, 609, 866, 2618, 866, 866, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 866, 866, 2618, 2618, 866, 617, 617, 617, 617, 617, 617, 2618, 617, 617, 617, 617, 617, 617, 617, 617, 617, 617, 617, 617, 617, 617, 617, 617, 617, 617, 617, 617, 619, 619, 619, 619, 619, 619, 619, 619, 619, 619, 2618, 619, 619, 619, 619, 619, 619, 619, 619, 619, 619, 619, 619, 619, 619, 619, 619, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 348, 2618, 2618, 2618, 2618, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 348, 366, 366, 2618, 2618, 2618, 366, 2618, 366, 366, 366, 2618, 366, 366, 366, 366, 366, 366, 366, 136, 136, 2618, 2618, 2618, 136, 2618, 136, 136, 136, 2618, 136, 136, 136, 136, 136, 136, 136, 316, 316, 2618, 2618, 2618, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 316, 321, 321, 2618, 2618, 2618, 321, 321, 2618, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 2618, 321, 321, 321, 321, 321, 321, 321, 326, 326, 2618, 2618, 2618, 326, 326, 2618, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 326, 866, 2618, 866, 866, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 866, 866, 2618, 2618, 866, 1318, 2618, 1318, 1318, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 1318, 1318, 2618, 2618, 1318, 1696, 2618, 1696, 1696, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 1696, 1696, 2618, 2618, 1696, 141, 141, 2618, 2618, 2618, 141, 2618, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 136, 136, 2618, 2618, 2618, 136, 2618, 136, 136, 136, 2618, 136, 136, 136, 136, 136, 136, 136, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1839, 1839, 2618, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1696, 2618, 1696, 1696, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 1696, 1696, 2618, 2618, 1696, 366, 366, 2618, 2618, 2618, 366, 2618, 366, 366, 366, 2618, 366, 366, 366, 366, 366, 366, 366, 141, 141, 2618, 2618, 2618, 141, 2618, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 136, 136, 2618, 2618, 2618, 136, 2618, 136, 136, 136, 2618, 136, 136, 136, 136, 136, 136, 136, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1839, 1839, 2618, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1990, 2618, 1990, 1990, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 1990, 1990, 2618, 2618, 1990, 141, 141, 2618, 2618, 2618, 141, 2618, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 136, 136, 2618, 2618, 2618, 136, 2618, 136, 136, 136, 2618, 136, 136, 136, 136, 136, 136, 136, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1797, 1839, 1839, 2618, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1839, 1990, 2618, 1990, 1990, 2618, 1990, 2618, 2618, 2618, 1990, 2618, 1990, 1990, 2618, 2618, 1990, 141, 141, 2618, 2618, 2618, 141, 2618, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 136, 136, 2618, 2618, 2618, 136, 2618, 136, 136, 136, 2618, 136, 136, 136, 136, 136, 136, 136, 141, 141, 2618, 2618, 2618, 141, 2618, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 136, 136, 2618, 2618, 2618, 136, 2618, 136, 136, 136, 2618, 136, 136, 136, 136, 136, 136, 136, 141, 141, 2618, 2618, 2618, 141, 2618, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 136, 136, 2618, 2618, 2618, 136, 2618, 136, 136, 136, 2618, 136, 136, 136, 136, 136, 136, 136, 141, 141, 2618, 2618, 2618, 141, 2618, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, 136, 136, 2618, 2618, 2618, 136, 2618, 136, 136, 136, 2618, 136, 136, 136, 136, 136, 136, 136, 21, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618 } ; static const flex_int16_t yy_chk[18316] = { 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, 121, 3, 26, 30, 121, 3, 4, 4, 4, 4, 30, 4, 2559, 26, 2529, 4, 5, 5, 5, 5, 5, 5, 5, 28, 31, 5, 5, 5, 5, 64, 5, 64, 64, 2480, 17, 17, 17, 17, 114, 28, 31, 114, 5, 5, 17, 17, 2461, 17, 5, 19, 19, 19, 19, 37, 19, 93, 93, 38, 19, 17, 17, 18, 18, 18, 18, 62, 37, 154, 2453, 37, 38, 18, 18, 38, 18, 20, 20, 20, 20, 62, 20, 128, 1619, 93, 20, 133, 18, 18, 23, 1619, 23, 23, 17, 133, 17, 62, 154, 128, 23, 23, 66, 23, 66, 66, 5, 5, 6, 6, 6, 6, 6, 6, 6, 2449, 23, 6, 6, 6, 6, 18, 6, 18, 33, 33, 33, 33, 33, 33, 33, 33, 94, 94, 6, 6, 75, 122, 75, 75, 6, 34, 34, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 35, 39, 68, 68, 94, 68, 81, 68, 81, 81, 83, 68, 83, 83, 39, 2412, 103, 39, 103, 103, 363, 155, 134, 69, 69, 69, 69, 104, 363, 104, 104, 81, 115, 69, 69, 115, 69, 115, 134, 122, 6, 6, 7, 7, 7, 7, 7, 7, 7, 69, 155, 7, 7, 7, 7, 1391, 7, 49, 50, 50, 156, 49, 50, 1391, 116, 2749, 50, 116, 7, 7, 2749, 49, 50, 116, 7, 139, 49, 50, 159, 53, 84, 84, 162, 53, 139, 2408, 49, 50, 50, 156, 49, 50, 53, 53, 110, 50, 110, 110, 53, 110, 49, 50, 136, 110, 84, 49, 50, 159, 53, 147, 84, 162, 53, 70, 70, 70, 70, 2386, 136, 2363, 163, 53, 53, 70, 70, 147, 70, 53, 167, 148, 7, 7, 8, 8, 8, 8, 8, 8, 8, 70, 2358, 8, 8, 8, 8, 148, 8, 56, 60, 163, 56, 56, 60, 646, 646, 149, 60, 167, 8, 8, 349, 56, 60, 349, 8, 56, 56, 60, 86, 86, 61, 149, 158, 86, 61, 153, 56, 60, 61, 56, 56, 60, 153, 158, 61, 60, 170, 61, 171, 61, 56, 60, 86, 395, 56, 56, 60, 86, 86, 61, 2224, 158, 354, 61, 153, 2353, 354, 61, 171, 395, 2224, 153, 158, 61, 2757, 170, 61, 171, 61, 2757, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 171, 9, 9, 87, 87, 87, 87, 87, 87, 87, 87, 9, 9, 9, 9, 9, 9, 9, 2348, 172, 2343, 74, 74, 74, 74, 88, 88, 881, 881, 2332, 88, 74, 74, 2331, 74, 105, 105, 105, 105, 105, 105, 105, 105, 173, 9, 9, 9, 74, 172, 88, 288, 2329, 288, 288, 356, 88, 137, 137, 137, 137, 137, 137, 137, 137, 289, 176, 289, 289, 1141, 1141, 137, 2299, 173, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 177, 10, 10, 144, 176, 144, 144, 144, 144, 144, 144, 10, 10, 10, 10, 10, 10, 10, 1394, 179, 181, 107, 356, 107, 107, 109, 1394, 109, 109, 177, 182, 107, 107, 183, 107, 109, 109, 711, 109, 2297, 184, 185, 189, 191, 10, 10, 10, 107, 179, 181, 109, 109, 2287, 711, 2283, 117, 2277, 117, 117, 182, 1331, 1331, 183, 192, 195, 117, 117, 160, 117, 184, 185, 189, 191, 10, 10, 11, 11, 11, 11, 11, 11, 117, 140, 160, 140, 140, 140, 140, 140, 140, 140, 140, 192, 195, 1342, 1342, 2267, 197, 200, 178, 188, 11, 160, 11, 188, 11, 142, 11, 142, 142, 142, 142, 142, 142, 142, 142, 143, 178, 143, 143, 143, 143, 143, 143, 143, 143, 197, 200, 178, 188, 2257, 160, 2247, 188, 11, 151, 11, 151, 151, 151, 151, 151, 151, 151, 151, 306, 178, 306, 306, 313, 2236, 313, 313, 152, 151, 152, 152, 152, 152, 152, 152, 152, 152, 11, 11, 12, 12, 12, 12, 12, 12, 151, 161, 152, 161, 161, 161, 161, 161, 161, 161, 161, 201, 151, 203, 312, 190, 312, 312, 350, 2223, 12, 350, 12, 350, 12, 190, 12, 204, 169, 151, 166, 152, 169, 2178, 166, 169, 161, 161, 166, 312, 201, 205, 203, 164, 190, 164, 164, 164, 164, 164, 164, 164, 164, 12, 190, 12, 204, 169, 732, 166, 2155, 169, 164, 166, 169, 161, 161, 166, 186, 2153, 205, 207, 186, 196, 732, 164, 196, 208, 1191, 186, 210, 1191, 12, 12, 13, 13, 13, 13, 13, 13, 13, 164, 2146, 13, 13, 13, 13, 186, 13, 168, 207, 186, 196, 168, 164, 196, 208, 168, 186, 210, 13, 13, 213, 168, 180, 214, 13, 180, 165, 215, 165, 165, 165, 165, 165, 165, 165, 165, 168, 180, 216, 202, 168, 202, 180, 217, 168, 218, 218, 219, 227, 213, 168, 180, 214, 748, 180, 335, 215, 335, 335, 2144, 165, 229, 336, 868, 336, 336, 180, 216, 202, 748, 202, 180, 217, 2761, 218, 218, 219, 227, 2761, 868, 13, 13, 14, 14, 14, 14, 14, 14, 14, 165, 229, 14, 14, 14, 14, 231, 14, 2137, 198, 220, 175, 175, 198, 228, 187, 220, 187, 175, 14, 14, 187, 175, 198, 228, 14, 175, 226, 228, 226, 232, 175, 187, 233, 234, 231, 233, 187, 198, 220, 175, 175, 198, 228, 187, 220, 187, 175, 236, 238, 187, 175, 198, 228, 2135, 175, 226, 228, 226, 232, 175, 187, 233, 234, 239, 233, 187, 241, 244, 247, 239, 290, 290, 2128, 290, 2126, 290, 236, 238, 2113, 290, 14, 14, 15, 15, 15, 15, 248, 15, 243, 250, 252, 15, 239, 243, 253, 241, 244, 247, 239, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 255, 16, 1397, 2112, 248, 16, 243, 250, 252, 2053, 1397, 243, 253, 16, 16, 16, 16, 16, 16, 16, 16, 27, 27, 27, 27, 27, 27, 27, 2051, 255, 27, 27, 27, 27, 222, 27, 240, 27, 209, 222, 257, 1568, 1568, 235, 209, 222, 2041, 27, 27, 222, 209, 240, 2037, 27, 209, 209, 235, 209, 225, 242, 258, 235, 235, 222, 225, 240, 263, 209, 222, 257, 225, 225, 235, 209, 222, 242, 242, 264, 222, 209, 240, 27, 2031, 209, 209, 235, 209, 225, 242, 258, 235, 235, 1638, 225, 337, 263, 337, 337, 352, 225, 225, 352, 265, 2021, 242, 242, 264, 352, 1638, 27, 27, 32, 32, 613, 2011, 613, 613, 32, 2000, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 265, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 1992, 40, 40, 40, 40, 40, 40, 40, 40, 246, 245, 246, 246, 259, 249, 262, 262, 259, 40, 40, 245, 260, 266, 267, 269, 260, 262, 40, 270, 40, 249, 40, 271, 40, 40, 40, 40, 1991, 246, 245, 246, 246, 259, 249, 262, 262, 259, 40, 40, 245, 260, 266, 267, 269, 260, 262, 40, 270, 40, 249, 40, 271, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 254, 256, 1959, 256, 261, 272, 268, 41, 273, 254, 268, 254, 256, 274, 275, 254, 276, 254, 261, 278, 276, 1908, 256, 268, 280, 281, 282, 41, 284, 254, 256, 41, 256, 261, 272, 268, 41, 273, 254, 268, 254, 256, 274, 275, 254, 276, 254, 261, 278, 276, 277, 256, 268, 280, 281, 282, 41, 284, 277, 1885, 41, 42, 330, 330, 285, 866, 279, 866, 866, 286, 279, 387, 1883, 283, 279, 389, 388, 42, 391, 277, 387, 42, 388, 283, 42, 42, 1876, 277, 42, 398, 330, 42, 42, 285, 42, 279, 42, 42, 286, 279, 387, 42, 283, 279, 389, 388, 42, 391, 1398, 387, 42, 388, 283, 42, 42, 392, 1398, 42, 398, 392, 42, 42, 1772, 42, 1812, 42, 42, 406, 406, 1772, 42, 43, 294, 294, 294, 294, 299, 299, 299, 299, 1812, 393, 294, 294, 392, 294, 1874, 43, 392, 299, 393, 43, 429, 314, 314, 43, 406, 406, 294, 1867, 43, 43, 295, 295, 295, 295, 1594, 43, 410, 43, 393, 43, 295, 295, 1594, 295, 43, 314, 410, 393, 43, 429, 1865, 314, 43, 315, 315, 443, 295, 43, 43, 1595, 296, 296, 296, 296, 43, 410, 43, 1595, 43, 44, 296, 296, 1853, 296, 1929, 410, 1852, 315, 297, 297, 297, 297, 1929, 315, 443, 44, 296, 44, 297, 297, 344, 297, 344, 344, 1196, 344, 44, 1196, 44, 344, 1851, 44, 319, 319, 297, 44, 44, 319, 44, 44, 298, 298, 298, 298, 44, 396, 44, 320, 320, 396, 298, 298, 320, 298, 1840, 44, 319, 44, 324, 324, 44, 319, 319, 324, 44, 44, 298, 44, 44, 45, 300, 320, 300, 300, 396, 2084, 320, 320, 396, 2229, 300, 300, 324, 300, 301, 45, 301, 301, 324, 2229, 447, 2084, 390, 45, 301, 301, 300, 301, 390, 45, 401, 1798, 45, 45, 45, 45, 325, 325, 401, 45, 301, 325, 1706, 1706, 45, 345, 1749, 345, 345, 447, 345, 390, 45, 1105, 345, 1105, 1105, 390, 45, 401, 325, 45, 45, 45, 45, 2764, 325, 401, 45, 46, 2764, 46, 46, 46, 46, 46, 46, 46, 46, 46, 1774, 449, 305, 1774, 305, 305, 46, 46, 46, 46, 46, 46, 305, 305, 46, 305, 341, 1814, 341, 341, 1814, 46, 402, 46, 408, 46, 341, 341, 305, 341, 449, 450, 408, 402, 1747, 46, 46, 46, 46, 46, 46, 1737, 341, 46, 382, 382, 382, 382, 382, 382, 46, 402, 46, 408, 46, 47, 47, 452, 394, 47, 450, 408, 402, 47, 394, 2080, 456, 399, 462, 47, 47, 399, 47, 2080, 47, 323, 323, 323, 323, 323, 323, 323, 323, 478, 47, 47, 452, 394, 47, 323, 346, 346, 47, 394, 346, 456, 399, 462, 47, 47, 399, 47, 346, 47, 48, 397, 48, 48, 48, 48, 48, 397, 478, 488, 346, 404, 48, 48, 48, 48, 1733, 404, 48, 48, 338, 338, 338, 338, 338, 338, 338, 338, 1728, 48, 397, 48, 48, 48, 48, 48, 397, 1718, 488, 1620, 404, 48, 48, 48, 48, 346, 404, 48, 48, 51, 403, 1707, 51, 51, 1620, 403, 421, 51, 1620, 347, 347, 51, 342, 51, 342, 342, 421, 347, 51, 1717, 1717, 347, 342, 342, 1790, 342, 407, 1699, 51, 403, 407, 51, 51, 347, 403, 421, 51, 342, 342, 1790, 51, 405, 51, 1790, 405, 421, 409, 51, 52, 52, 409, 52, 52, 412, 1698, 407, 52, 412, 411, 407, 52, 1697, 52, 411, 52, 459, 52, 52, 347, 411, 405, 413, 52, 405, 459, 409, 413, 52, 52, 409, 52, 52, 412, 414, 1682, 52, 412, 411, 1628, 52, 414, 52, 411, 52, 459, 52, 52, 1569, 411, 1550, 413, 52, 54, 459, 415, 413, 54, 54, 1548, 415, 417, 416, 514, 54, 417, 54, 54, 54, 416, 54, 414, 54, 1541, 371, 371, 371, 371, 371, 371, 371, 371, 54, 414, 415, 1539, 54, 54, 371, 415, 417, 416, 514, 54, 417, 54, 54, 54, 416, 54, 414, 54, 55, 529, 428, 420, 55, 1527, 55, 428, 55, 418, 414, 420, 418, 426, 55, 55, 426, 55, 367, 55, 367, 367, 367, 367, 367, 367, 367, 367, 1526, 55, 529, 428, 420, 55, 367, 55, 428, 55, 418, 1525, 420, 418, 426, 55, 55, 426, 55, 423, 55, 57, 424, 534, 430, 57, 424, 423, 57, 57, 430, 432, 57, 57, 425, 57, 57, 427, 432, 57, 57, 57, 425, 57, 425, 57, 1361, 427, 423, 535, 57, 424, 534, 430, 57, 424, 423, 57, 57, 430, 432, 57, 57, 425, 57, 57, 427, 432, 57, 57, 57, 425, 57, 425, 57, 58, 427, 58, 535, 58, 431, 437, 58, 58, 431, 433, 58, 434, 58, 58, 436, 437, 434, 433, 58, 537, 436, 438, 435, 58, 1359, 438, 1931, 435, 58, 1931, 58, 435, 58, 431, 437, 58, 58, 431, 433, 58, 434, 58, 58, 436, 437, 434, 433, 58, 537, 436, 438, 435, 58, 59, 438, 59, 435, 460, 59, 440, 435, 59, 440, 59, 460, 59, 548, 59, 59, 368, 1349, 368, 368, 368, 368, 368, 368, 368, 368, 1727, 1727, 2082, 59, 1344, 59, 368, 460, 59, 440, 2082, 59, 440, 59, 460, 59, 548, 59, 59, 85, 85, 85, 85, 458, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 458, 85, 85, 378, 378, 378, 378, 378, 378, 378, 378, 85, 85, 85, 85, 85, 85, 369, 458, 369, 369, 369, 369, 369, 369, 369, 369, 959, 1965, 458, 959, 1965, 370, 369, 370, 370, 370, 370, 370, 370, 370, 370, 1343, 959, 85, 85, 85, 373, 370, 373, 373, 373, 373, 373, 373, 373, 373, 380, 380, 380, 380, 380, 380, 380, 380, 381, 381, 381, 381, 381, 381, 381, 381, 85, 85, 89, 89, 89, 89, 552, 89, 89, 89, 89, 1332, 89, 89, 89, 89, 89, 89, 383, 89, 383, 383, 383, 383, 383, 383, 383, 383, 89, 89, 89, 89, 89, 89, 384, 552, 384, 384, 384, 384, 384, 384, 384, 384, 386, 558, 386, 386, 386, 386, 386, 386, 386, 386, 441, 384, 1907, 1907, 441, 492, 492, 89, 89, 89, 400, 448, 400, 400, 400, 400, 400, 400, 400, 400, 558, 1324, 442, 1323, 386, 1142, 479, 448, 479, 441, 384, 400, 442, 441, 492, 492, 89, 89, 124, 124, 124, 124, 124, 124, 124, 1126, 448, 124, 124, 124, 124, 442, 124, 386, 124, 479, 1124, 479, 444, 445, 400, 442, 444, 445, 124, 124, 451, 453, 446, 1112, 124, 446, 564, 453, 451, 448, 1111, 419, 1110, 419, 419, 419, 419, 419, 419, 419, 419, 444, 445, 457, 575, 444, 445, 897, 457, 451, 453, 446, 124, 2765, 446, 564, 453, 451, 2765, 422, 419, 422, 422, 422, 422, 422, 422, 422, 422, 1999, 1999, 895, 457, 575, 2010, 2010, 422, 457, 2020, 2020, 124, 124, 125, 125, 125, 125, 125, 125, 125, 419, 885, 125, 125, 125, 125, 439, 125, 439, 439, 439, 439, 439, 439, 439, 439, 422, 455, 454, 125, 125, 461, 882, 464, 874, 125, 454, 463, 461, 455, 464, 439, 465, 463, 466, 465, 467, 468, 469, 477, 496, 467, 469, 470, 496, 466, 455, 454, 468, 477, 461, 470, 464, 125, 873, 454, 463, 461, 455, 464, 439, 465, 463, 466, 465, 467, 468, 469, 477, 496, 467, 469, 470, 496, 466, 2030, 2030, 468, 477, 647, 470, 125, 125, 126, 126, 126, 126, 126, 126, 126, 472, 475, 126, 126, 126, 126, 509, 126, 471, 474, 471, 473, 475, 498, 476, 474, 472, 498, 473, 126, 126, 476, 480, 481, 633, 126, 509, 471, 481, 480, 475, 482, 487, 483, 482, 472, 483, 482, 474, 485, 473, 475, 498, 476, 474, 485, 498, 473, 487, 484, 476, 480, 481, 126, 2089, 509, 471, 481, 480, 632, 482, 484, 483, 482, 472, 483, 482, 487, 485, 486, 2089, 489, 486, 1287, 485, 1287, 1287, 2308, 484, 489, 2308, 126, 126, 127, 127, 127, 127, 127, 127, 127, 484, 2302, 127, 127, 127, 127, 487, 127, 486, 127, 489, 486, 491, 493, 494, 490, 493, 2302, 489, 127, 127, 490, 491, 495, 2199, 127, 494, 490, 495, 499, 500, 501, 2199, 497, 500, 497, 515, 507, 515, 501, 499, 491, 493, 494, 490, 493, 497, 502, 507, 578, 490, 491, 495, 127, 619, 494, 490, 495, 499, 500, 501, 502, 497, 500, 497, 515, 507, 515, 501, 499, 1318, 617, 1318, 1318, 579, 497, 502, 507, 578, 2177, 2177, 127, 127, 138, 138, 1490, 610, 1490, 1490, 138, 502, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 579, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 141, 539, 141, 141, 141, 141, 141, 141, 141, 141, 141, 503, 516, 539, 516, 503, 609, 141, 141, 141, 141, 141, 141, 637, 637, 637, 637, 637, 637, 607, 539, 2201, 505, 506, 523, 505, 523, 506, 504, 2201, 503, 516, 539, 516, 503, 504, 141, 141, 141, 141, 141, 141, 146, 146, 146, 146, 146, 146, 146, 146, 146, 505, 506, 523, 505, 523, 506, 504, 146, 146, 146, 146, 146, 146, 504, 511, 950, 601, 950, 950, 508, 950, 2235, 2235, 2202, 510, 512, 513, 600, 510, 512, 511, 2202, 518, 518, 598, 513, 146, 146, 146, 146, 146, 146, 174, 511, 174, 174, 174, 174, 174, 174, 174, 174, 508, 510, 512, 513, 508, 510, 512, 511, 517, 518, 518, 174, 513, 519, 520, 521, 519, 524, 517, 522, 520, 541, 522, 521, 520, 525, 174, 524, 526, 508, 541, 174, 1518, 508, 1518, 1518, 525, 517, 2309, 526, 174, 2309, 519, 520, 521, 519, 524, 517, 522, 520, 541, 522, 521, 520, 525, 174, 524, 526, 530, 541, 174, 251, 530, 251, 251, 525, 527, 251, 526, 533, 251, 527, 528, 251, 528, 533, 251, 251, 583, 251, 251, 1023, 377, 1023, 1023, 528, 1023, 530, 2246, 2246, 251, 530, 251, 251, 375, 527, 251, 374, 533, 251, 527, 528, 251, 528, 533, 251, 251, 583, 251, 251, 317, 317, 317, 317, 528, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 532, 317, 317, 366, 536, 532, 545, 531, 536, 545, 543, 317, 317, 317, 317, 317, 317, 365, 531, 538, 542, 540, 543, 538, 555, 542, 538, 540, 547, 532, 584, 555, 540, 536, 532, 545, 531, 536, 545, 543, 361, 547, 2402, 549, 317, 317, 317, 531, 538, 542, 540, 543, 538, 555, 542, 538, 540, 547, 2402, 584, 555, 540, 2256, 2256, 546, 549, 551, 2769, 588, 546, 547, 551, 2769, 317, 317, 318, 318, 318, 318, 353, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 351, 318, 318, 546, 549, 551, 550, 588, 546, 554, 551, 318, 318, 318, 318, 318, 318, 339, 544, 550, 554, 553, 556, 576, 544, 553, 334, 544, 556, 557, 544, 576, 556, 557, 561, 550, 565, 2778, 554, 332, 590, 561, 2778, 565, 318, 318, 318, 544, 550, 554, 553, 556, 576, 544, 553, 560, 544, 556, 557, 544, 576, 556, 557, 561, 560, 565, 560, 322, 559, 590, 561, 559, 565, 318, 318, 327, 327, 327, 327, 310, 327, 327, 327, 327, 560, 327, 327, 327, 327, 327, 327, 566, 327, 560, 566, 560, 562, 562, 2266, 2266, 559, 327, 327, 327, 327, 327, 327, 309, 559, 563, 567, 570, 567, 569, 568, 563, 570, 569, 574, 592, 566, 559, 571, 566, 568, 562, 562, 571, 572, 559, 307, 574, 572, 656, 327, 327, 327, 559, 563, 567, 570, 567, 569, 568, 563, 570, 569, 574, 592, 304, 559, 571, 302, 568, 573, 577, 571, 572, 573, 577, 574, 572, 656, 327, 327, 328, 328, 328, 328, 291, 328, 328, 328, 328, 580, 328, 328, 328, 328, 328, 328, 586, 328, 573, 577, 594, 594, 573, 577, 580, 586, 328, 328, 328, 328, 328, 328, 224, 581, 582, 585, 587, 585, 580, 581, 582, 587, 589, 653, 591, 586, 593, 595, 657, 594, 594, 223, 589, 580, 586, 591, 593, 653, 595, 328, 328, 328, 581, 582, 585, 587, 585, 630, 581, 582, 587, 589, 653, 591, 212, 593, 595, 657, 2779, 602, 602, 589, 630, 2779, 591, 593, 653, 595, 328, 328, 357, 357, 357, 357, 357, 357, 357, 194, 674, 357, 357, 357, 357, 602, 357, 604, 604, 606, 606, 602, 604, 630, 606, 684, 616, 616, 357, 357, 616, 654, 654, 649, 357, 2276, 2276, 2780, 616, 674, 193, 604, 2780, 606, 652, 685, 604, 604, 649, 606, 616, 618, 618, 651, 684, 652, 150, 651, 649, 618, 654, 654, 357, 618, 624, 624, 624, 624, 624, 624, 624, 624, 676, 652, 685, 618, 655, 649, 624, 676, 655, 2316, 651, 658, 652, 616, 651, 649, 658, 2316, 357, 357, 358, 358, 358, 358, 358, 358, 358, 2335, 2335, 358, 358, 358, 358, 655, 358, 659, 659, 655, 618, 1289, 658, 1289, 1289, 145, 1289, 658, 358, 358, 664, 676, 664, 2336, 358, 625, 625, 625, 625, 625, 625, 625, 625, 2336, 690, 691, 659, 659, 626, 625, 626, 626, 626, 626, 626, 626, 626, 626, 135, 664, 676, 664, 358, 627, 626, 627, 627, 627, 627, 627, 627, 627, 627, 690, 691, 1696, 131, 1696, 1696, 627, 635, 635, 635, 635, 635, 635, 635, 635, 2385, 2385, 358, 358, 359, 359, 359, 359, 359, 359, 359, 129, 119, 359, 359, 359, 359, 628, 359, 628, 628, 628, 628, 628, 628, 628, 628, 665, 663, 665, 359, 359, 663, 628, 106, 629, 359, 629, 629, 629, 629, 629, 629, 629, 629, 629, 636, 636, 636, 636, 636, 636, 636, 636, 2728, 2728, 665, 663, 665, 2728, 629, 663, 692, 638, 359, 638, 638, 638, 638, 638, 638, 638, 638, 639, 639, 639, 639, 639, 639, 639, 639, 640, 640, 640, 640, 640, 640, 640, 640, 629, 82, 692, 359, 359, 360, 360, 360, 360, 360, 360, 360, 80, 36, 360, 360, 360, 360, 675, 360, 642, 642, 642, 642, 642, 642, 642, 642, 662, 675, 666, 360, 360, 25, 662, 666, 21, 360, 643, 643, 643, 643, 643, 643, 643, 643, 644, 675, 644, 644, 644, 644, 644, 644, 644, 644, 650, 662, 675, 666, 668, 678, 650, 662, 666, 360, 0, 0, 668, 650, 687, 678, 869, 694, 869, 869, 869, 869, 869, 869, 869, 869, 2415, 0, 0, 650, 687, 0, 869, 668, 678, 650, 2415, 360, 360, 372, 372, 668, 650, 687, 678, 372, 694, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 687, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, 376, 376, 376, 376, 376, 376, 376, 376, 376, 667, 670, 693, 695, 667, 693, 670, 376, 376, 376, 376, 376, 376, 877, 877, 877, 877, 877, 877, 877, 877, 0, 0, 1817, 671, 1817, 1817, 698, 671, 667, 670, 693, 695, 667, 693, 670, 376, 376, 376, 376, 376, 376, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 379, 671, 672, 680, 698, 671, 672, 379, 379, 379, 379, 379, 379, 0, 680, 878, 878, 878, 878, 878, 878, 878, 878, 0, 673, 679, 707, 708, 673, 679, 0, 672, 680, 0, 0, 672, 379, 379, 379, 379, 379, 379, 385, 680, 385, 385, 385, 385, 385, 385, 385, 385, 385, 673, 679, 707, 708, 673, 679, 385, 385, 385, 385, 385, 385, 716, 683, 385, 1492, 677, 1492, 1492, 683, 1492, 0, 0, 879, 677, 879, 879, 879, 879, 879, 879, 879, 879, 0, 0, 385, 385, 385, 385, 385, 385, 716, 683, 385, 603, 603, 603, 603, 683, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 660, 603, 603, 661, 677, 0, 677, 1850, 677, 1850, 1850, 603, 603, 603, 603, 603, 603, 0, 661, 681, 669, 689, 682, 681, 660, 669, 682, 661, 689, 669, 660, 688, 699, 677, 660, 677, 688, 677, 696, 697, 0, 696, 697, 699, 603, 603, 603, 661, 681, 669, 689, 682, 681, 660, 669, 682, 661, 689, 669, 660, 688, 699, 0, 660, 686, 688, 704, 696, 697, 704, 696, 697, 699, 603, 603, 608, 608, 608, 608, 686, 608, 608, 608, 608, 700, 608, 608, 608, 608, 608, 608, 686, 608, 720, 0, 704, 725, 0, 704, 702, 700, 608, 608, 608, 608, 608, 608, 608, 686, 701, 702, 701, 701, 700, 701, 703, 709, 706, 0, 710, 686, 703, 720, 706, 730, 725, 712, 710, 702, 700, 705, 709, 2788, 712, 608, 608, 608, 2788, 1819, 702, 1819, 1819, 0, 1819, 703, 0, 706, 705, 710, 701, 703, 705, 706, 730, 0, 712, 710, 0, 0, 731, 709, 701, 712, 608, 608, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 705, 713, 701, 737, 705, 713, 634, 634, 634, 634, 634, 634, 731, 1654, 701, 894, 894, 894, 894, 894, 894, 2796, 721, 1654, 729, 721, 2796, 729, 2797, 1654, 713, 0, 737, 2797, 713, 634, 634, 634, 634, 634, 634, 641, 641, 641, 641, 641, 641, 641, 641, 641, 641, 721, 714, 729, 721, 718, 729, 641, 641, 641, 641, 641, 641, 714, 715, 718, 717, 717, 722, 723, 724, 715, 717, 719, 726, 2747, 2747, 722, 726, 723, 2747, 714, 724, 0, 718, 0, 641, 641, 641, 641, 641, 641, 714, 715, 718, 717, 717, 722, 723, 724, 715, 717, 738, 726, 719, 719, 722, 726, 723, 727, 719, 724, 728, 738, 733, 735, 734, 727, 0, 739, 719, 728, 733, 734, 740, 735, 736, 736, 741, 742, 743, 738, 2798, 719, 719, 744, 741, 2798, 727, 719, 0, 728, 738, 733, 735, 734, 727, 736, 739, 719, 728, 733, 734, 740, 735, 745, 747, 741, 742, 743, 751, 744, 747, 745, 750, 741, 746, 746, 749, 751, 752, 744, 750, 753, 754, 749, 736, 755, 752, 753, 756, 757, 0, 758, 745, 747, 758, 761, 755, 751, 744, 747, 745, 750, 762, 746, 746, 749, 751, 752, 744, 750, 753, 754, 749, 759, 755, 752, 753, 756, 757, 759, 758, 760, 760, 758, 761, 755, 763, 765, 766, 764, 763, 762, 764, 765, 767, 768, 770, 766, 769, 768, 773, 771, 759, 774, 770, 0, 772, 775, 759, 0, 760, 760, 774, 769, 772, 763, 765, 766, 764, 763, 779, 764, 765, 767, 768, 770, 766, 769, 768, 773, 776, 777, 774, 770, 771, 772, 775, 776, 778, 777, 783, 774, 769, 772, 778, 785, 780, 781, 787, 779, 780, 781, 782, 786, 782, 782, 786, 782, 784, 776, 777, 789, 784, 771, 792, 781, 776, 778, 777, 783, 788, 0, 788, 778, 785, 780, 781, 787, 790, 780, 781, 791, 786, 790, 791, 786, 793, 784, 795, 788, 789, 784, 782, 792, 781, 793, 794, 796, 0, 797, 795, 798, 794, 797, 2748, 2748, 799, 790, 802, 2748, 791, 803, 790, 791, 802, 793, 803, 795, 788, 799, 800, 782, 0, 805, 793, 794, 796, 798, 797, 795, 800, 794, 797, 798, 801, 799, 0, 802, 804, 805, 803, 807, 808, 802, 801, 803, 804, 806, 799, 800, 808, 806, 805, 807, 810, 811, 798, 817, 809, 800, 810, 812, 798, 801, 811, 813, 812, 804, 805, 813, 807, 808, 814, 801, 809, 804, 806, 818, 815, 808, 806, 814, 807, 810, 811, 821, 817, 809, 815, 810, 812, 820, 816, 811, 813, 812, 816, 835, 813, 820, 819, 814, 822, 809, 819, 823, 818, 815, 825, 824, 814, 0, 822, 824, 821, 823, 825, 815, 826, 827, 820, 816, 827, 826, 828, 816, 835, 839, 820, 819, 2799, 822, 830, 819, 823, 2799, 828, 825, 824, 829, 829, 822, 824, 830, 823, 825, 831, 826, 0, 838, 831, 836, 826, 828, 827, 827, 839, 836, 840, 838, 829, 830, 831, 0, 832, 828, 832, 832, 841, 832, 833, 844, 830, 834, 833, 831, 0, 834, 838, 831, 836, 837, 0, 827, 827, 837, 836, 840, 838, 829, 842, 831, 832, 844, 846, 843, 850, 841, 842, 833, 850, 843, 834, 833, 832, 843, 834, 847, 848, 845, 837, 832, 845, 848, 837, 832, 851, 847, 849, 842, 851, 0, 844, 846, 843, 850, 849, 842, 855, 850, 843, 855, 856, 832, 843, 0, 847, 848, 845, 902, 832, 845, 848, 852, 832, 851, 847, 849, 852, 851, 853, 854, 853, 905, 907, 849, 854, 855, 858, 857, 855, 856, 857, 859, 858, 908, 860, 0, 902, 859, 860, 2803, 852, 911, 0, 0, 2803, 852, 0, 853, 854, 853, 905, 907, 910, 854, 0, 858, 857, 0, 0, 857, 859, 858, 908, 860, 910, 911, 859, 860, 870, 0, 870, 870, 870, 870, 870, 870, 870, 870, 0, 0, 0, 910, 0, 871, 870, 871, 871, 871, 871, 871, 871, 871, 871, 910, 911, 0, 0, 0, 872, 871, 872, 872, 872, 872, 872, 872, 872, 872, 884, 884, 884, 884, 884, 884, 884, 884, 1116, 1116, 1116, 1116, 1116, 1116, 886, 872, 886, 886, 886, 886, 886, 886, 886, 886, 887, 0, 887, 887, 887, 887, 887, 887, 887, 887, 888, 0, 888, 888, 888, 888, 888, 888, 888, 888, 872, 875, 875, 875, 875, 875, 875, 875, 875, 875, 899, 913, 900, 927, 928, 899, 900, 875, 875, 875, 875, 875, 875, 890, 890, 890, 890, 890, 890, 890, 890, 892, 892, 892, 892, 892, 892, 892, 892, 899, 913, 900, 927, 928, 899, 900, 875, 875, 875, 875, 875, 875, 876, 876, 876, 876, 876, 876, 876, 876, 876, 876, 904, 931, 932, 933, 904, 0, 876, 876, 876, 876, 876, 876, 893, 893, 893, 893, 893, 893, 893, 893, 0, 0, 909, 914, 898, 936, 914, 909, 0, 904, 931, 932, 933, 904, 898, 876, 876, 876, 876, 876, 876, 889, 889, 889, 889, 889, 889, 889, 889, 889, 889, 909, 914, 898, 936, 914, 909, 889, 889, 889, 889, 889, 889, 898, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 2755, 2755, 915, 937, 2808, 2755, 1106, 915, 917, 2808, 2196, 917, 2196, 2196, 889, 889, 889, 889, 889, 889, 891, 891, 891, 891, 891, 891, 891, 891, 891, 891, 891, 915, 937, 901, 903, 912, 915, 891, 891, 891, 891, 891, 891, 901, 903, 906, 912, 916, 917, 2809, 918, 916, 906, 0, 2809, 925, 919, 0, 917, 918, 0, 925, 901, 903, 912, 919, 891, 891, 891, 891, 891, 891, 901, 903, 906, 912, 916, 917, 920, 918, 916, 906, 922, 921, 925, 919, 923, 917, 918, 924, 925, 920, 924, 922, 919, 921, 926, 923, 929, 935, 934, 926, 941, 938, 935, 939, 929, 920, 934, 0, 939, 922, 921, 938, 940, 923, 0, 940, 924, 944, 920, 924, 922, 944, 921, 926, 923, 947, 935, 934, 926, 941, 938, 935, 939, 942, 949, 934, 943, 939, 942, 943, 938, 940, 945, 929, 940, 929, 944, 929, 945, 946, 944, 948, 955, 946, 947, 952, 957, 956, 954, 948, 953, 957, 942, 949, 956, 943, 952, 942, 943, 954, 953, 945, 929, 958, 929, 961, 929, 945, 946, 958, 948, 955, 946, 967, 952, 957, 956, 954, 948, 953, 957, 961, 960, 956, 960, 952, 968, 962, 954, 953, 962, 963, 958, 964, 961, 963, 964, 965, 958, 966, 969, 965, 967, 970, 0, 971, 969, 966, 972, 974, 961, 960, 972, 960, 973, 968, 962, 975, 973, 962, 963, 976, 975, 979, 963, 0, 965, 0, 966, 969, 965, 976, 970, 964, 971, 969, 966, 972, 974, 977, 983, 972, 978, 973, 977, 978, 975, 973, 981, 984, 976, 975, 979, 980, 982, 987, 980, 985, 987, 986, 976, 992, 964, 0, 981, 982, 988, 985, 977, 983, 988, 978, 986, 977, 978, 989, 990, 981, 984, 0, 990, 0, 980, 982, 987, 980, 985, 987, 986, 991, 992, 989, 991, 981, 982, 988, 985, 989, 993, 988, 994, 986, 995, 996, 997, 990, 997, 993, 995, 990, 998, 0, 999, 1000, 1001, 998, 994, 1000, 991, 996, 1004, 991, 999, 1003, 1002, 1001, 989, 993, 1003, 994, 1004, 995, 996, 997, 1005, 997, 993, 995, 1006, 998, 1002, 999, 1000, 1001, 998, 994, 1000, 1007, 996, 1004, 1008, 999, 1003, 1002, 1001, 1009, 1007, 1003, 1010, 1004, 1012, 1011, 1013, 1005, 1009, 1014, 1015, 1006, 1017, 1002, 1011, 1016, 1015, 1017, 1013, 1018, 1007, 1019, 1020, 1008, 1018, 2810, 1016, 1020, 1009, 1007, 2810, 1010, 1019, 1012, 1011, 1013, 1021, 1009, 1014, 1015, 1028, 1017, 1030, 1011, 1016, 1015, 1017, 1013, 1018, 1021, 1019, 1020, 1022, 1018, 1025, 1016, 1020, 1025, 1022, 1026, 1027, 1019, 1031, 1029, 1026, 1021, 1029, 1032, 1033, 1028, 1027, 1030, 1034, 1037, 1036, 1041, 1035, 0, 1021, 1032, 1034, 1022, 1035, 1025, 1036, 0, 1025, 1022, 1026, 1027, 1038, 1031, 1029, 1026, 1040, 1029, 1032, 1033, 1040, 1027, 0, 1034, 1037, 1036, 1041, 1035, 1038, 1039, 1032, 1034, 1047, 1035, 1039, 1036, 1042, 1043, 1046, 1044, 1045, 1048, 1047, 1038, 1044, 1040, 1049, 1042, 1043, 1040, 1048, 1045, 1050, 1051, 1052, 1049, 0, 1055, 1039, 1056, 0, 1047, 1052, 1039, 1046, 1042, 1043, 1046, 1044, 1045, 1048, 1047, 1038, 1044, 1059, 1049, 1042, 1043, 1054, 1048, 1045, 1050, 1051, 1052, 1049, 1053, 1055, 1057, 1056, 1054, 1053, 1052, 1058, 1046, 1060, 1061, 1046, 1062, 1058, 1063, 1064, 1065, 1057, 1059, 1066, 1060, 1067, 1054, 1069, 1068, 1064, 1070, 2756, 2756, 1053, 0, 1057, 2756, 1054, 1053, 1068, 1058, 1072, 1060, 1061, 1072, 1062, 1058, 1063, 1064, 1065, 1057, 1073, 1066, 1060, 1067, 0, 1069, 1068, 1064, 1070, 1071, 1073, 1071, 1071, 1076, 1071, 1076, 1076, 1068, 1074, 1072, 1074, 1074, 1072, 1074, 1077, 1078, 1079, 0, 1076, 1073, 1080, 2811, 1079, 1077, 1080, 0, 2811, 1071, 1081, 1073, 1081, 0, 1083, 1084, 1076, 1083, 1074, 1082, 1084, 1071, 0, 1090, 1071, 1077, 1078, 1079, 1071, 1090, 1082, 1080, 1071, 1079, 1077, 1080, 1087, 1074, 1091, 1081, 1085, 1081, 1086, 1083, 1084, 1085, 1083, 1087, 1082, 1084, 1071, 1089, 1090, 1071, 1086, 0, 1093, 1071, 1090, 1082, 1093, 1071, 1088, 1088, 1088, 1087, 1074, 1091, 1092, 1085, 1094, 1086, 1095, 1092, 1085, 1096, 1087, 1097, 1098, 1100, 1095, 1099, 1089, 1086, 1088, 1093, 1102, 1099, 1089, 1093, 1101, 1102, 1089, 1103, 1098, 1104, 1101, 1092, 0, 1094, 0, 1095, 1092, 1144, 1096, 1103, 1097, 1098, 1100, 1095, 1099, 1089, 0, 1088, 1145, 1102, 1099, 1089, 1151, 1101, 1102, 1089, 1103, 1098, 1104, 1101, 1123, 1123, 1123, 1123, 1123, 1123, 1144, 1107, 1103, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1145, 0, 0, 0, 1151, 1108, 1107, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1143, 0, 0, 0, 1153, 1109, 1108, 1109, 1109, 1109, 1109, 1109, 1109, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1114, 1109, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1113, 1153, 1147, 1155, 1162, 1143, 1147, 1113, 1113, 1113, 1113, 1113, 1113, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1117, 0, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1147, 1155, 1162, 1143, 1147, 1113, 1113, 1113, 1113, 1113, 1113, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1160, 1166, 1148, 1169, 1160, 0, 1118, 1118, 1118, 1118, 1118, 1118, 1119, 1119, 1119, 1119, 1119, 1119, 1119, 1119, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1121, 1148, 1160, 1166, 0, 1169, 1160, 1156, 1118, 1118, 1118, 1118, 1118, 1118, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1156, 1173, 1175, 1173, 1176, 1148, 1120, 1120, 1120, 1120, 1120, 1120, 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1122, 1128, 1128, 1128, 1128, 1128, 1128, 1128, 1128, 0, 1156, 1173, 1175, 1173, 1176, 0, 1120, 1120, 1120, 1120, 1120, 1120, 1129, 0, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1130, 0, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1130, 1131, 0, 1131, 1131, 1131, 1131, 1131, 1131, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1133, 1133, 1133, 1133, 1133, 1133, 1133, 1133, 1133, 1133, 1134, 1134, 1134, 1134, 1134, 1134, 1134, 1134, 1134, 1134, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1136, 1136, 1136, 1136, 1136, 1136, 1136, 1136, 1136, 1136, 1164, 1179, 1180, 0, 1164, 1179, 1136, 1136, 1136, 1136, 1136, 1136, 1137, 1137, 1137, 1137, 1137, 1137, 1137, 1137, 1138, 1138, 1138, 1138, 1138, 1138, 1138, 1138, 0, 1164, 1179, 1180, 1146, 1164, 1179, 1136, 1136, 1136, 1136, 1136, 1136, 1139, 1146, 1139, 1139, 1139, 1139, 1139, 1139, 1139, 1139, 1149, 0, 1150, 1152, 1154, 1157, 1159, 1161, 0, 1163, 1146, 1150, 1149, 1170, 1152, 1154, 1163, 1161, 1159, 1165, 1146, 1170, 1172, 1167, 0, 1185, 1165, 1189, 1168, 1149, 1172, 1150, 1152, 1154, 1167, 1159, 1161, 1157, 1163, 1168, 1150, 1149, 1157, 1152, 1154, 1163, 1161, 1159, 1165, 1182, 1171, 1174, 1167, 1177, 1185, 1165, 1189, 1168, 1171, 1172, 1170, 1181, 1174, 1167, 1177, 1183, 1157, 0, 1168, 1181, 1178, 1157, 1158, 1178, 1192, 1158, 1187, 1183, 0, 0, 1174, 0, 1177, 1171, 1192, 1186, 1182, 1187, 1172, 1170, 1181, 1174, 1186, 1177, 1183, 1184, 1171, 1190, 1181, 1184, 1188, 0, 1190, 1192, 1199, 1187, 1183, 1158, 1188, 1158, 1178, 1158, 1171, 1192, 1186, 1182, 1187, 1158, 1194, 1158, 1178, 1186, 1158, 1193, 1184, 1171, 1190, 1197, 1184, 1188, 1194, 1190, 1195, 1199, 1193, 1197, 1158, 1188, 1158, 1178, 1158, 1195, 1201, 1202, 1204, 0, 1158, 1194, 1158, 1178, 1198, 1158, 1193, 1200, 1198, 1207, 1197, 1206, 1200, 1194, 1207, 1195, 1203, 1193, 1197, 1206, 1203, 1208, 1205, 1209, 1195, 1201, 1202, 1204, 1205, 1211, 1212, 1210, 1212, 1198, 1209, 1214, 1200, 1198, 1207, 1210, 1206, 1200, 1213, 1207, 1217, 1203, 1213, 1216, 1206, 1203, 1208, 1205, 1209, 1215, 1222, 0, 1216, 1205, 1211, 1212, 1210, 1212, 1218, 1209, 1214, 1219, 1220, 1218, 1210, 1215, 1223, 1213, 1224, 1217, 1223, 1213, 1216, 1220, 1225, 1219, 1221, 1221, 1225, 1222, 1215, 1216, 1227, 1226, 1229, 1231, 1236, 1218, 1228, 1230, 1219, 1220, 1218, 1226, 1228, 1223, 1230, 1224, 1232, 1223, 1232, 0, 1220, 1225, 1219, 1221, 1221, 1225, 1233, 1215, 1234, 1227, 1226, 1235, 1231, 1236, 1239, 1228, 1230, 1233, 1234, 1229, 1226, 1228, 1235, 1230, 1237, 1232, 1240, 1232, 1238, 1241, 1242, 0, 1237, 1243, 1238, 1233, 1240, 1234, 1244, 0, 1235, 1245, 1244, 1239, 1254, 1246, 1233, 1234, 1229, 1246, 1245, 1235, 1249, 1237, 1242, 1240, 1249, 1238, 1241, 1248, 1242, 1237, 1243, 1238, 1242, 1240, 1247, 1244, 1250, 1248, 1245, 1244, 1250, 1254, 1246, 1251, 1252, 1247, 1246, 1245, 1252, 1249, 1259, 1242, 1255, 1249, 1253, 1257, 1248, 1242, 1251, 1256, 1253, 1242, 1256, 1247, 1257, 1250, 1248, 1258, 1255, 1250, 1261, 1258, 1251, 1252, 1247, 1263, 1260, 1252, 1262, 1259, 1260, 1264, 1255, 1253, 1257, 0, 1266, 1251, 1256, 1253, 1269, 1256, 1264, 1257, 1262, 1265, 1258, 1266, 1268, 1261, 1258, 1265, 1267, 1273, 1263, 1260, 1270, 1273, 1268, 1260, 1264, 1255, 1276, 1267, 1262, 1266, 1271, 1270, 1271, 1269, 1277, 1264, 1272, 1275, 1265, 1282, 1266, 1268, 1274, 1272, 1265, 1267, 1273, 1275, 2812, 1270, 1273, 1268, 1278, 2812, 1274, 1276, 1267, 1262, 1278, 1271, 1270, 1271, 1284, 1277, 1283, 1272, 1275, 1281, 1282, 1281, 1281, 1274, 1272, 1283, 0, 1279, 1275, 1279, 1279, 1285, 1279, 1278, 1281, 1274, 1286, 1288, 1290, 1278, 1292, 1294, 1291, 1284, 1290, 1283, 1291, 1293, 1295, 1296, 1281, 1292, 1293, 1297, 1283, 1279, 1300, 1301, 1298, 1302, 1285, 1297, 1303, 0, 1300, 1286, 1288, 1290, 1298, 1292, 1294, 1291, 1299, 1290, 1279, 1291, 1293, 1295, 1296, 1304, 1292, 1293, 1297, 1299, 1308, 1300, 1301, 1298, 1302, 1304, 1297, 1303, 1305, 1300, 1306, 1308, 1307, 1298, 1306, 1305, 1309, 1299, 1307, 1279, 1309, 1310, 1311, 1312, 1304, 1313, 1311, 1314, 1299, 1308, 1313, 1314, 1316, 1315, 1304, 1315, 0, 1305, 0, 1306, 1308, 1307, 1317, 1306, 1305, 1309, 0, 1307, 0, 1309, 1310, 1311, 1312, 1317, 1313, 1311, 1314, 1362, 2817, 1313, 1314, 1316, 1315, 2817, 1315, 1358, 1358, 1358, 1358, 1358, 1358, 1317, 1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319, 1319, 0, 1317, 1365, 1363, 1367, 1362, 1319, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 0, 0, 1365, 1368, 1372, 1373, 1320, 1321, 1321, 1321, 1321, 1321, 1321, 1321, 1321, 1321, 1363, 1367, 0, 0, 0, 1365, 1321, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1368, 1372, 1373, 0, 0, 0, 1322, 1325, 1325, 1325, 1325, 1325, 1325, 1325, 1325, 1325, 1364, 1369, 1365, 1364, 1369, 1374, 1376, 1325, 1325, 1325, 1325, 1325, 1325, 1327, 1327, 1327, 1327, 1327, 1327, 1327, 1327, 1328, 1328, 1328, 1328, 1328, 1328, 1328, 1328, 1364, 1369, 0, 1364, 1369, 1374, 1376, 1325, 1325, 1325, 1325, 1325, 1325, 1326, 1326, 1326, 1326, 1326, 1326, 1326, 1326, 1326, 1326, 0, 0, 0, 1377, 1378, 1379, 1326, 1326, 1326, 1326, 1326, 1326, 1329, 0, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1377, 1378, 1379, 1326, 1326, 1326, 1326, 1326, 1326, 1335, 1335, 1335, 1335, 1335, 1335, 1335, 1335, 1335, 1335, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1336, 1337, 1337, 1337, 1337, 1337, 1337, 1337, 1337, 1337, 1337, 1375, 1380, 1383, 1388, 1375, 1389, 1337, 1337, 1337, 1337, 1337, 1337, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1339, 1339, 1339, 1339, 1339, 1339, 1339, 1339, 0, 1375, 1380, 1383, 1388, 1375, 1389, 1337, 1337, 1337, 1337, 1337, 1337, 1340, 0, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1345, 0, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1345, 1346, 0, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1346, 1347, 0, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1347, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1348, 1350, 0, 1350, 1350, 1350, 1350, 1350, 1350, 1350, 1350, 1351, 0, 1351, 1351, 1351, 1351, 1351, 1351, 1351, 1351, 1352, 0, 1352, 1352, 1352, 1352, 1352, 1352, 1352, 1352, 1353, 1353, 1353, 1353, 1353, 1353, 1353, 1353, 1353, 1353, 1381, 1390, 1384, 1396, 1381, 1384, 1353, 1353, 1353, 1353, 1353, 1353, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1354, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 1356, 0, 1381, 1390, 1384, 1396, 1381, 1384, 1353, 1353, 1353, 1353, 1353, 1353, 1355, 1355, 1355, 1355, 1355, 1355, 1355, 1355, 1355, 1355, 1355, 0, 1400, 0, 1402, 0, 1370, 1355, 1355, 1355, 1355, 1355, 1355, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1357, 1366, 1370, 1371, 1386, 1382, 1393, 1385, 1386, 1371, 1382, 1400, 1366, 1402, 1393, 1370, 1355, 1355, 1355, 1355, 1355, 1355, 1385, 1387, 1401, 1409, 1403, 1387, 1401, 0, 1366, 1370, 1371, 1386, 1382, 1407, 1385, 1386, 1371, 1382, 1404, 1366, 1405, 1404, 1406, 1405, 1407, 1406, 1412, 0, 0, 1385, 1387, 1401, 1393, 1403, 1387, 1401, 1408, 1415, 1412, 1410, 1413, 1408, 1407, 1410, 1411, 1416, 1411, 1411, 1415, 1411, 1409, 1419, 1414, 1407, 1417, 1412, 1413, 1414, 1417, 1421, 1405, 1393, 1406, 1421, 1404, 1408, 1415, 1412, 1410, 1413, 1408, 1422, 1410, 1418, 1416, 1424, 1418, 1415, 0, 1409, 1419, 1414, 1427, 1417, 1411, 1413, 1414, 1417, 1421, 1405, 1420, 1406, 1421, 1404, 1425, 1420, 1423, 1426, 1425, 1428, 1422, 1432, 1418, 1426, 1424, 1418, 1429, 1423, 1431, 1430, 1429, 1427, 1428, 1411, 0, 1431, 1440, 1434, 1433, 1420, 1430, 1435, 0, 1425, 1420, 1423, 1426, 1425, 1428, 1433, 1432, 1440, 1426, 1434, 1435, 1429, 1423, 1441, 1430, 1429, 1436, 1428, 1436, 1441, 1437, 1431, 1442, 1433, 1443, 1430, 1435, 1434, 1437, 1438, 1444, 1439, 1443, 1438, 1433, 1439, 1440, 1445, 1447, 1435, 1449, 1446, 1441, 1448, 1450, 1436, 1454, 1436, 1441, 1437, 1431, 1442, 1446, 1443, 1448, 1459, 1434, 1437, 1438, 1444, 1439, 1443, 1438, 1452, 1439, 1451, 1445, 1447, 1451, 1449, 1446, 1453, 1448, 1450, 1452, 1454, 1457, 1453, 1458, 1455, 1461, 1446, 1456, 1448, 1459, 0, 1460, 1456, 1457, 1462, 1463, 1460, 1452, 1464, 1451, 1455, 1468, 1451, 1466, 1468, 1453, 1465, 1458, 1452, 0, 1457, 1453, 0, 1465, 1461, 1469, 1456, 1472, 1479, 1455, 1460, 1456, 1457, 1462, 1463, 1460, 1472, 1464, 1467, 1466, 1468, 1469, 1473, 1468, 1467, 1465, 1458, 1470, 1467, 1467, 1471, 1473, 1465, 1469, 1471, 1480, 1472, 1479, 1455, 1474, 1475, 0, 0, 1470, 1475, 1472, 1476, 1467, 1466, 1476, 1477, 1473, 1481, 1467, 1477, 1474, 1470, 1467, 1467, 1471, 1473, 1482, 1469, 1471, 1480, 1484, 1482, 1483, 1481, 1475, 1474, 1483, 1470, 1475, 1487, 1476, 1488, 1485, 1476, 1477, 1486, 1481, 1478, 1477, 1478, 1478, 1485, 1478, 1486, 1489, 1482, 1491, 1497, 0, 1493, 1482, 1483, 1481, 1493, 1474, 1483, 1494, 1484, 1487, 1500, 1488, 1485, 1494, 1495, 1486, 1478, 1496, 1495, 1484, 1496, 1485, 1503, 1486, 1489, 1500, 1491, 1497, 1478, 1493, 1498, 1502, 1498, 1493, 1502, 1478, 1494, 1484, 1478, 1478, 1499, 1501, 1494, 1495, 1499, 1501, 1496, 1495, 1484, 1496, 1504, 1503, 1505, 1506, 1500, 1507, 1505, 1478, 1509, 1498, 1502, 1498, 1509, 1502, 1478, 1508, 1511, 1478, 1478, 1499, 1501, 1514, 1511, 1499, 1501, 1512, 1510, 1508, 1510, 1504, 1512, 1505, 1506, 1515, 1507, 1505, 1513, 1509, 1516, 1517, 1513, 1509, 1516, 0, 1508, 1511, 2313, 0, 2313, 2313, 1514, 1511, 0, 0, 1512, 1510, 1508, 1510, 0, 1512, 0, 1990, 1515, 1990, 1990, 1513, 1990, 1516, 1517, 1513, 1990, 1516, 1519, 1519, 1519, 1519, 1519, 1519, 1519, 1519, 1531, 1531, 1531, 1531, 1531, 1531, 1519, 1520, 1520, 1520, 1520, 1520, 1520, 1520, 1520, 1538, 1538, 1538, 1538, 1538, 1538, 1520, 1521, 1521, 1521, 1521, 1521, 1521, 1521, 1521, 1521, 1547, 1547, 1547, 1547, 1547, 1547, 1521, 1522, 1522, 1522, 1522, 1522, 1522, 1522, 1522, 1522, 0, 0, 0, 1570, 0, 1575, 1522, 1523, 1523, 1523, 1523, 1523, 1523, 1523, 1523, 1523, 0, 1572, 0, 0, 0, 0, 1523, 1524, 1524, 1524, 1524, 1524, 1524, 1524, 1524, 1524, 1570, 1572, 1575, 0, 0, 0, 1524, 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1574, 1576, 1577, 1572, 1574, 1576, 1528, 1528, 1528, 1528, 1528, 1528, 1529, 1529, 1529, 1529, 1529, 1529, 1529, 1529, 1530, 1530, 1530, 1530, 1530, 1530, 1530, 1530, 0, 1574, 1576, 1577, 1572, 1574, 1576, 1528, 1528, 1528, 1528, 1528, 1528, 1532, 0, 1532, 1532, 1532, 1532, 1532, 1532, 1532, 1532, 1533, 1533, 1533, 1533, 1533, 1533, 1533, 1533, 1533, 1533, 1578, 1579, 1581, 1582, 1583, 1584, 1533, 1533, 1533, 1533, 1533, 1533, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1534, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536, 1585, 1578, 1579, 1581, 1582, 1583, 1584, 1533, 1533, 1533, 1533, 1533, 1533, 1535, 1535, 1535, 1535, 1535, 1535, 1535, 1535, 1535, 1535, 1535, 1586, 1592, 1593, 1598, 1600, 1585, 1535, 1535, 1535, 1535, 1535, 1535, 1537, 1537, 1537, 1537, 1537, 1537, 1537, 1537, 1543, 1543, 1543, 1543, 1543, 1543, 1543, 1543, 0, 1586, 1592, 1593, 1598, 1600, 0, 1535, 1535, 1535, 1535, 1535, 1535, 1542, 1542, 1542, 1542, 1542, 1542, 1542, 1542, 1542, 1542, 1587, 1590, 1601, 1602, 1587, 1590, 1542, 1542, 1542, 1542, 1542, 1542, 1545, 1545, 1545, 1545, 1545, 1545, 1545, 1545, 1546, 1546, 1546, 1546, 1546, 1546, 1546, 1546, 0, 1587, 1590, 1601, 1602, 1587, 1590, 1542, 1542, 1542, 1542, 1542, 1542, 1544, 1544, 1544, 1544, 1544, 1544, 1544, 1544, 1544, 1544, 1544, 0, 1597, 1604, 1604, 1605, 1597, 1544, 1544, 1544, 1544, 1544, 1544, 1551, 1551, 1551, 1551, 1551, 1551, 1551, 1551, 1552, 0, 1552, 1552, 1552, 1552, 1552, 1552, 1552, 1552, 1597, 1604, 1604, 1605, 1597, 1544, 1544, 1544, 1544, 1544, 1544, 1553, 0, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1553, 1554, 0, 1554, 1554, 1554, 1554, 1554, 1554, 1555, 1555, 1555, 1555, 1555, 1555, 1555, 1555, 1556, 0, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1556, 1557, 0, 1557, 1557, 1557, 1557, 1557, 1557, 1557, 1557, 1558, 0, 1558, 1558, 1558, 1558, 1558, 1558, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1559, 1560, 1560, 1560, 1560, 1560, 1560, 1560, 1560, 1560, 1560, 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1561, 1562, 1562, 1562, 1562, 1562, 1562, 1562, 1562, 1563, 1563, 1563, 1563, 1563, 1563, 1563, 1563, 1563, 1563, 1606, 1607, 0, 1610, 1611, 0, 1563, 1563, 1563, 1563, 1563, 1563, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1564, 1565, 1565, 1565, 1565, 1565, 1565, 1565, 1565, 1599, 1606, 1607, 1599, 1610, 1611, 1589, 1563, 1563, 1563, 1563, 1563, 1563, 1566, 1589, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1566, 1571, 1571, 0, 1588, 1591, 1580, 1571, 1612, 1571, 1571, 1571, 1580, 1589, 1603, 1591, 1608, 1613, 0, 1588, 1571, 1589, 1571, 1571, 1571, 1571, 1571, 1614, 1599, 1615, 1603, 1596, 1571, 1588, 1591, 1580, 1608, 1612, 1596, 0, 1609, 1580, 0, 1603, 1591, 1616, 1613, 1609, 1588, 1618, 1608, 0, 0, 1571, 1571, 1571, 1614, 1599, 1615, 1603, 1621, 1571, 1573, 1573, 1596, 1608, 1622, 1623, 1573, 1609, 1573, 1573, 1573, 1624, 1616, 1625, 1609, 1617, 1618, 1608, 1596, 1573, 1622, 1573, 1573, 1573, 1573, 1573, 1625, 1621, 1627, 1629, 1573, 1596, 1631, 1622, 1623, 1617, 1626, 1633, 1634, 1629, 1624, 0, 1625, 1635, 1632, 1630, 1636, 1596, 1632, 1617, 0, 1633, 1573, 1573, 1573, 1625, 1626, 1627, 1629, 1573, 1630, 1631, 1622, 1639, 1617, 1641, 1633, 1634, 1629, 1640, 1626, 1642, 1635, 1632, 1630, 1636, 1643, 1632, 1617, 1637, 1633, 1642, 1646, 1648, 1640, 1626, 1644, 1645, 1637, 1630, 1649, 1647, 1639, 1650, 1641, 1647, 1651, 1651, 1640, 1626, 1642, 1652, 1644, 1645, 1653, 1643, 1649, 1657, 1637, 0, 1642, 1646, 1648, 1640, 1662, 1655, 1645, 1637, 1644, 1655, 1647, 0, 1650, 1656, 1647, 1651, 1651, 1656, 1665, 0, 1652, 1649, 1645, 1653, 0, 1658, 1657, 1658, 1658, 1660, 1658, 1660, 1660, 1662, 1655, 1661, 1663, 1644, 1655, 1664, 1663, 1666, 1656, 0, 1660, 1668, 1656, 1665, 1661, 1664, 1649, 1669, 1667, 1658, 1667, 1669, 1670, 1671, 1672, 1673, 1660, 1674, 1675, 1677, 1661, 1663, 1675, 1678, 1664, 1663, 1666, 1671, 1658, 1676, 1668, 1676, 1679, 1661, 1664, 1681, 1669, 1667, 1684, 1667, 1669, 1670, 1671, 1672, 1673, 1681, 1674, 1675, 1677, 1680, 1686, 1675, 1678, 1683, 1683, 1685, 1671, 1658, 1676, 1687, 1676, 1679, 1680, 1688, 1681, 1689, 1685, 1684, 1690, 1692, 1693, 1694, 1691, 1750, 1681, 1689, 1755, 1755, 1680, 1686, 1756, 1695, 1683, 1683, 1685, 1691, 1694, 0, 1687, 0, 0, 1680, 1688, 0, 1689, 1685, 1695, 1690, 1692, 1693, 1694, 1691, 1750, 0, 1689, 1755, 1755, 0, 0, 1756, 1695, 0, 1757, 0, 1691, 1694, 1702, 1702, 1702, 1702, 1702, 1702, 1702, 1702, 0, 1695, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1746, 1746, 1746, 1746, 1746, 1746, 1757, 1700, 1700, 1700, 1700, 1700, 1700, 1703, 1703, 1703, 1703, 1703, 1703, 1703, 1703, 1704, 0, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 0, 0, 0, 0, 0, 1700, 1700, 1700, 1700, 1700, 1700, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 1701, 0, 0, 0, 1758, 1759, 1760, 1701, 1701, 1701, 1701, 1701, 1701, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1709, 1710, 1710, 1710, 1710, 1710, 1710, 1710, 1710, 1710, 1710, 1758, 1759, 1760, 1701, 1701, 1701, 1701, 1701, 1701, 1711, 1711, 1711, 1711, 1711, 1711, 1711, 1711, 1711, 1711, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1761, 1762, 1764, 1766, 1768, 1768, 1712, 1712, 1712, 1712, 1712, 1712, 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 1714, 0, 1761, 1762, 1764, 1766, 1768, 1768, 1712, 1712, 1712, 1712, 1712, 1712, 1715, 0, 1715, 1715, 1715, 1715, 1715, 1715, 1715, 1715, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1719, 1720, 1720, 1720, 1720, 1720, 1720, 1720, 1720, 1720, 1720, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1721, 1722, 1722, 1722, 1722, 1722, 1722, 1722, 1722, 1722, 1722, 1763, 1771, 1775, 1777, 1763, 1784, 1722, 1722, 1722, 1722, 1722, 1722, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1723, 1724, 1724, 1724, 1724, 1724, 1724, 1724, 1724, 0, 1763, 1771, 1775, 1777, 1763, 1784, 1722, 1722, 1722, 1722, 1722, 1722, 1725, 0, 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1725, 1729, 1729, 1729, 1729, 1729, 1729, 1729, 1729, 1729, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1730, 1731, 1731, 1731, 1731, 1731, 1731, 1731, 1731, 1731, 1732, 1732, 1732, 1732, 1732, 1732, 1732, 1732, 1732, 1734, 0, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1734, 1735, 0, 1735, 1735, 1735, 1735, 1735, 1735, 1735, 1735, 1736, 0, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1738, 0, 1738, 1738, 1738, 1738, 1738, 1738, 1738, 1738, 1739, 0, 1739, 1739, 1739, 1739, 1739, 1739, 1739, 1739, 1740, 0, 1740, 1740, 1740, 1740, 1740, 1740, 1740, 1740, 1741, 1741, 1741, 1741, 1741, 1741, 1741, 1741, 1741, 1741, 1769, 1783, 1783, 1786, 1789, 1769, 1741, 1741, 1741, 1741, 1741, 1741, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1742, 1744, 1744, 1744, 1744, 1744, 1744, 1744, 1744, 1801, 1769, 1783, 1783, 1786, 1789, 1769, 1741, 1741, 1741, 1741, 1741, 1741, 1743, 1743, 1743, 1743, 1743, 1743, 1743, 1743, 1743, 1743, 1743, 0, 0, 1794, 1794, 0, 1801, 1743, 1743, 1743, 1743, 1743, 1743, 1745, 1745, 1745, 1745, 1745, 1745, 1745, 1745, 0, 1781, 1788, 1803, 1765, 0, 1770, 1752, 0, 1754, 1765, 1794, 1794, 1770, 0, 1743, 1743, 1743, 1743, 1743, 1743, 1751, 1751, 1752, 1752, 1754, 0, 1751, 1767, 1751, 1751, 1751, 1803, 1765, 1778, 1781, 1788, 1776, 1754, 1765, 1751, 1767, 1751, 1751, 1751, 1751, 1751, 0, 1778, 1751, 0, 0, 1776, 1752, 1754, 1770, 0, 1767, 0, 0, 0, 1773, 1780, 1778, 1781, 1788, 1776, 1780, 1773, 0, 1767, 0, 0, 1751, 1751, 1751, 1782, 1778, 1751, 1753, 1753, 1776, 1779, 1796, 1770, 1753, 1782, 1753, 1753, 1753, 1773, 1780, 1787, 1793, 0, 1779, 1780, 1773, 1753, 1787, 1753, 1753, 1753, 1753, 1753, 1782, 1791, 1785, 1792, 1793, 1793, 1779, 1785, 1806, 1791, 1782, 1792, 1796, 0, 1795, 1805, 1787, 1799, 1753, 1779, 1791, 1813, 1799, 1787, 1802, 1800, 1753, 1753, 1753, 1795, 1802, 1785, 1809, 1807, 1793, 1800, 1785, 1806, 1807, 1808, 1808, 1796, 1791, 1795, 1792, 0, 1799, 1753, 1809, 1805, 1813, 1799, 1818, 1802, 1800, 1810, 1810, 1820, 1795, 1802, 1811, 1820, 1807, 1809, 1800, 1823, 1811, 1807, 1808, 1808, 1816, 1791, 1825, 1792, 1815, 1815, 1816, 1821, 1805, 0, 1823, 1818, 1822, 1821, 1810, 1810, 1820, 1822, 1827, 1811, 1820, 1828, 1809, 1829, 1823, 1811, 1824, 1824, 1830, 1816, 1831, 1825, 1826, 1815, 1815, 1816, 1821, 1835, 1826, 1823, 1836, 1822, 1821, 1832, 1832, 1837, 1822, 1827, 1833, 1833, 1828, 1838, 1829, 1838, 1834, 1824, 1824, 1830, 1834, 1831, 1841, 1826, 1842, 1837, 1844, 1847, 1835, 1826, 1848, 1836, 1845, 1845, 1832, 1832, 1837, 1846, 1846, 1833, 1833, 1849, 1838, 0, 1838, 1834, 2676, 2676, 2676, 1834, 0, 1841, 2676, 1842, 1837, 1844, 1847, 0, 0, 1848, 0, 1845, 1845, 2759, 2759, 0, 1846, 1846, 2759, 0, 1849, 1854, 1854, 1854, 1854, 1854, 1854, 1854, 1854, 1854, 1854, 1854, 1857, 1857, 1857, 1857, 1857, 1857, 1854, 1854, 1854, 1854, 1854, 1854, 1855, 1855, 1855, 1855, 1855, 1855, 1855, 1855, 1856, 1856, 1856, 1856, 1856, 1856, 1856, 1856, 1864, 1864, 1864, 1864, 1864, 1864, 0, 1854, 1854, 1854, 1854, 1854, 1854, 1858, 0, 1858, 1858, 1858, 1858, 1858, 1858, 1858, 1858, 1859, 1859, 1859, 1859, 1859, 1859, 1859, 1859, 1859, 1859, 1873, 1873, 1873, 1873, 1873, 1873, 1859, 1859, 1859, 1859, 1859, 1859, 1860, 1860, 1860, 1860, 1860, 1860, 1860, 1860, 1862, 1862, 1862, 1862, 1862, 1862, 1862, 1862, 1882, 1882, 1882, 1882, 1882, 1882, 0, 1859, 1859, 1859, 1859, 1859, 1859, 1861, 1861, 1861, 1861, 1861, 1861, 1861, 1861, 1861, 1861, 1861, 1909, 1913, 1914, 1915, 1916, 1917, 1861, 1861, 1861, 1861, 1861, 1861, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 1863, 1869, 1869, 1869, 1869, 1869, 1869, 1869, 1869, 0, 1909, 1913, 1914, 1915, 1916, 1917, 1861, 1861, 1861, 1861, 1861, 1861, 1868, 1868, 1868, 1868, 1868, 1868, 1868, 1868, 1868, 1868, 1919, 1921, 1922, 1923, 1924, 1925, 1868, 1868, 1868, 1868, 1868, 1868, 1871, 1871, 1871, 1871, 1871, 1871, 1871, 1871, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1872, 1926, 1919, 1921, 1922, 1923, 1924, 1925, 1868, 1868, 1868, 1868, 1868, 1868, 1870, 1870, 1870, 1870, 1870, 1870, 1870, 1870, 1870, 1870, 1870, 1930, 1932, 1936, 1937, 1938, 1926, 1870, 1870, 1870, 1870, 1870, 1870, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1880, 1880, 1880, 1880, 1880, 1880, 1880, 1880, 0, 1930, 1932, 1936, 1937, 1938, 0, 1870, 1870, 1870, 1870, 1870, 1870, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1940, 1941, 1942, 1954, 1955, 1956, 1877, 1877, 1877, 1877, 1877, 1877, 1881, 1881, 1881, 1881, 1881, 1881, 1881, 1881, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1886, 1940, 1941, 1942, 1954, 1955, 1956, 1877, 1877, 1877, 1877, 1877, 1877, 1879, 1879, 1879, 1879, 1879, 1879, 1879, 1879, 1879, 1879, 1879, 0, 1957, 1963, 1964, 1967, 1968, 1879, 1879, 1879, 1879, 1879, 1879, 1887, 1887, 1887, 1887, 1887, 1887, 1887, 1887, 1887, 1888, 1888, 1888, 1888, 1888, 1888, 1888, 1888, 1888, 1957, 1963, 1964, 1967, 1968, 1879, 1879, 1879, 1879, 1879, 1879, 1889, 1889, 1889, 1889, 1889, 1889, 1889, 1889, 1889, 1890, 1890, 1890, 1890, 1890, 1890, 1890, 1890, 1891, 0, 1891, 1891, 1891, 1891, 1891, 1891, 1891, 1891, 1892, 0, 1892, 1892, 1892, 1892, 1892, 1892, 1892, 1892, 1893, 0, 1893, 1893, 1893, 1893, 1893, 1893, 1894, 1894, 1894, 1894, 1894, 1894, 1894, 1894, 1895, 0, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1895, 1896, 0, 1896, 1896, 1896, 1896, 1896, 1896, 1896, 1896, 1897, 0, 1897, 1897, 1897, 1897, 1897, 1897, 1898, 1898, 1898, 1898, 1898, 1898, 1898, 1898, 1898, 1898, 1899, 1899, 1899, 1899, 1899, 1899, 1899, 1899, 1899, 1899, 1900, 1900, 1900, 1900, 1900, 1900, 1900, 1900, 1900, 1900, 1901, 1901, 1901, 1901, 1901, 1901, 1901, 1901, 1902, 1902, 1902, 1902, 1902, 1902, 1902, 1902, 1902, 1902, 1969, 1970, 1973, 1974, 1975, 1976, 1902, 1902, 1902, 1902, 1902, 1902, 1903, 1903, 1903, 1903, 1903, 1903, 1903, 1903, 1904, 1904, 1904, 1904, 1904, 1904, 1904, 1904, 0, 1969, 1970, 1973, 1974, 1975, 1976, 1902, 1902, 1902, 1902, 1902, 1902, 1905, 1911, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1905, 1910, 1910, 0, 1943, 1945, 1946, 1910, 1911, 1910, 1910, 1910, 1943, 1945, 1946, 1977, 1950, 0, 1979, 0, 1910, 1949, 1910, 1910, 1910, 1910, 1910, 1947, 1911, 1949, 1981, 1910, 1950, 2760, 2760, 1947, 1982, 1983, 2760, 0, 0, 0, 0, 1946, 1977, 1943, 1945, 1979, 1962, 1984, 0, 0, 1950, 1910, 1910, 1910, 0, 1911, 1949, 1981, 1910, 1912, 1912, 1958, 1962, 1982, 1983, 1912, 1947, 1912, 1912, 1912, 1946, 1985, 1943, 1945, 1962, 1987, 1984, 1958, 1912, 1950, 1912, 1912, 1912, 1912, 1912, 1949, 1988, 1995, 1995, 1995, 1995, 1995, 1995, 1995, 1995, 1947, 1958, 2762, 2762, 0, 1985, 0, 2762, 1962, 1987, 2050, 2050, 2050, 2050, 2050, 2050, 1912, 1912, 1912, 0, 1988, 1996, 1996, 1996, 1996, 1996, 1996, 1996, 1996, 0, 1958, 1993, 1993, 1993, 1993, 1993, 1993, 1993, 1993, 1993, 0, 0, 0, 0, 2054, 2058, 2059, 1993, 1993, 1993, 1993, 1993, 1993, 1997, 0, 1997, 1997, 1997, 1997, 1997, 1997, 1997, 1997, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2002, 2054, 2058, 2059, 1993, 1993, 1993, 1993, 1993, 1993, 1994, 1994, 1994, 1994, 1994, 1994, 1994, 1994, 1994, 1994, 0, 0, 0, 2060, 2061, 2062, 1994, 1994, 1994, 1994, 1994, 1994, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2003, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2004, 2060, 2061, 2062, 1994, 1994, 1994, 1994, 1994, 1994, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2005, 2063, 2064, 2065, 2066, 2067, 2069, 2005, 2005, 2005, 2005, 2005, 2005, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2006, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 0, 2063, 2064, 2065, 2066, 2067, 2069, 2005, 2005, 2005, 2005, 2005, 2005, 2008, 0, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2013, 2013, 2013, 2013, 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, 2071, 2074, 2071, 2081, 2083, 2087, 2015, 2015, 2015, 2015, 2015, 2015, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2016, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 0, 2071, 2074, 2071, 2081, 2083, 2087, 2015, 2015, 2015, 2015, 2015, 2015, 2018, 0, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2085, 2085, 2091, 2091, 2093, 2094, 2025, 2025, 2025, 2025, 2025, 2025, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2026, 2027, 2027, 2027, 2027, 2027, 2027, 2027, 2027, 0, 2085, 2085, 2091, 2091, 2093, 2094, 2025, 2025, 2025, 2025, 2025, 2025, 2028, 0, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2036, 2036, 2036, 2036, 2036, 2036, 2036, 2036, 2036, 2038, 0, 2038, 2038, 2038, 2038, 2038, 2038, 2038, 2038, 2039, 0, 2039, 2039, 2039, 2039, 2039, 2039, 2039, 2039, 2040, 0, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2040, 2042, 0, 2042, 2042, 2042, 2042, 2042, 2042, 2042, 2042, 2043, 0, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2044, 0, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2088, 2095, 2098, 2095, 2099, 2088, 2045, 2045, 2045, 2045, 2045, 2045, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 0, 2088, 2095, 2098, 2095, 2099, 2088, 2045, 2045, 2045, 2045, 2045, 2045, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2102, 0, 2104, 0, 2105, 2072, 2047, 2047, 2047, 2047, 2047, 2047, 2049, 2049, 2049, 2049, 2049, 2049, 2049, 2049, 2079, 0, 0, 2072, 2068, 0, 2075, 0, 2079, 2102, 2056, 2104, 2068, 2105, 2072, 2047, 2047, 2047, 2047, 2047, 2047, 2055, 2055, 2073, 2075, 2107, 2056, 2055, 2077, 2055, 2055, 2055, 2072, 2068, 2073, 2075, 2077, 2079, 0, 0, 2055, 2068, 2055, 2055, 2055, 2055, 2055, 2056, 2076, 2108, 2086, 2109, 2073, 2075, 2107, 2076, 2086, 2092, 2097, 2097, 2179, 2103, 2092, 2073, 2055, 0, 2079, 2090, 2103, 2077, 0, 0, 0, 2055, 2055, 2055, 2056, 2076, 2108, 2086, 2109, 0, 2183, 2090, 2076, 2086, 2092, 2097, 2097, 2179, 2103, 2092, 2090, 2055, 2057, 2057, 2096, 2103, 2077, 2100, 2057, 2096, 2057, 2057, 2057, 2100, 0, 2106, 2185, 2106, 2106, 2183, 2106, 2057, 0, 2057, 2057, 2057, 2057, 2057, 0, 2090, 2181, 0, 2110, 2096, 2110, 2110, 2100, 2110, 2096, 2763, 2763, 2110, 2100, 2106, 2763, 2185, 2181, 2057, 2118, 2118, 2118, 2118, 2118, 2118, 2057, 2057, 2057, 2116, 2116, 2116, 2116, 2116, 2116, 2116, 2116, 2181, 2106, 2117, 2117, 2117, 2117, 2117, 2117, 2117, 2117, 2119, 2057, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 0, 2181, 2106, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2125, 2125, 2125, 2125, 2125, 2125, 2114, 2114, 2114, 2114, 2114, 2114, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2124, 2124, 2124, 2124, 2124, 2124, 2124, 2124, 2134, 2134, 2134, 2134, 2134, 2134, 0, 2114, 2114, 2114, 2114, 2114, 2114, 2115, 2115, 2115, 2115, 2115, 2115, 2115, 2115, 2115, 2115, 2115, 2143, 2143, 2143, 2143, 2143, 2143, 2115, 2115, 2115, 2115, 2115, 2115, 2130, 2130, 2130, 2130, 2130, 2130, 2130, 2130, 2132, 2132, 2132, 2132, 2132, 2132, 2132, 2132, 2152, 2152, 2152, 2152, 2152, 2152, 0, 2115, 2115, 2115, 2115, 2115, 2115, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2120, 2186, 2187, 2188, 2189, 2191, 2192, 2120, 2120, 2120, 2120, 2120, 2120, 2133, 2133, 2133, 2133, 2133, 2133, 2133, 2133, 2139, 2139, 2139, 2139, 2139, 2139, 2139, 2139, 2193, 2186, 2187, 2188, 2189, 2191, 2192, 2120, 2120, 2120, 2120, 2120, 2120, 2122, 2122, 2122, 2122, 2122, 2122, 2122, 2122, 2122, 2122, 2122, 2198, 2200, 2203, 2205, 2198, 2193, 2122, 2122, 2122, 2122, 2122, 2122, 2141, 2141, 2141, 2141, 2141, 2141, 2141, 2141, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 0, 2198, 2200, 2203, 2205, 2198, 0, 2122, 2122, 2122, 2122, 2122, 2122, 2129, 2129, 2129, 2129, 2129, 2129, 2129, 2129, 2129, 2129, 2210, 2211, 2214, 2214, 2216, 2217, 2129, 2129, 2129, 2129, 2129, 2129, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2219, 2210, 2211, 2214, 2214, 2216, 2217, 2129, 2129, 2129, 2129, 2129, 2129, 2131, 2131, 2131, 2131, 2131, 2131, 2131, 2131, 2131, 2131, 2131, 2212, 2300, 2304, 2305, 2212, 2219, 2131, 2131, 2131, 2131, 2131, 2131, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2156, 2156, 2156, 2156, 2156, 2156, 2156, 2156, 2156, 2212, 2300, 2304, 2305, 2212, 0, 2131, 2131, 2131, 2131, 2131, 2131, 2138, 2138, 2138, 2138, 2138, 2138, 2138, 2138, 2138, 2138, 2227, 2227, 2227, 2227, 2227, 2227, 2138, 2138, 2138, 2138, 2138, 2138, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2158, 2158, 2158, 2158, 2158, 2158, 2158, 2158, 2158, 0, 0, 0, 0, 0, 2138, 2138, 2138, 2138, 2138, 2138, 2140, 2140, 2140, 2140, 2140, 2140, 2140, 2140, 2140, 2140, 2140, 2296, 2296, 2296, 2296, 2296, 2296, 2140, 2140, 2140, 2140, 2140, 2140, 2159, 2159, 2159, 2159, 2159, 2159, 2159, 2159, 2159, 2160, 2160, 2160, 2160, 2160, 2160, 2160, 2160, 2767, 2767, 0, 0, 0, 2767, 2140, 2140, 2140, 2140, 2140, 2140, 2147, 2147, 2147, 2147, 2147, 2147, 2147, 2147, 2147, 2147, 0, 0, 0, 2306, 2317, 2318, 2147, 2147, 2147, 2147, 2147, 2147, 2161, 0, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2161, 2162, 2204, 2162, 2162, 2162, 2162, 2162, 2162, 2162, 2162, 2306, 2317, 2318, 2147, 2147, 2147, 2147, 2147, 2147, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2220, 2323, 2220, 2220, 2204, 2220, 2149, 2149, 2149, 2149, 2149, 2149, 2163, 2387, 2163, 2163, 2163, 2163, 2163, 2163, 2164, 2164, 2164, 2164, 2164, 2164, 2164, 2164, 2220, 0, 2323, 0, 0, 2204, 0, 2149, 2149, 2149, 2149, 2149, 2149, 2165, 2387, 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, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2170, 2170, 2170, 2170, 2170, 2170, 2170, 2170, 2170, 2170, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2221, 2391, 2221, 2221, 2392, 2221, 2172, 2172, 2172, 2172, 2172, 2172, 2173, 2173, 2173, 2173, 2173, 2173, 2173, 2173, 2174, 2174, 2174, 2174, 2174, 2174, 2174, 2174, 2221, 0, 2391, 0, 0, 2392, 0, 2172, 2172, 2172, 2172, 2172, 2172, 2175, 2194, 2175, 2175, 2175, 2175, 2175, 2175, 2175, 2175, 2180, 2180, 2195, 0, 2310, 0, 2180, 2194, 2180, 2180, 2180, 2197, 2206, 2207, 2310, 2208, 0, 2195, 2209, 2180, 2194, 2180, 2180, 2180, 2180, 2180, 2213, 2197, 2206, 2207, 2208, 2195, 2207, 2310, 2209, 2393, 2194, 2398, 0, 0, 2197, 2206, 2213, 2310, 2208, 2180, 2195, 2209, 2311, 0, 2312, 2399, 2180, 2180, 2180, 2213, 2197, 2206, 2311, 2208, 2312, 2207, 2320, 2209, 2393, 2218, 2398, 2218, 2218, 0, 2218, 2213, 0, 2400, 2180, 2182, 2182, 2311, 2320, 2312, 2399, 2182, 0, 2182, 2182, 2182, 0, 2311, 0, 2312, 0, 0, 0, 2218, 2182, 2401, 2182, 2182, 2182, 2182, 2182, 2218, 2400, 2320, 2225, 2182, 2225, 2225, 2225, 2225, 2225, 2225, 2225, 2225, 2225, 2226, 2226, 2226, 2226, 2226, 2226, 2226, 2226, 0, 2401, 0, 0, 2182, 2182, 2182, 2218, 0, 2320, 0, 2182, 2228, 2228, 2228, 2228, 2228, 2228, 2228, 2228, 2228, 0, 0, 2396, 2397, 2403, 2396, 2397, 2228, 2228, 2228, 2228, 2228, 2228, 2232, 2232, 2232, 2232, 2232, 2232, 2232, 2232, 2233, 0, 2233, 2233, 2233, 2233, 2233, 2233, 2233, 2233, 2396, 2397, 2403, 2396, 2397, 2228, 2228, 2228, 2228, 2228, 2228, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 0, 0, 0, 2404, 2406, 2462, 2230, 2230, 2230, 2230, 2230, 2230, 2238, 2238, 2238, 2238, 2238, 2238, 2238, 2238, 2238, 2238, 2239, 2239, 2239, 2239, 2239, 2239, 2239, 2239, 2239, 2239, 2404, 2406, 2462, 2230, 2230, 2230, 2230, 2230, 2230, 2240, 2240, 2240, 2240, 2240, 2240, 2240, 2240, 2240, 2240, 2241, 2241, 2241, 2241, 2241, 2241, 2241, 2241, 2241, 2241, 0, 2407, 2463, 2466, 2468, 2407, 2241, 2241, 2241, 2241, 2241, 2241, 2243, 2243, 2243, 2243, 2243, 2243, 2243, 2243, 2244, 0, 2244, 2244, 2244, 2244, 2244, 2244, 2244, 2244, 2407, 2463, 2466, 2468, 2407, 2241, 2241, 2241, 2241, 2241, 2241, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2249, 2249, 2249, 2249, 2249, 2249, 2249, 2249, 2249, 2249, 2250, 2250, 2250, 2250, 2250, 2250, 2250, 2250, 2250, 2250, 2251, 2251, 2251, 2251, 2251, 2251, 2251, 2251, 2251, 2251, 0, 2464, 2471, 2472, 2464, 2526, 2251, 2251, 2251, 2251, 2251, 2251, 2253, 2253, 2253, 2253, 2253, 2253, 2253, 2253, 2254, 0, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2254, 2464, 2471, 2472, 2464, 2526, 2251, 2251, 2251, 2251, 2251, 2251, 2258, 2258, 2258, 2258, 2258, 2258, 2258, 2258, 2258, 2258, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 2261, 0, 2469, 2521, 2521, 2528, 2469, 2261, 2261, 2261, 2261, 2261, 2261, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2263, 2264, 0, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2469, 2521, 2521, 2528, 2469, 2261, 2261, 2261, 2261, 2261, 2261, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2269, 2269, 2269, 2269, 2269, 2269, 2269, 2269, 2269, 2269, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2271, 2271, 2271, 2271, 2271, 2271, 2271, 2271, 2271, 2271, 0, 2470, 2567, 2568, 2569, 2470, 2271, 2271, 2271, 2271, 2271, 2271, 2273, 2273, 2273, 2273, 2273, 2273, 2273, 2273, 2274, 0, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2470, 2567, 2568, 2569, 2470, 2271, 2271, 2271, 2271, 2271, 2271, 2278, 2278, 2278, 2278, 2278, 2278, 2278, 2278, 2278, 2279, 2279, 2279, 2279, 2279, 2279, 2279, 2279, 2279, 2280, 2280, 2280, 2280, 2280, 2280, 2280, 2280, 2280, 2281, 2281, 2281, 2281, 2281, 2281, 2281, 2281, 2281, 2282, 2282, 2282, 2282, 2282, 2282, 2282, 2282, 2282, 2284, 0, 2284, 2284, 2284, 2284, 2284, 2284, 2284, 2284, 2285, 0, 2285, 2285, 2285, 2285, 2285, 2285, 2285, 2285, 2286, 0, 2286, 2286, 2286, 2286, 2286, 2286, 2286, 2286, 2288, 0, 2288, 2288, 2288, 2288, 2288, 2288, 2288, 2288, 2289, 0, 2289, 2289, 2289, 2289, 2289, 2289, 2289, 2289, 2290, 0, 2290, 2290, 2290, 2290, 2290, 2290, 2290, 2290, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2291, 2327, 2570, 2327, 2327, 2571, 2327, 2291, 2291, 2291, 2291, 2291, 2291, 2292, 2292, 2292, 2292, 2292, 2292, 2292, 2292, 2294, 2294, 2294, 2294, 2294, 2294, 2294, 2294, 2327, 2328, 2570, 2328, 2328, 2571, 2328, 2291, 2291, 2291, 2291, 2291, 2291, 2293, 2293, 2293, 2293, 2293, 2293, 2293, 2293, 2293, 2293, 2293, 2520, 2590, 2600, 2601, 2520, 2328, 2293, 2293, 2293, 2293, 2293, 2293, 2295, 2295, 2295, 2295, 2295, 2295, 2295, 2295, 2330, 2330, 2330, 2330, 2330, 2330, 2330, 2330, 0, 2520, 2590, 2600, 2601, 2520, 0, 2293, 2293, 2293, 2293, 2293, 2293, 2301, 2301, 2314, 2315, 2319, 0, 2301, 2390, 2301, 2301, 2301, 0, 2314, 2315, 2319, 2390, 2321, 2315, 2319, 2301, 2324, 2301, 2301, 2301, 2301, 2301, 2321, 2324, 2475, 2326, 2324, 2314, 2315, 2319, 2301, 0, 2390, 2475, 0, 2326, 2465, 2314, 2315, 2319, 2390, 2321, 2315, 2319, 0, 2324, 2611, 2465, 2301, 2301, 2301, 2321, 2324, 2475, 2326, 2324, 0, 2322, 0, 2301, 2303, 2303, 2475, 2325, 2326, 2465, 2303, 2322, 2303, 2303, 2303, 2322, 0, 2325, 2519, 2611, 2465, 2325, 2524, 2303, 2519, 2303, 2303, 2303, 2303, 2303, 2322, 2524, 2615, 2616, 0, 2303, 2325, 2768, 2768, 0, 2322, 0, 2768, 0, 2322, 2303, 2325, 2519, 0, 0, 2325, 2524, 0, 2519, 2776, 2776, 2303, 2303, 2303, 2776, 2524, 2615, 2616, 2333, 2303, 2333, 2333, 2333, 2333, 2333, 2333, 2333, 2333, 2333, 2303, 2337, 2337, 2337, 2337, 2337, 2337, 2337, 2337, 2337, 0, 2473, 0, 2473, 2473, 0, 2473, 2337, 2337, 2337, 2337, 2337, 2337, 2338, 2338, 2338, 2338, 2338, 2338, 2338, 2338, 2340, 2340, 2340, 2340, 2340, 2340, 2340, 2340, 2473, 2777, 2777, 0, 0, 0, 2777, 2337, 2337, 2337, 2337, 2337, 2337, 2339, 2339, 2339, 2339, 2339, 2339, 2339, 2339, 2339, 2339, 2474, 0, 2474, 2474, 0, 2474, 2339, 2339, 2339, 2339, 2339, 2339, 2345, 2345, 2345, 2345, 2345, 2345, 2345, 2345, 2350, 2350, 2350, 2350, 2350, 2350, 2350, 2350, 2474, 2786, 2786, 0, 0, 0, 2786, 2339, 2339, 2339, 2339, 2339, 2339, 2341, 2341, 2341, 2341, 2341, 2341, 2341, 2341, 2341, 2610, 0, 0, 0, 0, 0, 2610, 2341, 2341, 2341, 2341, 2341, 2341, 2355, 2355, 2355, 2355, 2355, 2355, 2355, 2355, 2360, 2360, 2360, 2360, 2360, 2360, 2360, 2360, 2610, 0, 0, 0, 0, 0, 2610, 2341, 2341, 2341, 2341, 2341, 2341, 2344, 2344, 2344, 2344, 2344, 2344, 2344, 2344, 2344, 2344, 2787, 2787, 0, 0, 0, 2787, 2344, 2344, 2344, 2344, 2344, 2344, 2364, 2364, 2364, 2364, 2364, 2364, 2364, 2364, 2364, 2365, 2365, 2365, 2365, 2365, 2365, 2365, 2365, 2365, 0, 0, 0, 0, 0, 2344, 2344, 2344, 2344, 2344, 2344, 2346, 2346, 2346, 2346, 2346, 2346, 2346, 2346, 2346, 2794, 2794, 0, 0, 0, 2794, 0, 2346, 2346, 2346, 2346, 2346, 2346, 2366, 2366, 2366, 2366, 2366, 2366, 2366, 2366, 2366, 2367, 2367, 2367, 2367, 2367, 2367, 2367, 2367, 2367, 0, 0, 0, 0, 0, 2346, 2346, 2346, 2346, 2346, 2346, 2349, 2349, 2349, 2349, 2349, 2349, 2349, 2349, 2349, 2349, 2795, 2795, 0, 0, 0, 2795, 2349, 2349, 2349, 2349, 2349, 2349, 2368, 2368, 2368, 2368, 2368, 2368, 2368, 2368, 2369, 0, 2369, 2369, 2369, 2369, 2369, 2369, 2369, 2369, 0, 0, 0, 0, 0, 2349, 2349, 2349, 2349, 2349, 2349, 2351, 2351, 2351, 2351, 2351, 2351, 2351, 2351, 2351, 2802, 2802, 0, 0, 0, 2802, 0, 2351, 2351, 2351, 2351, 2351, 2351, 2370, 0, 2370, 2370, 2370, 2370, 2370, 2370, 2370, 2370, 2371, 0, 2371, 2371, 2371, 2371, 2371, 2371, 0, 0, 0, 0, 0, 2351, 2351, 2351, 2351, 2351, 2351, 2354, 2354, 2354, 2354, 2354, 2354, 2354, 2354, 2354, 2354, 2806, 2806, 0, 0, 0, 2806, 2354, 2354, 2354, 2354, 2354, 2354, 2372, 2372, 2372, 2372, 2372, 2372, 2372, 2372, 2373, 0, 2373, 2373, 2373, 2373, 2373, 2373, 2373, 2373, 0, 0, 0, 0, 0, 2354, 2354, 2354, 2354, 2354, 2354, 2356, 2356, 2356, 2356, 2356, 2356, 2356, 2356, 2356, 2815, 2815, 0, 0, 0, 2815, 0, 2356, 2356, 2356, 2356, 2356, 2356, 2374, 0, 2374, 2374, 2374, 2374, 2374, 2374, 2374, 2374, 2375, 0, 2375, 2375, 2375, 2375, 2375, 2375, 0, 0, 0, 0, 0, 2356, 2356, 2356, 2356, 2356, 2356, 2359, 2359, 2359, 2359, 2359, 2359, 2359, 2359, 2359, 2359, 2816, 2816, 0, 0, 0, 2816, 2359, 2359, 2359, 2359, 2359, 2359, 2376, 2376, 2376, 2376, 2376, 2376, 2376, 2376, 2376, 2376, 2377, 2377, 2377, 2377, 2377, 2377, 2377, 2377, 2377, 2377, 0, 0, 0, 2359, 2359, 2359, 2359, 2359, 2359, 2361, 2361, 2361, 2361, 2361, 2361, 2361, 2361, 2361, 2820, 2820, 0, 0, 0, 2820, 0, 2361, 2361, 2361, 2361, 2361, 2361, 2378, 2378, 2378, 2378, 2378, 2378, 2378, 2378, 2378, 2378, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 2379, 0, 0, 0, 0, 0, 2361, 2361, 2361, 2361, 2361, 2361, 2380, 2380, 2380, 2380, 2380, 2380, 2380, 2380, 2380, 2380, 0, 0, 0, 0, 0, 0, 2380, 2380, 2380, 2380, 2380, 2380, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2383, 0, 2383, 2383, 2383, 2383, 2383, 2383, 2383, 2383, 0, 0, 0, 0, 0, 2380, 2380, 2380, 2380, 2380, 2380, 2388, 2388, 0, 0, 0, 0, 2388, 0, 2388, 2388, 2388, 2417, 2417, 2417, 2417, 2417, 2417, 2417, 2417, 2388, 2525, 2388, 2388, 2388, 2388, 2388, 0, 0, 2566, 2525, 0, 2388, 0, 0, 0, 2405, 2566, 2405, 2405, 2409, 2405, 2409, 2409, 2409, 2409, 2409, 2409, 2409, 2409, 2525, 0, 0, 2388, 2388, 2388, 0, 0, 2566, 2525, 2614, 2388, 2389, 2389, 2405, 2614, 2566, 0, 2389, 0, 2389, 2389, 2389, 0, 0, 2807, 2405, 2807, 2807, 0, 0, 2389, 2807, 2389, 2389, 2389, 2389, 2389, 0, 2614, 0, 0, 0, 0, 2614, 2410, 2389, 2410, 2410, 2410, 2410, 2410, 2410, 2410, 2410, 2405, 2423, 2423, 2423, 2423, 2423, 2423, 2423, 2423, 2389, 2389, 2389, 0, 0, 0, 0, 0, 0, 0, 2411, 2389, 2411, 2411, 2411, 2411, 2411, 2411, 2411, 2411, 2413, 2413, 2413, 2413, 2413, 2413, 2413, 2413, 2413, 0, 0, 0, 0, 0, 0, 0, 2413, 2413, 2413, 2413, 2413, 2413, 2414, 2414, 2414, 2414, 2414, 2414, 2414, 2414, 2414, 2419, 2419, 2419, 2419, 2419, 2419, 2419, 2419, 2419, 2419, 0, 0, 0, 0, 2413, 2413, 2413, 2413, 2413, 2413, 2416, 2416, 2416, 2416, 2416, 2416, 2416, 2416, 2416, 0, 0, 0, 0, 0, 0, 0, 2416, 2416, 2416, 2416, 2416, 2416, 2420, 2420, 2420, 2420, 2420, 2420, 2420, 2420, 2420, 2420, 2421, 2421, 2421, 2421, 2421, 2421, 2421, 2421, 2421, 2421, 0, 0, 0, 2416, 2416, 2416, 2416, 2416, 2416, 2422, 2422, 2422, 2422, 2422, 2422, 2422, 2422, 2422, 0, 0, 0, 0, 0, 0, 0, 2422, 2422, 2422, 2422, 2422, 2422, 2424, 2424, 2424, 2424, 2424, 2424, 2424, 2424, 2424, 2424, 2425, 2425, 2425, 2425, 2425, 2425, 2425, 2425, 2425, 2425, 0, 0, 0, 2422, 2422, 2422, 2422, 2422, 2422, 2426, 2426, 2426, 2426, 2426, 2426, 2426, 2426, 2426, 2426, 2427, 2427, 2427, 2427, 2427, 2427, 2427, 2427, 2427, 0, 0, 0, 0, 0, 0, 0, 2427, 2427, 2427, 2427, 2427, 2427, 2428, 2428, 2428, 2428, 2428, 2428, 2428, 2428, 2429, 2429, 2429, 2429, 2429, 2429, 2429, 2429, 2429, 2429, 0, 0, 0, 0, 0, 2427, 2427, 2427, 2427, 2427, 2427, 2430, 2430, 2430, 2430, 2430, 2430, 2430, 2430, 2430, 2430, 2431, 2431, 2431, 2431, 2431, 2431, 2431, 2431, 2431, 2431, 2432, 2432, 2432, 2432, 2432, 2432, 2432, 2432, 2432, 0, 0, 0, 0, 0, 0, 0, 2432, 2432, 2432, 2432, 2432, 2432, 2433, 2433, 2433, 2433, 2433, 2433, 2433, 2433, 2434, 2434, 2434, 2434, 2434, 2434, 2434, 2434, 2434, 2434, 0, 0, 0, 0, 0, 2432, 2432, 2432, 2432, 2432, 2432, 2435, 2435, 2435, 2435, 2435, 2435, 2435, 2435, 2435, 2435, 2436, 2436, 2436, 2436, 2436, 2436, 2436, 2436, 2436, 2436, 2437, 2437, 2437, 2437, 2437, 2437, 2437, 2437, 2437, 0, 0, 0, 0, 0, 0, 0, 2437, 2437, 2437, 2437, 2437, 2437, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2438, 2439, 2439, 2439, 2439, 2439, 2439, 2439, 2439, 2439, 2439, 0, 0, 0, 0, 0, 2437, 2437, 2437, 2437, 2437, 2437, 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2440, 2441, 2441, 2441, 2441, 2441, 2441, 2441, 2441, 2441, 2441, 2442, 2442, 2442, 2442, 2442, 2442, 2442, 2442, 2442, 0, 0, 0, 0, 0, 0, 0, 2442, 2442, 2442, 2442, 2442, 2442, 2443, 2443, 2443, 2443, 2443, 2443, 2443, 2443, 2444, 2444, 2444, 2444, 2444, 2444, 2444, 2444, 2444, 0, 0, 0, 0, 0, 0, 2442, 2442, 2442, 2442, 2442, 2442, 2445, 2445, 2445, 2445, 2445, 2445, 2445, 2445, 2445, 2446, 2446, 2446, 2446, 2446, 2446, 2446, 2446, 2446, 2447, 2447, 2447, 2447, 2447, 2447, 2447, 2447, 2447, 2448, 2448, 2448, 2448, 2448, 2448, 2448, 2448, 2448, 2450, 0, 2450, 2450, 2450, 2450, 2450, 2450, 2450, 2450, 2451, 0, 2451, 2451, 2451, 2451, 2451, 2451, 2451, 2451, 2452, 0, 2452, 2452, 2452, 2452, 2452, 2452, 2452, 2452, 2454, 0, 2454, 2454, 2454, 2454, 2454, 2454, 2454, 2454, 2455, 0, 2455, 2455, 2455, 2455, 2455, 2455, 2455, 2455, 2456, 0, 2456, 2456, 2456, 2456, 2456, 2456, 2456, 2456, 2457, 2457, 2457, 2457, 2457, 2457, 2457, 2457, 2457, 2457, 0, 0, 0, 0, 0, 0, 2457, 2457, 2457, 2457, 2457, 2457, 2458, 2458, 2458, 2458, 2458, 2458, 2458, 2458, 2476, 2476, 2476, 2476, 2476, 2476, 2476, 2476, 0, 0, 0, 0, 0, 0, 0, 2457, 2457, 2457, 2457, 2457, 2457, 2459, 2459, 2459, 2459, 2459, 2459, 2459, 2459, 2459, 0, 0, 0, 0, 0, 0, 0, 2459, 2459, 2459, 2459, 2459, 2459, 2477, 0, 2477, 2477, 2477, 2477, 2477, 2477, 2477, 2477, 2478, 0, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 0, 0, 0, 2459, 2459, 2459, 2459, 2459, 2459, 2479, 0, 2479, 2479, 2479, 2479, 2479, 2479, 2481, 2481, 2481, 2481, 2481, 2481, 2481, 2481, 2481, 0, 0, 0, 0, 0, 0, 0, 2481, 2481, 2481, 2481, 2481, 2481, 2482, 2482, 2482, 2482, 2482, 2482, 2482, 2482, 2484, 2484, 2484, 2484, 2484, 2484, 2484, 2484, 0, 0, 0, 0, 0, 0, 0, 2481, 2481, 2481, 2481, 2481, 2481, 2483, 2483, 2483, 2483, 2483, 2483, 2483, 2483, 2483, 0, 0, 0, 0, 0, 0, 0, 2483, 2483, 2483, 2483, 2483, 2483, 2487, 2487, 2487, 2487, 2487, 2487, 2487, 2487, 2490, 2490, 2490, 2490, 2490, 2490, 2490, 2490, 0, 0, 0, 0, 0, 0, 0, 2483, 2483, 2483, 2483, 2483, 2483, 2486, 2486, 2486, 2486, 2486, 2486, 2486, 2486, 2486, 0, 0, 0, 0, 0, 0, 0, 2486, 2486, 2486, 2486, 2486, 2486, 2493, 2493, 2493, 2493, 2493, 2493, 2493, 2493, 2496, 2496, 2496, 2496, 2496, 2496, 2496, 2496, 0, 0, 0, 0, 0, 0, 0, 2486, 2486, 2486, 2486, 2486, 2486, 2489, 2489, 2489, 2489, 2489, 2489, 2489, 2489, 2489, 0, 0, 0, 0, 0, 0, 0, 2489, 2489, 2489, 2489, 2489, 2489, 2499, 2499, 2499, 2499, 2499, 2499, 2499, 2499, 2501, 2501, 2501, 2501, 2501, 2501, 2501, 2501, 2501, 0, 0, 0, 0, 0, 0, 2489, 2489, 2489, 2489, 2489, 2489, 2492, 2492, 2492, 2492, 2492, 2492, 2492, 2492, 2492, 0, 0, 0, 0, 0, 0, 0, 2492, 2492, 2492, 2492, 2492, 2492, 2502, 2502, 2502, 2502, 2502, 2502, 2502, 2502, 2502, 2503, 2503, 2503, 2503, 2503, 2503, 2503, 2503, 2503, 0, 0, 0, 0, 0, 2492, 2492, 2492, 2492, 2492, 2492, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 0, 0, 0, 0, 0, 0, 0, 2495, 2495, 2495, 2495, 2495, 2495, 2504, 2504, 2504, 2504, 2504, 2504, 2504, 2504, 2504, 2505, 2505, 2505, 2505, 2505, 2505, 2505, 2505, 0, 0, 0, 0, 0, 0, 2495, 2495, 2495, 2495, 2495, 2495, 2498, 2498, 2498, 2498, 2498, 2498, 2498, 2498, 2498, 0, 0, 0, 0, 0, 0, 0, 2498, 2498, 2498, 2498, 2498, 2498, 2506, 0, 2506, 2506, 2506, 2506, 2506, 2506, 2506, 2506, 2507, 0, 2507, 2507, 2507, 2507, 2507, 2507, 2507, 2507, 0, 0, 0, 2498, 2498, 2498, 2498, 2498, 2498, 2508, 0, 2508, 2508, 2508, 2508, 2508, 2508, 2509, 2509, 2509, 2509, 2509, 2509, 2509, 2509, 2510, 0, 2510, 2510, 2510, 2510, 2510, 2510, 2510, 2510, 2511, 0, 2511, 2511, 2511, 2511, 2511, 2511, 2511, 2511, 2512, 0, 2512, 2512, 2512, 2512, 2512, 2512, 2513, 2513, 2513, 2513, 2513, 2513, 2513, 2513, 2513, 2513, 2514, 2514, 2514, 2514, 2514, 2514, 2514, 2514, 2514, 2514, 2515, 2515, 2515, 2515, 2515, 2515, 2515, 2515, 2515, 2515, 2516, 2516, 2516, 2516, 2516, 2516, 2516, 2516, 2516, 0, 0, 0, 0, 0, 0, 0, 2516, 2516, 2516, 2516, 2516, 2516, 2517, 2517, 2517, 2517, 2517, 2517, 2517, 2517, 2530, 0, 2530, 2530, 2530, 2530, 2530, 2530, 2530, 2530, 0, 0, 0, 0, 0, 2516, 2516, 2516, 2516, 2516, 2516, 2531, 0, 2531, 2531, 2531, 2531, 2531, 2531, 2531, 2531, 2532, 0, 2532, 2532, 2532, 2532, 2532, 2532, 2532, 2532, 2533, 2533, 2533, 2533, 2533, 2533, 2533, 2533, 2533, 0, 0, 0, 0, 0, 0, 0, 2533, 2533, 2533, 2533, 2533, 2533, 2534, 2534, 2534, 2534, 2534, 2534, 2534, 2534, 2536, 2536, 2536, 2536, 2536, 2536, 2536, 2536, 2536, 0, 0, 0, 0, 0, 0, 2533, 2533, 2533, 2533, 2533, 2533, 2537, 2537, 2537, 2537, 2537, 2537, 2537, 2537, 2537, 2538, 2538, 2538, 2538, 2538, 2538, 2538, 2538, 2538, 2539, 2539, 2539, 2539, 2539, 2539, 2539, 2539, 2539, 2540, 2540, 2540, 2540, 2540, 2540, 2540, 2540, 2540, 2541, 2541, 2541, 2541, 2541, 2541, 2541, 2541, 2541, 2542, 2542, 2542, 2542, 2542, 2542, 2542, 2542, 2542, 2543, 2543, 2543, 2543, 2543, 2543, 2543, 2543, 2543, 2544, 2544, 2544, 2544, 2544, 2544, 2544, 2544, 2544, 2545, 2545, 2545, 2545, 2545, 2545, 2545, 2545, 2545, 2546, 2546, 2546, 2546, 2546, 2546, 2546, 2546, 2546, 2547, 2547, 2547, 2547, 2547, 2547, 2547, 2547, 2547, 2548, 2548, 2548, 2548, 2548, 2548, 2548, 2548, 2548, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2550, 2550, 2550, 2550, 2550, 2550, 2550, 2550, 2550, 2551, 2551, 2551, 2551, 2551, 2551, 2551, 2551, 2551, 2552, 2552, 2552, 2552, 2552, 2552, 2552, 2552, 2552, 2553, 2553, 2553, 2553, 2553, 2553, 2553, 2553, 2553, 2554, 2554, 2554, 2554, 2554, 2554, 2554, 2554, 2554, 2555, 2555, 2555, 2555, 2555, 2555, 2555, 2555, 2555, 2556, 2556, 2556, 2556, 2556, 2556, 2556, 2556, 2556, 2557, 2557, 2557, 2557, 2557, 2557, 2557, 2557, 2557, 2558, 2558, 2558, 2558, 2558, 2558, 2558, 2558, 2558, 2560, 0, 2560, 2560, 2560, 2560, 2560, 2560, 2560, 2560, 2561, 0, 2561, 2561, 2561, 2561, 2561, 2561, 2561, 2561, 2562, 0, 2562, 2562, 2562, 2562, 2562, 2562, 2562, 2562, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 2563, 0, 0, 0, 0, 0, 0, 0, 2563, 2563, 2563, 2563, 2563, 2563, 2564, 2564, 2564, 2564, 2564, 2564, 2564, 2564, 2572, 2572, 2572, 2572, 2572, 2572, 2572, 2572, 0, 0, 0, 0, 0, 0, 0, 2563, 2563, 2563, 2563, 2563, 2563, 2573, 0, 2573, 2573, 2573, 2573, 2573, 2573, 2573, 2573, 2574, 0, 2574, 2574, 2574, 2574, 2574, 2574, 2574, 2574, 2575, 0, 2575, 2575, 2575, 2575, 2575, 2575, 2576, 2576, 2576, 2576, 2576, 2576, 2576, 2576, 2576, 2577, 2577, 2577, 2577, 2577, 2577, 2577, 2577, 2577, 2578, 2578, 2578, 2578, 2578, 2578, 2578, 2578, 2578, 2579, 2579, 2579, 2579, 2579, 2579, 2579, 2579, 2579, 2580, 2580, 2580, 2580, 2580, 2580, 2580, 2580, 2580, 2581, 2581, 2581, 2581, 2581, 2581, 2581, 2581, 2581, 2582, 2582, 2582, 2582, 2582, 2582, 2582, 2582, 2583, 0, 2583, 2583, 2583, 2583, 2583, 2583, 2583, 2583, 2584, 0, 2584, 2584, 2584, 2584, 2584, 2584, 2584, 2584, 2585, 0, 2585, 2585, 2585, 2585, 2585, 2585, 2586, 2586, 2586, 2586, 2586, 2586, 2586, 2586, 2586, 2587, 2587, 2587, 2587, 2587, 2587, 2587, 2587, 2587, 2588, 2588, 2588, 2588, 2588, 2588, 2588, 2588, 2588, 2589, 2591, 2591, 2591, 2591, 2591, 2591, 2591, 2591, 2591, 0, 2589, 2592, 2592, 2592, 2592, 2592, 2592, 2592, 2592, 2592, 0, 0, 0, 0, 0, 0, 0, 0, 2589, 2593, 2593, 2593, 2593, 2593, 2593, 2593, 2593, 2593, 0, 2589, 2594, 2594, 2594, 2594, 2594, 2594, 2594, 2594, 2594, 2595, 2595, 2595, 2595, 2595, 2595, 2595, 2595, 2595, 2596, 2596, 2596, 2596, 2596, 2596, 2596, 2596, 2596, 2597, 2597, 2597, 2597, 2597, 2597, 2597, 2597, 2597, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2598, 2599, 2599, 2599, 2599, 2599, 2599, 2599, 2599, 2599, 2602, 2602, 2602, 2602, 2602, 2602, 2602, 2602, 2602, 2603, 2603, 2603, 2603, 2603, 2603, 2603, 2603, 2603, 2604, 2604, 2604, 2604, 2604, 2604, 2604, 2604, 2604, 2605, 2605, 2605, 2605, 2605, 2605, 2605, 2605, 2605, 2606, 2606, 2606, 2606, 2606, 2606, 2606, 2606, 2606, 2607, 2607, 2607, 2607, 2607, 2607, 2607, 2607, 2607, 2608, 2608, 2608, 2608, 2608, 2608, 2608, 2608, 2608, 2609, 2609, 2609, 2609, 2609, 2609, 2609, 2609, 2609, 2612, 2612, 2612, 2612, 2612, 2612, 2612, 2612, 2612, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2613, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2619, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2620, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2621, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2622, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2623, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2624, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2625, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2626, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2627, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2628, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2629, 2630, 2630, 0, 0, 0, 2630, 0, 2630, 2630, 2630, 0, 2630, 2630, 2630, 2630, 2630, 2630, 2630, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2632, 2632, 0, 0, 0, 2632, 0, 2632, 2632, 2632, 0, 2632, 2632, 2632, 2632, 2632, 2632, 2632, 2633, 0, 0, 2633, 0, 2633, 0, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2633, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2634, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2635, 2636, 2636, 0, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2637, 2637, 0, 0, 0, 2637, 0, 2637, 2637, 2637, 0, 2637, 2637, 0, 2637, 2637, 2637, 2637, 2638, 2638, 0, 2638, 2638, 2638, 2638, 2638, 2638, 2638, 2638, 2638, 2638, 2638, 2638, 2638, 2638, 2638, 2638, 2638, 2638, 2638, 2638, 2639, 2639, 0, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2639, 2640, 2640, 0, 0, 0, 2640, 0, 2640, 2640, 2640, 0, 2640, 2640, 0, 2640, 2640, 2640, 2640, 2641, 2641, 0, 2641, 2641, 2641, 2641, 2641, 2641, 2641, 2641, 2641, 2641, 2641, 2641, 2641, 2641, 2641, 2641, 2641, 2641, 2641, 2641, 2642, 2642, 2642, 2642, 0, 2642, 2642, 2642, 2642, 2642, 2642, 2642, 2642, 2642, 2642, 2642, 2642, 2642, 2642, 2642, 0, 2642, 2642, 2642, 2642, 2642, 2642, 2643, 2643, 2643, 2643, 0, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2644, 2644, 2644, 2644, 0, 2644, 2644, 2644, 2644, 2644, 2644, 2644, 2644, 2644, 2644, 2644, 2644, 2644, 2644, 2644, 0, 2644, 2644, 2644, 2644, 2644, 2644, 2645, 2645, 2645, 2645, 0, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2645, 2646, 2646, 2646, 2646, 0, 2646, 2646, 2646, 2646, 2646, 2646, 2646, 2646, 2646, 2646, 2646, 2646, 2646, 2646, 2646, 0, 2646, 2646, 2646, 2646, 2646, 2646, 2647, 2647, 2647, 2647, 0, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2647, 2648, 2648, 2648, 2648, 0, 2648, 2648, 2648, 2648, 2648, 2648, 2648, 2648, 2648, 2648, 2648, 2648, 2648, 2648, 2648, 0, 2648, 2648, 2648, 2648, 2648, 2648, 2649, 2649, 2649, 2649, 2649, 2649, 2649, 2649, 2649, 2649, 2649, 2649, 2649, 2649, 0, 2649, 0, 2649, 2649, 2650, 2650, 2650, 2650, 2650, 2650, 2650, 2650, 2650, 2650, 2650, 2650, 2650, 2650, 0, 2650, 2650, 2650, 2650, 2651, 2651, 2651, 2651, 2651, 2651, 2651, 2651, 2651, 2651, 2651, 2651, 0, 2651, 2651, 2651, 2651, 2652, 2652, 0, 0, 0, 2652, 0, 2652, 2652, 2652, 0, 2652, 2652, 0, 2652, 2652, 2652, 2652, 2653, 2653, 0, 0, 0, 2653, 0, 2653, 2653, 2653, 0, 2653, 2653, 0, 2653, 2653, 2653, 2653, 2654, 2654, 0, 0, 0, 2654, 0, 2654, 2654, 2654, 0, 2654, 2654, 0, 2654, 2654, 2654, 2654, 2655, 0, 2655, 2655, 0, 0, 0, 0, 0, 0, 0, 2655, 2655, 0, 0, 2655, 2656, 0, 0, 0, 2656, 2656, 2656, 2656, 2656, 2656, 2656, 2656, 2656, 0, 2656, 2656, 2656, 2656, 2656, 2656, 2656, 2656, 2656, 0, 0, 2656, 2656, 2657, 2657, 0, 2657, 2657, 2657, 2657, 2657, 2657, 2657, 2657, 2657, 2657, 0, 2657, 2657, 2657, 0, 2657, 2657, 2657, 2657, 2657, 2657, 0, 2657, 2657, 2658, 0, 0, 0, 0, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2658, 2659, 2659, 0, 0, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2659, 2660, 2660, 0, 0, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2660, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2662, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2663, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2664, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2665, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2666, 2667, 2667, 0, 0, 0, 2667, 0, 2667, 2667, 2667, 0, 2667, 2667, 2667, 2667, 2667, 2667, 2667, 2668, 2668, 0, 0, 0, 2668, 0, 2668, 2668, 2668, 0, 2668, 2668, 2668, 2668, 2668, 2668, 2668, 2669, 2669, 0, 0, 0, 2669, 0, 2669, 2669, 2669, 0, 2669, 2669, 0, 2669, 2669, 2669, 2669, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2670, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2671, 2672, 2672, 0, 0, 0, 2672, 0, 2672, 2672, 2672, 0, 2672, 2672, 2672, 2672, 2672, 2672, 2672, 2673, 2673, 0, 0, 0, 2673, 0, 2673, 2673, 2673, 0, 2673, 2673, 2673, 2673, 2673, 2673, 2673, 2674, 2674, 0, 0, 0, 2674, 0, 2674, 2674, 2674, 0, 2674, 2674, 2674, 2674, 2674, 2674, 2674, 2675, 2675, 0, 0, 0, 2675, 0, 2675, 2675, 2675, 0, 2675, 2675, 2675, 2675, 2675, 2675, 2675, 2677, 0, 0, 2677, 0, 2677, 0, 2677, 2677, 2677, 2677, 2677, 2677, 2677, 2677, 2677, 2677, 2677, 2677, 2677, 2677, 2677, 2677, 2677, 2677, 2677, 2677, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2678, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2679, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2680, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2681, 2682, 2682, 0, 0, 0, 2682, 0, 2682, 2682, 2682, 0, 2682, 2682, 0, 2682, 2682, 2682, 2682, 2683, 2683, 0, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2684, 2685, 2685, 0, 0, 0, 2685, 0, 2685, 2685, 2685, 0, 2685, 2685, 0, 2685, 2685, 2685, 2685, 2686, 2686, 0, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2686, 2687, 2687, 2687, 2687, 0, 2687, 2687, 2687, 2687, 2687, 2687, 2687, 2687, 2687, 2687, 2687, 2687, 2687, 2687, 2687, 0, 2687, 2687, 2687, 2687, 2687, 2687, 2688, 2688, 2688, 2688, 0, 2688, 2688, 2688, 2688, 2688, 2688, 2688, 2688, 2688, 2688, 2688, 2688, 0, 2688, 2688, 0, 2688, 2688, 2688, 2688, 2688, 2688, 2689, 2689, 2689, 2689, 0, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2689, 2690, 2690, 2690, 2690, 0, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2690, 2691, 2691, 0, 0, 0, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2691, 2692, 2692, 2692, 2692, 0, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 0, 2692, 2692, 2692, 2692, 2692, 2692, 2693, 2693, 2693, 2693, 0, 2693, 2693, 2693, 2693, 2693, 2693, 2693, 2693, 2693, 2693, 2693, 2693, 2693, 2693, 2693, 0, 2693, 2693, 2693, 2693, 2693, 2693, 2694, 2694, 2694, 2694, 0, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2694, 2695, 2695, 2695, 2695, 0, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2695, 2696, 2696, 0, 0, 0, 2696, 2696, 0, 2696, 2696, 2696, 2696, 2696, 2696, 2696, 2696, 2696, 2696, 2696, 0, 2696, 2696, 2696, 2696, 2696, 2696, 2696, 2697, 2697, 2697, 2697, 0, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2697, 2698, 2698, 2698, 2698, 0, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2698, 2699, 2699, 2699, 2699, 0, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2699, 2700, 2700, 0, 0, 0, 2700, 2700, 0, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2701, 2701, 2701, 2701, 0, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 0, 2701, 2701, 2701, 2701, 2701, 2701, 2702, 2702, 2702, 2702, 0, 2702, 2702, 2702, 2702, 2702, 2702, 2702, 2702, 2702, 2702, 2702, 2702, 2702, 2702, 2702, 0, 2702, 2702, 2702, 2702, 2702, 2702, 2703, 2703, 2703, 2703, 2703, 2703, 2703, 2703, 2703, 2703, 2703, 2703, 2703, 2703, 0, 2703, 0, 2703, 2703, 2704, 2704, 2704, 2704, 2704, 2704, 2704, 2704, 2704, 2704, 2704, 2704, 2704, 2704, 0, 2704, 2704, 2704, 2704, 2705, 2705, 2705, 2705, 2705, 2705, 2705, 2705, 2705, 2705, 2705, 2705, 0, 2705, 2705, 2705, 2705, 2706, 2706, 2706, 0, 0, 0, 2706, 0, 2706, 2706, 2706, 0, 2706, 2706, 0, 2706, 2706, 2706, 2706, 2707, 2707, 0, 0, 0, 2707, 0, 2707, 2707, 2707, 0, 2707, 2707, 0, 2707, 2707, 2707, 2707, 2708, 2708, 0, 2708, 0, 2708, 0, 2708, 2708, 2708, 0, 2708, 2708, 0, 2708, 2708, 2708, 2708, 2709, 0, 2709, 2709, 0, 0, 0, 0, 0, 0, 0, 2709, 2709, 0, 0, 2709, 2710, 0, 0, 0, 2710, 2710, 2710, 2710, 2710, 2710, 2710, 2710, 2710, 0, 2710, 2710, 2710, 2710, 2710, 2710, 2710, 2710, 2710, 0, 0, 2710, 2710, 2711, 2711, 0, 0, 2711, 2711, 2711, 2711, 2711, 2711, 2711, 2711, 2711, 0, 2711, 2711, 2711, 0, 2711, 2711, 2711, 2711, 2711, 2711, 0, 2711, 2711, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2712, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2713, 2714, 0, 0, 0, 0, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2714, 2715, 2715, 0, 0, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2715, 2716, 2716, 0, 0, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2717, 2717, 0, 0, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2717, 2718, 2718, 0, 0, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2718, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2719, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2720, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2721, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2722, 2723, 2723, 0, 0, 0, 2723, 0, 2723, 2723, 2723, 0, 2723, 2723, 2723, 2723, 2723, 2723, 2723, 2724, 2724, 0, 0, 0, 2724, 0, 2724, 2724, 2724, 0, 2724, 2724, 0, 2724, 2724, 2724, 2724, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2725, 2726, 2726, 0, 0, 0, 2726, 0, 2726, 2726, 2726, 0, 2726, 2726, 2726, 2726, 2726, 2726, 2726, 2727, 2727, 0, 0, 0, 2727, 0, 2727, 2727, 2727, 0, 2727, 2727, 2727, 2727, 2727, 2727, 2727, 2729, 2729, 0, 0, 0, 2729, 0, 2729, 2729, 2729, 0, 2729, 2729, 2729, 2729, 2729, 2729, 2729, 2730, 2730, 0, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2730, 2731, 2731, 0, 2731, 2731, 2731, 2731, 2731, 2731, 2731, 2731, 2731, 2731, 2731, 2731, 2731, 2731, 2731, 2731, 2731, 2731, 2731, 2731, 2732, 2732, 2732, 2732, 0, 2732, 2732, 2732, 2732, 2732, 2732, 2732, 2732, 2732, 2732, 2732, 2732, 0, 2732, 2732, 2732, 2732, 2732, 2732, 2732, 2732, 2732, 2733, 2733, 2733, 2733, 0, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2733, 2734, 2734, 2734, 2734, 0, 2734, 2734, 2734, 2734, 2734, 2734, 2734, 2734, 2734, 2734, 2734, 2734, 2734, 2734, 2734, 0, 2734, 2734, 2734, 2734, 2734, 2734, 2735, 2735, 2735, 2735, 0, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2735, 2736, 2736, 2736, 2736, 0, 2736, 2736, 2736, 2736, 2736, 2736, 2736, 2736, 2736, 2736, 2736, 2736, 2736, 2736, 2736, 2736, 2736, 2736, 2736, 2736, 2736, 2736, 2737, 2737, 2737, 2737, 0, 2737, 2737, 2737, 2737, 2737, 2737, 2737, 2737, 2737, 2737, 2737, 2737, 2737, 2737, 2737, 0, 2737, 2737, 2737, 2737, 2737, 2737, 2738, 2738, 2738, 2738, 0, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2738, 2739, 0, 0, 0, 0, 2739, 0, 2739, 2739, 0, 0, 0, 2739, 2739, 0, 2739, 2740, 0, 2740, 2740, 0, 0, 0, 0, 0, 0, 0, 2740, 2740, 0, 0, 2740, 2741, 2741, 2741, 2741, 2741, 2741, 0, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2741, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 0, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2742, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2743, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2744, 2745, 0, 0, 0, 0, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2745, 2746, 2746, 0, 0, 0, 2746, 0, 2746, 2746, 2746, 0, 2746, 2746, 2746, 2746, 2746, 2746, 2746, 2750, 2750, 0, 0, 0, 2750, 0, 2750, 2750, 2750, 0, 2750, 2750, 2750, 2750, 2750, 2750, 2750, 2751, 2751, 0, 0, 0, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2751, 2752, 2752, 0, 0, 0, 2752, 2752, 0, 2752, 2752, 2752, 2752, 2752, 2752, 2752, 2752, 2752, 2752, 2752, 0, 2752, 2752, 2752, 2752, 2752, 2752, 2752, 2753, 2753, 0, 0, 0, 2753, 2753, 0, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2753, 2754, 0, 2754, 2754, 0, 0, 0, 0, 0, 0, 0, 2754, 2754, 0, 0, 2754, 2758, 0, 2758, 2758, 0, 0, 0, 0, 0, 0, 0, 2758, 2758, 0, 0, 2758, 2766, 0, 2766, 2766, 0, 0, 0, 0, 0, 0, 0, 2766, 2766, 0, 0, 2766, 2770, 2770, 0, 0, 0, 2770, 0, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2770, 2771, 2771, 0, 0, 0, 2771, 0, 2771, 2771, 2771, 0, 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, 2773, 2773, 0, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2773, 2774, 0, 2774, 2774, 0, 0, 0, 0, 0, 0, 0, 2774, 2774, 0, 0, 2774, 2775, 2775, 0, 0, 0, 2775, 0, 2775, 2775, 2775, 0, 2775, 2775, 2775, 2775, 2775, 2775, 2775, 2781, 2781, 0, 0, 0, 2781, 0, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2781, 2782, 2782, 0, 0, 0, 2782, 0, 2782, 2782, 2782, 0, 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, 2784, 2784, 0, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2784, 2785, 0, 2785, 2785, 0, 0, 0, 0, 0, 0, 0, 2785, 2785, 0, 0, 2785, 2789, 2789, 0, 0, 0, 2789, 0, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2790, 2790, 0, 0, 0, 2790, 0, 2790, 2790, 2790, 0, 2790, 2790, 2790, 2790, 2790, 2790, 2790, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2791, 2792, 2792, 0, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2792, 2793, 0, 2793, 2793, 0, 2793, 0, 0, 0, 2793, 0, 2793, 2793, 0, 0, 2793, 2800, 2800, 0, 0, 0, 2800, 0, 2800, 2800, 2800, 2800, 2800, 2800, 2800, 2800, 2800, 2800, 2800, 2801, 2801, 0, 0, 0, 2801, 0, 2801, 2801, 2801, 0, 2801, 2801, 2801, 2801, 2801, 2801, 2801, 2804, 2804, 0, 0, 0, 2804, 0, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2804, 2805, 2805, 0, 0, 0, 2805, 0, 2805, 2805, 2805, 0, 2805, 2805, 2805, 2805, 2805, 2805, 2805, 2813, 2813, 0, 0, 0, 2813, 0, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2813, 2814, 2814, 0, 0, 0, 2814, 0, 2814, 2814, 2814, 0, 2814, 2814, 2814, 2814, 2814, 2814, 2814, 2818, 2818, 0, 0, 0, 2818, 0, 2818, 2818, 2818, 2818, 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, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618, 2618 } ; 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" /* * 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 "tokens.h" // libmonit #include "util/Str.h" // we don't use yyinput => do not generate it #define YY_NO_INPUT #define MAX_STACK_DEPTH 512 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 } __attribute__((__packed__)) 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, char*); static int pop_buffer_state(void); static URL_T create_URL(char *proto); #line 5961 "src/lex.yy.c" #line 5963 "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 EVERY_COND 7 #define HTTP_HEADER_COND 8 #define INCLUDE 9 #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 154 "src/l.l" #line 6198 "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 >= 2619 ) 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] != 18225 ); 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 156 "src/l.l" { /* Wide white space */ } YY_BREAK case 2: /* rule 2 can match eol */ YY_RULE_SETUP #line 157 "src/l.l" { lineno++; } YY_BREAK case 3: YY_RULE_SETUP #line 159 "src/l.l" {/* EMPTY */} YY_BREAK case 4: YY_RULE_SETUP #line 160 "src/l.l" {/* EMPTY */} YY_BREAK case 5: YY_RULE_SETUP #line 161 "src/l.l" {/* EMPTY */} YY_BREAK case 6: YY_RULE_SETUP #line 162 "src/l.l" {/* EMPTY */} YY_BREAK case 7: YY_RULE_SETUP #line 163 "src/l.l" {/* EMPTY */} YY_BREAK case 8: YY_RULE_SETUP #line 164 "src/l.l" {/* EMPTY */} YY_BREAK case 9: YY_RULE_SETUP #line 165 "src/l.l" {/* EMPTY */} YY_BREAK case 10: YY_RULE_SETUP #line 166 "src/l.l" {/* EMPTY */} YY_BREAK case 11: YY_RULE_SETUP #line 167 "src/l.l" {/* EMPTY */} YY_BREAK case 12: YY_RULE_SETUP #line 168 "src/l.l" {/* EMPTY */} YY_BREAK case 13: YY_RULE_SETUP #line 169 "src/l.l" {/* EMPTY */} YY_BREAK case 14: YY_RULE_SETUP #line 170 "src/l.l" {/* EMPTY */} YY_BREAK case 15: YY_RULE_SETUP #line 171 "src/l.l" {/* EMPTY */} YY_BREAK case 16: YY_RULE_SETUP #line 172 "src/l.l" {/* EMPTY */} YY_BREAK case 17: YY_RULE_SETUP #line 173 "src/l.l" {/* EMPTY */} YY_BREAK case 18: YY_RULE_SETUP #line 174 "src/l.l" {/* EMPTY */} YY_BREAK case 19: YY_RULE_SETUP #line 175 "src/l.l" {/* EMPTY */} YY_BREAK case 20: YY_RULE_SETUP #line 176 "src/l.l" {/* EMPTY */} YY_BREAK case 21: YY_RULE_SETUP #line 177 "src/l.l" {/* EMPTY */} YY_BREAK case 22: YY_RULE_SETUP #line 178 "src/l.l" {/* EMPTY */} YY_BREAK case 23: YY_RULE_SETUP #line 179 "src/l.l" {/* EMPTY */} YY_BREAK case 24: YY_RULE_SETUP #line 180 "src/l.l" {/* EMPTY */} YY_BREAK case 25: YY_RULE_SETUP #line 181 "src/l.l" {/* EMPTY */} YY_BREAK case 26: YY_RULE_SETUP #line 182 "src/l.l" {/* EMPTY */} YY_BREAK case 27: YY_RULE_SETUP #line 183 "src/l.l" {/* EMPTY */} YY_BREAK case 28: YY_RULE_SETUP #line 184 "src/l.l" {/* EMPTY */} YY_BREAK case 29: YY_RULE_SETUP #line 185 "src/l.l" {/* EMPTY */} YY_BREAK case 30: YY_RULE_SETUP #line 186 "src/l.l" {/* EMPTY */} YY_BREAK case 31: YY_RULE_SETUP #line 187 "src/l.l" {/* EMPTY */} YY_BREAK case 32: YY_RULE_SETUP #line 188 "src/l.l" {/* EMPTY */} YY_BREAK case 33: YY_RULE_SETUP #line 189 "src/l.l" {/* EMPTY */} YY_BREAK case 34: YY_RULE_SETUP #line 191 "src/l.l" { BEGIN(ARGUMENT_COND); return START; } YY_BREAK case 35: YY_RULE_SETUP #line 192 "src/l.l" { BEGIN(ARGUMENT_COND); return STOP; } YY_BREAK case 36: YY_RULE_SETUP #line 193 "src/l.l" { BEGIN(ARGUMENT_COND); return RESTART; } YY_BREAK case 37: YY_RULE_SETUP #line 194 "src/l.l" { BEGIN(ARGUMENT_COND); return EXEC; } YY_BREAK case 38: YY_RULE_SETUP #line 195 "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 39: YY_RULE_SETUP #line 205 "src/l.l" { return IF; } YY_BREAK case 40: YY_RULE_SETUP #line 206 "src/l.l" { return THEN; } YY_BREAK case 41: YY_RULE_SETUP #line 207 "src/l.l" { return FAILED; } YY_BREAK case 42: YY_RULE_SETUP #line 208 "src/l.l" { return SSL; } YY_BREAK case 43: YY_RULE_SETUP #line 209 "src/l.l" { return SSL; } YY_BREAK case 44: YY_RULE_SETUP #line 210 "src/l.l" { return SSL; } YY_BREAK case 45: YY_RULE_SETUP #line 211 "src/l.l" { return SSL; } YY_BREAK case 46: YY_RULE_SETUP #line 212 "src/l.l" { return ENABLE; } YY_BREAK case 47: YY_RULE_SETUP #line 213 "src/l.l" { return DISABLE; } YY_BREAK case 48: YY_RULE_SETUP #line 214 "src/l.l" { return VERIFY; } YY_BREAK case 49: YY_RULE_SETUP #line 215 "src/l.l" { return VALID; } YY_BREAK case 50: YY_RULE_SETUP #line 216 "src/l.l" { return CERTIFICATE; } YY_BREAK case 51: YY_RULE_SETUP #line 217 "src/l.l" { return CACERTIFICATEFILE; } YY_BREAK case 52: YY_RULE_SETUP #line 218 "src/l.l" { return CACERTIFICATEPATH; } YY_BREAK case 53: YY_RULE_SETUP #line 219 "src/l.l" { return SET; } YY_BREAK case 54: YY_RULE_SETUP #line 220 "src/l.l" { return DAEMON; } YY_BREAK case 55: YY_RULE_SETUP #line 221 "src/l.l" { return DELAY; } YY_BREAK case 56: YY_RULE_SETUP #line 222 "src/l.l" { return TERMINAL; } YY_BREAK case 57: YY_RULE_SETUP #line 223 "src/l.l" { return BATCH; } YY_BREAK case 58: YY_RULE_SETUP #line 224 "src/l.l" { return LOGFILE; } YY_BREAK case 59: YY_RULE_SETUP #line 225 "src/l.l" { return LOGFILE; } YY_BREAK case 60: YY_RULE_SETUP #line 226 "src/l.l" { return SYSLOG; } YY_BREAK case 61: YY_RULE_SETUP #line 227 "src/l.l" { return FACILITY; } YY_BREAK case 62: YY_RULE_SETUP #line 228 "src/l.l" { return HTTPD; } YY_BREAK case 63: YY_RULE_SETUP #line 229 "src/l.l" { return ADDRESS; } YY_BREAK case 64: YY_RULE_SETUP #line 230 "src/l.l" { return INTERFACE; } YY_BREAK case 65: YY_RULE_SETUP #line 231 "src/l.l" { return LINK; } YY_BREAK case 66: YY_RULE_SETUP #line 232 "src/l.l" { return PACKET; } YY_BREAK case 67: YY_RULE_SETUP #line 233 "src/l.l" { return BYTEIN; } YY_BREAK case 68: YY_RULE_SETUP #line 234 "src/l.l" { return BYTEOUT; } YY_BREAK case 69: YY_RULE_SETUP #line 235 "src/l.l" { return PACKETIN; } YY_BREAK case 70: YY_RULE_SETUP #line 236 "src/l.l" { return PACKETOUT; } YY_BREAK case 71: YY_RULE_SETUP #line 237 "src/l.l" { return UPLOAD; } YY_BREAK case 72: YY_RULE_SETUP #line 238 "src/l.l" { return DOWNLOAD; } YY_BREAK case 73: YY_RULE_SETUP #line 239 "src/l.l" { return SATURATION; } YY_BREAK case 74: YY_RULE_SETUP #line 240 "src/l.l" { return SPEED; } YY_BREAK case 75: YY_RULE_SETUP #line 241 "src/l.l" { return TOTAL; } YY_BREAK case 76: YY_RULE_SETUP #line 242 "src/l.l" { return CLIENTPEMFILE; } YY_BREAK case 77: YY_RULE_SETUP #line 243 "src/l.l" { return ALLOWSELFCERTIFICATION; } YY_BREAK case 78: YY_RULE_SETUP #line 244 "src/l.l" { return SELFSIGNED; } YY_BREAK case 79: YY_RULE_SETUP #line 245 "src/l.l" { return CERTMD5; } YY_BREAK case 80: YY_RULE_SETUP #line 246 "src/l.l" { return PEMFILE; } YY_BREAK case 81: YY_RULE_SETUP #line 247 "src/l.l" { return INIT; } YY_BREAK case 82: YY_RULE_SETUP #line 248 "src/l.l" { return ALLOW; } YY_BREAK case 83: YY_RULE_SETUP #line 249 "src/l.l" { return REJECTOPT; } YY_BREAK case 84: YY_RULE_SETUP #line 250 "src/l.l" { return READONLY; } YY_BREAK case 85: YY_RULE_SETUP #line 251 "src/l.l" { return DISK; } YY_BREAK case 86: YY_RULE_SETUP #line 252 "src/l.l" { return READ; } YY_BREAK case 87: YY_RULE_SETUP #line 253 "src/l.l" { return WRITE; } YY_BREAK case 88: YY_RULE_SETUP #line 254 "src/l.l" { return SERVICETIME; } YY_BREAK case 89: YY_RULE_SETUP #line 255 "src/l.l" { return OPERATION; } YY_BREAK case 90: YY_RULE_SETUP #line 256 "src/l.l" { return PIDFILE; } YY_BREAK case 91: YY_RULE_SETUP #line 257 "src/l.l" { return IDFILE; } YY_BREAK case 92: YY_RULE_SETUP #line 258 "src/l.l" { return STATEFILE; } YY_BREAK case 93: YY_RULE_SETUP #line 259 "src/l.l" { return PATHTOK; } YY_BREAK case 94: YY_RULE_SETUP #line 260 "src/l.l" { return START; } YY_BREAK case 95: YY_RULE_SETUP #line 261 "src/l.l" { return STOP; } YY_BREAK case 96: YY_RULE_SETUP #line 262 "src/l.l" { return PORT; } YY_BREAK case 97: YY_RULE_SETUP #line 263 "src/l.l" { return UNIXSOCKET; } YY_BREAK case 98: YY_RULE_SETUP #line 264 "src/l.l" { return IPV4; } YY_BREAK case 99: YY_RULE_SETUP #line 265 "src/l.l" { return IPV6; } YY_BREAK case 100: YY_RULE_SETUP #line 266 "src/l.l" { return TYPE; } YY_BREAK case 101: YY_RULE_SETUP #line 267 "src/l.l" { return PROTOCOL; } YY_BREAK case 102: YY_RULE_SETUP #line 268 "src/l.l" { return TCP; } YY_BREAK case 103: YY_RULE_SETUP #line 269 "src/l.l" { return TCPSSL; } YY_BREAK case 104: YY_RULE_SETUP #line 270 "src/l.l" { return UDP; } YY_BREAK case 105: YY_RULE_SETUP #line 271 "src/l.l" { return ALERT; } YY_BREAK case 106: YY_RULE_SETUP #line 272 "src/l.l" { return NOALERT; } YY_BREAK case 107: YY_RULE_SETUP #line 273 "src/l.l" { return MAILFORMAT; } YY_BREAK case 108: YY_RULE_SETUP #line 274 "src/l.l" { return RESOURCE; } YY_BREAK case 109: YY_RULE_SETUP #line 275 "src/l.l" { return RESTART; } YY_BREAK case 110: YY_RULE_SETUP #line 276 "src/l.l" { return CYCLE;} YY_BREAK case 111: YY_RULE_SETUP #line 277 "src/l.l" { return TIMEOUT; } YY_BREAK case 112: YY_RULE_SETUP #line 278 "src/l.l" { return RETRY; } YY_BREAK case 113: YY_RULE_SETUP #line 279 "src/l.l" { return CHECKSUM; } YY_BREAK case 114: YY_RULE_SETUP #line 280 "src/l.l" { return MAILSERVER; } YY_BREAK case 115: YY_RULE_SETUP #line 281 "src/l.l" { return HOST; } YY_BREAK case 116: YY_RULE_SETUP #line 282 "src/l.l" { return HOSTHEADER; } YY_BREAK case 117: YY_RULE_SETUP #line 283 "src/l.l" { return METHOD; } YY_BREAK case 118: YY_RULE_SETUP #line 284 "src/l.l" { return GET; } YY_BREAK case 119: YY_RULE_SETUP #line 285 "src/l.l" { return HEAD; } YY_BREAK case 120: YY_RULE_SETUP #line 286 "src/l.l" { return STATUS; } YY_BREAK case 121: YY_RULE_SETUP #line 287 "src/l.l" { return DEFAULT; } YY_BREAK case 122: YY_RULE_SETUP #line 288 "src/l.l" { return HTTP; } YY_BREAK case 123: YY_RULE_SETUP #line 289 "src/l.l" { return HTTPS; } YY_BREAK case 124: YY_RULE_SETUP #line 290 "src/l.l" { return APACHESTATUS; } YY_BREAK case 125: YY_RULE_SETUP #line 291 "src/l.l" { return FTP; } YY_BREAK case 126: YY_RULE_SETUP #line 292 "src/l.l" { return SMTP; } YY_BREAK case 127: YY_RULE_SETUP #line 293 "src/l.l" { return SMTPS; } YY_BREAK case 128: YY_RULE_SETUP #line 294 "src/l.l" { return POSTFIXPOLICY; } YY_BREAK case 129: YY_RULE_SETUP #line 295 "src/l.l" { return POP; } YY_BREAK case 130: YY_RULE_SETUP #line 296 "src/l.l" { return POPS; } YY_BREAK case 131: YY_RULE_SETUP #line 297 "src/l.l" { return IMAP; } YY_BREAK case 132: YY_RULE_SETUP #line 298 "src/l.l" { return IMAPS; } YY_BREAK case 133: YY_RULE_SETUP #line 299 "src/l.l" { return CLAMAV; } YY_BREAK case 134: YY_RULE_SETUP #line 300 "src/l.l" { return DNS; } YY_BREAK case 135: YY_RULE_SETUP #line 301 "src/l.l" { return MYSQL; } YY_BREAK case 136: YY_RULE_SETUP #line 302 "src/l.l" { return NNTP; } YY_BREAK case 137: YY_RULE_SETUP #line 303 "src/l.l" { return NTP3; } YY_BREAK case 138: YY_RULE_SETUP #line 304 "src/l.l" { return SSH; } YY_BREAK case 139: YY_RULE_SETUP #line 305 "src/l.l" { return REDIS; } YY_BREAK case 140: YY_RULE_SETUP #line 306 "src/l.l" { return MONGODB; } YY_BREAK case 141: YY_RULE_SETUP #line 307 "src/l.l" { return FAIL2BAN; } YY_BREAK case 142: YY_RULE_SETUP #line 308 "src/l.l" { return SIEVE; } YY_BREAK case 143: YY_RULE_SETUP #line 309 "src/l.l" { return SPAMASSASSIN; } YY_BREAK case 144: YY_RULE_SETUP #line 310 "src/l.l" { return DWP; } YY_BREAK case 145: YY_RULE_SETUP #line 311 "src/l.l" { return LDAP2; } YY_BREAK case 146: YY_RULE_SETUP #line 312 "src/l.l" { return LDAP3; } YY_BREAK case 147: YY_RULE_SETUP #line 313 "src/l.l" { return RDATE; } YY_BREAK case 148: YY_RULE_SETUP #line 314 "src/l.l" { return LMTP; } YY_BREAK case 149: YY_RULE_SETUP #line 315 "src/l.l" { return RSYNC; } YY_BREAK case 150: YY_RULE_SETUP #line 316 "src/l.l" { return TNS; } YY_BREAK case 151: YY_RULE_SETUP #line 317 "src/l.l" { return PGSQL; } YY_BREAK case 152: YY_RULE_SETUP #line 318 "src/l.l" { return WEBSOCKET; } YY_BREAK case 153: YY_RULE_SETUP #line 319 "src/l.l" { return MQTT; } YY_BREAK case 154: YY_RULE_SETUP #line 320 "src/l.l" { return ORIGIN; } YY_BREAK case 155: YY_RULE_SETUP #line 321 "src/l.l" { return VERSIONOPT; } YY_BREAK case 156: YY_RULE_SETUP #line 322 "src/l.l" { return SIP; } YY_BREAK case 157: YY_RULE_SETUP #line 323 "src/l.l" { return GPS; } YY_BREAK case 158: YY_RULE_SETUP #line 324 "src/l.l" { return RADIUS; } YY_BREAK case 159: YY_RULE_SETUP #line 325 "src/l.l" { return MEMCACHE; } YY_BREAK case 160: YY_RULE_SETUP #line 326 "src/l.l" { return TARGET; } YY_BREAK case 161: YY_RULE_SETUP #line 327 "src/l.l" { return MAXFORWARD; } YY_BREAK case 162: YY_RULE_SETUP #line 328 "src/l.l" { return MODE; } YY_BREAK case 163: YY_RULE_SETUP #line 329 "src/l.l" { return ACTIVE; } YY_BREAK case 164: YY_RULE_SETUP #line 330 "src/l.l" { return PASSIVE; } YY_BREAK case 165: YY_RULE_SETUP #line 331 "src/l.l" { return MANUAL; } YY_BREAK case 166: YY_RULE_SETUP #line 332 "src/l.l" { return ONREBOOT; } YY_BREAK case 167: YY_RULE_SETUP #line 333 "src/l.l" { return NOSTART; } YY_BREAK case 168: YY_RULE_SETUP #line 334 "src/l.l" { return LASTSTATE; } YY_BREAK case 169: YY_RULE_SETUP #line 335 "src/l.l" { return UID; } YY_BREAK case 170: YY_RULE_SETUP #line 336 "src/l.l" { return EUID; } YY_BREAK case 171: YY_RULE_SETUP #line 337 "src/l.l" { return SECURITY; } YY_BREAK case 172: YY_RULE_SETUP #line 338 "src/l.l" { return ATTRIBUTE; } YY_BREAK case 173: YY_RULE_SETUP #line 339 "src/l.l" { return GID; } YY_BREAK case 174: YY_RULE_SETUP #line 340 "src/l.l" { return REQUEST; } YY_BREAK case 175: YY_RULE_SETUP #line 341 "src/l.l" { return SECRET; } YY_BREAK case 176: YY_RULE_SETUP #line 342 "src/l.l" { return LOGLIMIT; } YY_BREAK case 177: YY_RULE_SETUP #line 343 "src/l.l" { return CLOSELIMIT; } YY_BREAK case 178: YY_RULE_SETUP #line 344 "src/l.l" { return DNSLIMIT; } YY_BREAK case 179: YY_RULE_SETUP #line 345 "src/l.l" { return KEEPALIVELIMIT; } YY_BREAK case 180: YY_RULE_SETUP #line 346 "src/l.l" { return REPLYLIMIT; } YY_BREAK case 181: YY_RULE_SETUP #line 347 "src/l.l" { return REQUESTLIMIT; } YY_BREAK case 182: YY_RULE_SETUP #line 348 "src/l.l" { return STARTLIMIT; } YY_BREAK case 183: YY_RULE_SETUP #line 349 "src/l.l" { return WAITLIMIT; } YY_BREAK case 184: YY_RULE_SETUP #line 350 "src/l.l" { return GRACEFULLIMIT; } YY_BREAK case 185: YY_RULE_SETUP #line 351 "src/l.l" { return CLEANUPLIMIT; } YY_BREAK case 186: YY_RULE_SETUP #line 352 "src/l.l" { return MEMORY; } YY_BREAK case 187: YY_RULE_SETUP #line 353 "src/l.l" { return SWAP; } YY_BREAK case 188: YY_RULE_SETUP #line 354 "src/l.l" { return TOTALMEMORY; } YY_BREAK case 189: YY_RULE_SETUP #line 355 "src/l.l" { return CORE; } YY_BREAK case 190: YY_RULE_SETUP #line 356 "src/l.l" { return CPU; } YY_BREAK case 191: YY_RULE_SETUP #line 357 "src/l.l" { return TOTALCPU; } YY_BREAK case 192: YY_RULE_SETUP #line 358 "src/l.l" { return CHILDREN; } YY_BREAK case 193: YY_RULE_SETUP #line 359 "src/l.l" { return THREADS; } YY_BREAK case 194: YY_RULE_SETUP #line 360 "src/l.l" { return TIME; } YY_BREAK case 195: YY_RULE_SETUP #line 361 "src/l.l" { return CHANGED; } YY_BREAK case 196: YY_RULE_SETUP #line 362 "src/l.l" { return SSLV2; } YY_BREAK case 197: YY_RULE_SETUP #line 363 "src/l.l" { return SSLV3; } YY_BREAK case 198: YY_RULE_SETUP #line 364 "src/l.l" { return TLSV1; } YY_BREAK case 199: YY_RULE_SETUP #line 365 "src/l.l" { return TLSV11; } YY_BREAK case 200: YY_RULE_SETUP #line 366 "src/l.l" { return TLSV12; } YY_BREAK case 201: YY_RULE_SETUP #line 367 "src/l.l" { return TLSV13; } YY_BREAK case 202: YY_RULE_SETUP #line 368 "src/l.l" { return CIPHER; } YY_BREAK case 203: YY_RULE_SETUP #line 369 "src/l.l" { return AUTO; } YY_BREAK case 204: YY_RULE_SETUP #line 370 "src/l.l" { return SSLAUTO; } YY_BREAK case 205: YY_RULE_SETUP #line 371 "src/l.l" { return INODE; } YY_BREAK case 206: YY_RULE_SETUP #line 372 "src/l.l" { return SPACE; } YY_BREAK case 207: YY_RULE_SETUP #line 373 "src/l.l" { return TFREE; } YY_BREAK case 208: YY_RULE_SETUP #line 374 "src/l.l" { return PERMISSION; } YY_BREAK case 209: YY_RULE_SETUP #line 375 "src/l.l" { return EXEC; } YY_BREAK case 210: YY_RULE_SETUP #line 376 "src/l.l" { return SIZE; } YY_BREAK case 211: YY_RULE_SETUP #line 377 "src/l.l" { return UPTIME; } YY_BREAK case 212: YY_RULE_SETUP #line 378 "src/l.l" { return BASEDIR; } YY_BREAK case 213: YY_RULE_SETUP #line 379 "src/l.l" { return SLOT; } YY_BREAK case 214: YY_RULE_SETUP #line 380 "src/l.l" { return EVENTQUEUE; } YY_BREAK case 215: YY_RULE_SETUP #line 381 "src/l.l" { return MATCH; } YY_BREAK case 216: YY_RULE_SETUP #line 382 "src/l.l" { return NOT; } YY_BREAK case 217: YY_RULE_SETUP #line 383 "src/l.l" { return IGNORE; } YY_BREAK case 218: YY_RULE_SETUP #line 384 "src/l.l" { return CONNECTION; } YY_BREAK case 219: YY_RULE_SETUP #line 385 "src/l.l" { return UNMONITOR; } YY_BREAK case 220: YY_RULE_SETUP #line 386 "src/l.l" { return ACTION; } YY_BREAK case 221: YY_RULE_SETUP #line 387 "src/l.l" { return ICMP; } YY_BREAK case 222: YY_RULE_SETUP #line 388 "src/l.l" { return PING; } YY_BREAK case 223: YY_RULE_SETUP #line 389 "src/l.l" { return PING4; } YY_BREAK case 224: YY_RULE_SETUP #line 390 "src/l.l" { return PING6; } YY_BREAK case 225: YY_RULE_SETUP #line 391 "src/l.l" { return ICMPECHO; } YY_BREAK case 226: YY_RULE_SETUP #line 392 "src/l.l" { return SEND; } YY_BREAK case 227: YY_RULE_SETUP #line 393 "src/l.l" { return EXPECT; } YY_BREAK case 228: YY_RULE_SETUP #line 394 "src/l.l" { return EXPECTBUFFER; } YY_BREAK case 229: YY_RULE_SETUP #line 395 "src/l.l" { return LIMITS; } YY_BREAK case 230: YY_RULE_SETUP #line 396 "src/l.l" { return SENDEXPECTBUFFER; } YY_BREAK case 231: YY_RULE_SETUP #line 397 "src/l.l" { return FILECONTENTBUFFER; } YY_BREAK case 232: YY_RULE_SETUP #line 398 "src/l.l" { return HTTPCONTENTBUFFER; } YY_BREAK case 233: YY_RULE_SETUP #line 399 "src/l.l" { return PROGRAMOUTPUT; } YY_BREAK case 234: YY_RULE_SETUP #line 400 "src/l.l" { return NETWORKTIMEOUT; } YY_BREAK case 235: YY_RULE_SETUP #line 401 "src/l.l" { return PROGRAMTIMEOUT; } YY_BREAK case 236: YY_RULE_SETUP #line 402 "src/l.l" { return STOPTIMEOUT; } YY_BREAK case 237: YY_RULE_SETUP #line 403 "src/l.l" { return STARTTIMEOUT; } YY_BREAK case 238: YY_RULE_SETUP #line 404 "src/l.l" { return RESTARTTIMEOUT; } YY_BREAK case 239: YY_RULE_SETUP #line 405 "src/l.l" { return CLEARTEXT; } YY_BREAK case 240: YY_RULE_SETUP #line 406 "src/l.l" { return MD5HASH; } YY_BREAK case 241: YY_RULE_SETUP #line 407 "src/l.l" { return SHA1HASH; } YY_BREAK case 242: YY_RULE_SETUP #line 408 "src/l.l" { return CRYPT; } YY_BREAK case 243: YY_RULE_SETUP #line 409 "src/l.l" { return SIGNATURE; } YY_BREAK case 244: YY_RULE_SETUP #line 410 "src/l.l" { return NONEXIST; } YY_BREAK case 245: YY_RULE_SETUP #line 411 "src/l.l" { return EXIST; } YY_BREAK case 246: YY_RULE_SETUP #line 412 "src/l.l" { return INVALID; } YY_BREAK case 247: YY_RULE_SETUP #line 413 "src/l.l" { return DATA; } YY_BREAK case 248: YY_RULE_SETUP #line 414 "src/l.l" { return RECOVERED; } YY_BREAK case 249: YY_RULE_SETUP #line 415 "src/l.l" { return PASSED; } YY_BREAK case 250: YY_RULE_SETUP #line 416 "src/l.l" { return SUCCEEDED; } YY_BREAK case 251: YY_RULE_SETUP #line 417 "src/l.l" { return ELSE; } YY_BREAK case 252: YY_RULE_SETUP #line 418 "src/l.l" { return MMONIT; } YY_BREAK case 253: YY_RULE_SETUP #line 419 "src/l.l" { return URL; } YY_BREAK case 254: YY_RULE_SETUP #line 420 "src/l.l" { return CONTENT; } YY_BREAK case 255: YY_RULE_SETUP #line 421 "src/l.l" { return PID; } YY_BREAK case 256: YY_RULE_SETUP #line 422 "src/l.l" { return PPID; } YY_BREAK case 257: YY_RULE_SETUP #line 423 "src/l.l" { return COUNT; } YY_BREAK case 258: YY_RULE_SETUP #line 424 "src/l.l" { return REPEAT; } YY_BREAK case 259: YY_RULE_SETUP #line 425 "src/l.l" { return REMINDER; } YY_BREAK case 260: YY_RULE_SETUP #line 426 "src/l.l" { return INSTANCE; } YY_BREAK case 261: YY_RULE_SETUP #line 427 "src/l.l" { return HOSTNAME; } YY_BREAK case 262: YY_RULE_SETUP #line 428 "src/l.l" { return USERNAME; } YY_BREAK case 263: YY_RULE_SETUP #line 429 "src/l.l" { return PASSWORD; } YY_BREAK case 264: YY_RULE_SETUP #line 430 "src/l.l" { return CREDENTIALS; } YY_BREAK case 265: YY_RULE_SETUP #line 431 "src/l.l" { return REGISTER; } YY_BREAK case 266: YY_RULE_SETUP #line 432 "src/l.l" { return FSFLAG; } YY_BREAK case 267: YY_RULE_SETUP #line 433 "src/l.l" { return FIPS; } YY_BREAK case 268: YY_RULE_SETUP #line 434 "src/l.l" { return BYTE; } YY_BREAK case 269: YY_RULE_SETUP #line 435 "src/l.l" { return KILOBYTE; } YY_BREAK case 270: YY_RULE_SETUP #line 436 "src/l.l" { return MEGABYTE; } YY_BREAK case 271: YY_RULE_SETUP #line 437 "src/l.l" { return GIGABYTE; } YY_BREAK case 272: YY_RULE_SETUP #line 438 "src/l.l" { return LOADAVG1; } YY_BREAK case 273: YY_RULE_SETUP #line 439 "src/l.l" { return LOADAVG5; } YY_BREAK case 274: YY_RULE_SETUP #line 440 "src/l.l" { return LOADAVG15; } YY_BREAK case 275: YY_RULE_SETUP #line 441 "src/l.l" { return CPUUSER; } YY_BREAK case 276: YY_RULE_SETUP #line 442 "src/l.l" { return CPUSYSTEM; } YY_BREAK case 277: YY_RULE_SETUP #line 443 "src/l.l" { return CPUWAIT; } YY_BREAK case 278: YY_RULE_SETUP #line 444 "src/l.l" { return GREATER; } YY_BREAK case 279: YY_RULE_SETUP #line 445 "src/l.l" { return GREATEROREQUAL; } YY_BREAK case 280: YY_RULE_SETUP #line 446 "src/l.l" { return LESS; } YY_BREAK case 281: YY_RULE_SETUP #line 447 "src/l.l" { return LESSOREQUAL; } YY_BREAK case 282: YY_RULE_SETUP #line 448 "src/l.l" { return EQUAL; } YY_BREAK case 283: YY_RULE_SETUP #line 449 "src/l.l" { return NOTEQUAL; } YY_BREAK case 284: YY_RULE_SETUP #line 450 "src/l.l" { return MILLISECOND; } YY_BREAK case 285: YY_RULE_SETUP #line 451 "src/l.l" { return SECOND; } YY_BREAK case 286: YY_RULE_SETUP #line 452 "src/l.l" { return MINUTE; } YY_BREAK case 287: YY_RULE_SETUP #line 453 "src/l.l" { return HOUR; } YY_BREAK case 288: YY_RULE_SETUP #line 454 "src/l.l" { return DAY; } YY_BREAK case 289: YY_RULE_SETUP #line 455 "src/l.l" { return MONTH; } YY_BREAK case 290: YY_RULE_SETUP #line 456 "src/l.l" { return ATIME; } YY_BREAK case 291: YY_RULE_SETUP #line 457 "src/l.l" { return CTIME; } YY_BREAK case 292: YY_RULE_SETUP #line 458 "src/l.l" { return MTIME; } YY_BREAK case 293: YY_RULE_SETUP #line 460 "src/l.l" { BEGIN(INCLUDE); } YY_BREAK case 294: YY_RULE_SETUP #line 462 "src/l.l" { BEGIN(EVERY_COND); return NOTEVERY; } YY_BREAK case 295: YY_RULE_SETUP #line 467 "src/l.l" { BEGIN(EVERY_COND); return EVERY; } YY_BREAK case 296: YY_RULE_SETUP #line 472 "src/l.l" { BEGIN(DEPEND_COND); return DEPENDS; } YY_BREAK case 297: YY_RULE_SETUP #line 477 "src/l.l" { BEGIN(SERVICE_COND); check_state = Proc_State; return CHECKPROC; } YY_BREAK case 298: YY_RULE_SETUP #line 483 "src/l.l" { BEGIN(SERVICE_COND); check_state = Program_State; return CHECKPROGRAM; } YY_BREAK case 299: YY_RULE_SETUP #line 489 "src/l.l" { /* Filesystem alias for backward compatibility */ BEGIN(SERVICE_COND); check_state = FileSys_State; return CHECKFILESYS; } YY_BREAK case 300: YY_RULE_SETUP #line 495 "src/l.l" { BEGIN(SERVICE_COND); check_state = FileSys_State; return CHECKFILESYS; } YY_BREAK case 301: YY_RULE_SETUP #line 501 "src/l.l" { BEGIN(SERVICE_COND); check_state = File_State; return CHECKFILE; } YY_BREAK case 302: YY_RULE_SETUP #line 507 "src/l.l" { BEGIN(SERVICE_COND); check_state = Dir_State; return CHECKDIR; } YY_BREAK case 303: YY_RULE_SETUP #line 513 "src/l.l" { BEGIN(SERVICE_COND); check_state = Host_State; return CHECKHOST; } YY_BREAK case 304: YY_RULE_SETUP #line 519 "src/l.l" { BEGIN(SERVICE_COND); check_state = Net_State; return CHECKNET; } YY_BREAK case 305: YY_RULE_SETUP #line 525 "src/l.l" { BEGIN(SERVICE_COND); check_state = Fifo_State; return CHECKFIFO; } YY_BREAK case 306: YY_RULE_SETUP #line 531 "src/l.l" { BEGIN(SERVICE_COND); check_state = Program_State; return CHECKPROGRAM; } YY_BREAK case 307: YY_RULE_SETUP #line 537 "src/l.l" { BEGIN(SERVICE_COND); check_state = System_State; return CHECKSYSTEM; } YY_BREAK case 308: YY_RULE_SETUP #line 543 "src/l.l" { BEGIN(STRING_COND); return GROUP; } YY_BREAK case 309: YY_RULE_SETUP #line 548 "src/l.l" { BEGIN(HTTP_HEADER_COND); return '['; } YY_BREAK case 310: YY_RULE_SETUP #line 553 "src/l.l" { yylval.url = create_URL(Str_ndup(yytext, strlen(yytext)-3)); BEGIN(URL_COND); } YY_BREAK case 311: YY_RULE_SETUP #line 558 "src/l.l" { yylval.number = atoi(yytext); save_arg(); return NUMBER; } YY_BREAK case 312: YY_RULE_SETUP #line 564 "src/l.l" { yylval.real = atof(yytext); save_arg(); return REAL; } YY_BREAK case 313: YY_RULE_SETUP #line 570 "src/l.l" { return PERCENT; } YY_BREAK case 314: YY_RULE_SETUP #line 574 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return STRING; } YY_BREAK case 315: YY_RULE_SETUP #line 580 "src/l.l" { yylval.string = handle_quoted_string(yytext); save_arg(); return PATH; } YY_BREAK case 316: YY_RULE_SETUP #line 586 "src/l.l" { yylval.string = handle_quoted_string(yytext); save_arg(); return PATH; } YY_BREAK case 317: /* rule 317 can match eol */ YY_RULE_SETUP #line 592 "src/l.l" { steplinenobycr(yytext); yylval.string = handle_quoted_string(yytext); save_arg(); return STRING; } YY_BREAK case 318: /* rule 318 can match eol */ YY_RULE_SETUP #line 599 "src/l.l" { steplinenobycr(yytext); yylval.string = handle_quoted_string(yytext); save_arg(); return STRING; } YY_BREAK case 319: YY_RULE_SETUP #line 606 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return MAILADDR; } YY_BREAK case 320: YY_RULE_SETUP #line 612 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return PATH; } YY_BREAK case 321: YY_RULE_SETUP #line 618 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return PATH; } YY_BREAK case 322: YY_RULE_SETUP #line 624 "src/l.l" { yylval.address = Address_new(); BEGIN(ADDRESS_COND); return MAILFROM; } YY_BREAK case 323: YY_RULE_SETUP #line 630 "src/l.l" { yylval.address = Address_new(); BEGIN(ADDRESS_COND); return MAILREPLYTO; } YY_BREAK case 324: YY_RULE_SETUP #line 636 "src/l.l" { char *p = yytext+strlen("subject:"); yylval.string = Str_trim(Str_dup(p)); save_arg(); return MAILSUBJECT; } YY_BREAK case 325: /* rule 325 can match eol */ YY_RULE_SETUP #line 643 "src/l.l" { char *p = yytext+strlen("message:"); steplinenobycr(yytext); yylval.string = Str_trim(Str_dup(p)); save_arg(); return MAILBODY; } YY_BREAK case 326: YY_RULE_SETUP #line 651 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return STRING; } YY_BREAK case 327: YY_RULE_SETUP #line 657 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return STRING; } YY_BREAK case 328: YY_RULE_SETUP #line 663 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return STRING; } YY_BREAK case 329: YY_RULE_SETUP #line 669 "src/l.l" { yyerror("unbalanced quotes"); } YY_BREAK case 330: YY_RULE_SETUP #line 675 "src/l.l" ; YY_BREAK case 331: /* rule 331 can match eol */ YY_RULE_SETUP #line 677 "src/l.l" { lineno++; } YY_BREAK case 332: YY_RULE_SETUP #line 681 "src/l.l" { yylval.string = Str_dup(yytext); BEGIN(INITIAL); save_arg(); return SERVICENAME; } YY_BREAK case 333: YY_RULE_SETUP #line 688 "src/l.l" { yylval.string = handle_quoted_string(yytext); BEGIN(INITIAL); save_arg(); return SERVICENAME; } YY_BREAK case 334: YY_RULE_SETUP #line 695 "src/l.l" { yylval.string = handle_quoted_string(yytext); BEGIN(INITIAL); save_arg(); return SERVICENAME; } YY_BREAK case 335: YY_RULE_SETUP #line 702 "src/l.l" { yyerror("unbalanced quotes"); } YY_BREAK case 336: YY_RULE_SETUP #line 710 "src/l.l" ; YY_BREAK case 337: /* rule 337 can match eol */ YY_RULE_SETUP #line 712 "src/l.l" { lineno++; } YY_BREAK case 338: YY_RULE_SETUP #line 716 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return SERVICENAME; } YY_BREAK case 339: YY_RULE_SETUP #line 722 "src/l.l" { yylval.string = handle_quoted_string(yytext); save_arg(); return SERVICENAME; } YY_BREAK case 340: YY_RULE_SETUP #line 728 "src/l.l" { yylval.string = handle_quoted_string(yytext); save_arg(); return SERVICENAME; } YY_BREAK case 341: /* rule 341 can match eol */ YY_RULE_SETUP #line 734 "src/l.l" { steplinenobycr(yytext); unput(yytext[strlen(yytext)-1]); BEGIN(INITIAL); } YY_BREAK case 342: YY_RULE_SETUP #line 744 "src/l.l" ; YY_BREAK case 343: /* rule 343 can match eol */ YY_RULE_SETUP #line 746 "src/l.l" { lineno++; } YY_BREAK case 344: YY_RULE_SETUP #line 750 "src/l.l" { BEGIN(INITIAL); } YY_BREAK case 345: /* rule 345 can match eol */ YY_RULE_SETUP #line 754 "src/l.l" { steplinenobycr(yytext); yylval.string = handle_quoted_string(yytext); save_arg(); return STRING; } YY_BREAK case 346: YY_RULE_SETUP #line 761 "src/l.l" { yyerror("unbalanced quotes"); } YY_BREAK case 347: YY_RULE_SETUP #line 765 "src/l.l" { yylval.string = Str_dup(yytext); save_arg(); return STRING; } YY_BREAK case 348: /* rule 348 can match eol */ YY_RULE_SETUP #line 775 "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 349: /* rule 349 can match eol */ YY_RULE_SETUP #line 793 "src/l.l" { yylval.url->user = Str_dup(yytext); } YY_BREAK case 350: /* rule 350 can match eol */ YY_RULE_SETUP #line 797 "src/l.l" { yytext++; yylval.url->password = Str_ndup(yytext, strlen(yytext)-1); } YY_BREAK case 351: YY_RULE_SETUP #line 802 "src/l.l" { yylval.url->hostname = Str_dup(yytext); } YY_BREAK case 352: YY_RULE_SETUP #line 806 "src/l.l" { yylval.url->hostname = Str_ndup(yytext + 1, yyleng - 2); yylval.url->ipv6 = true; } YY_BREAK case 353: YY_RULE_SETUP #line 811 "src/l.l" { yylval.url->port = atoi(++yytext); } YY_BREAK case 354: YY_RULE_SETUP #line 815 "src/l.l" { yylval.url->path = Util_urlEncode(yytext, false); } YY_BREAK case 355: YY_RULE_SETUP #line 819 "src/l.l" { yylval.url->query = Util_urlEncode(++yytext, false); } YY_BREAK case 356: YY_RULE_SETUP #line 823 "src/l.l" { /* EMPTY - reference is ignored */ } YY_BREAK case 357: /* rule 357 can match eol */ YY_RULE_SETUP #line 831 "src/l.l" { if (yytext[0] == '}') yyless(0); BEGIN(INITIAL); if (! yylval.address->address) yyerror("missing address"); save_arg(); return ADDRESSOBJECT; } YY_BREAK case 358: YY_RULE_SETUP #line 841 "src/l.l" { yylval.address->address = Str_dup(yytext); } YY_BREAK case 359: YY_RULE_SETUP #line 845 "src/l.l" { char *name = Str_unquote(Str_dup(yytext)); if (name && *name) yylval.address->name = Str_unquote(Str_dup(yytext)); } YY_BREAK case 360: YY_RULE_SETUP #line 851 "src/l.l" { // Ignore } YY_BREAK case 361: YY_RULE_SETUP #line 855 "src/l.l" { BEGIN(INITIAL); yyerror("invalid mail format"); } YY_BREAK case 362: YY_RULE_SETUP #line 863 "src/l.l" { yylval.string = Str_dup(yytext); BEGIN(INITIAL); save_arg(); return STRINGNAME; } YY_BREAK case 363: YY_RULE_SETUP #line 870 "src/l.l" { yylval.string = handle_quoted_string(yytext); BEGIN(INITIAL); save_arg(); return STRINGNAME; } YY_BREAK case 364: YY_RULE_SETUP #line 877 "src/l.l" { yylval.string = handle_quoted_string(yytext); BEGIN(INITIAL); save_arg(); return STRINGNAME; } YY_BREAK case 365: YY_RULE_SETUP #line 884 "src/l.l" { yyerror("unbalanced quotes"); } YY_BREAK case 366: YY_RULE_SETUP #line 892 "src/l.l" ; YY_BREAK case 367: YY_RULE_SETUP #line 894 "src/l.l" { yylval.number = atoi(yytext); BEGIN(INITIAL); save_arg(); return NUMBER; } YY_BREAK case 368: YY_RULE_SETUP #line 901 "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 369: YY_RULE_SETUP #line 908 "src/l.l" { BEGIN(INITIAL); yyerror("invalid every format"); } YY_BREAK case 370: YY_RULE_SETUP #line 917 "src/l.l" ; YY_BREAK case 371: YY_RULE_SETUP #line 919 "src/l.l" ; YY_BREAK case 372: /* rule 372 can match eol */ YY_RULE_SETUP #line 921 "src/l.l" { lineno++; } YY_BREAK case 373: *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 925 "src/l.l" { // name/: save_arg(); } YY_BREAK case 374: /* rule 374 can match eol */ YY_RULE_SETUP #line 929 "src/l.l" { // : value yylval.string = Str_cat("%s:%s", Str_trim(argyytext), Str_unquote(yytext + 1)); save_arg(); return HTTPHEADER; } YY_BREAK case 375: YY_RULE_SETUP #line 935 "src/l.l" { BEGIN(INITIAL); save_arg(); return ']'; } YY_BREAK case 376: YY_RULE_SETUP #line 941 "src/l.l" { BEGIN(INITIAL); yyerror("invalid HTTP header list format"); } YY_BREAK case 377: YY_RULE_SETUP #line 949 "src/l.l" { check_state = None_State; return yytext[0]; } YY_BREAK case 378: YY_RULE_SETUP #line 955 "src/l.l" /* eat the whitespace */ YY_BREAK case 379: YY_RULE_SETUP #line 957 "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 380: YY_RULE_SETUP #line 965 "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 381: YY_RULE_SETUP #line 973 "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(EVERY_COND): case YY_STATE_EOF(HTTP_HEADER_COND): case YY_STATE_EOF(INCLUDE): #line 981 "src/l.l" { BEGIN(INITIAL); check_state = None_State; if (! pop_buffer_state()) yyterminate(); } YY_BREAK case 382: YY_RULE_SETUP #line 989 "src/l.l" ECHO; YY_BREAK #line 8558 "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 >= 2619 ) 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 >= 2619 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 2618); 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 989 "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); Util_handleEscapes(buf); 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), (char *)path); } static void include_file(char *pattern) { glob_t globbuf; errno = 0; if (glob(pattern, GLOB_MARK, NULL, &globbuf) == 0) { for (int 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, 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; } monit-5.26.0/src/state.c0000664000175000017500000006354313507751326014741 0ustar martinpmartinp/* * 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]; int32_t type; int32_t monitor; int32_t nstart; int32_t ncycle; union { struct { uint64_t atime; uint64_t ctime; uint64_t mtime; int32_t mode; } directory; struct { uint64_t inode; uint64_t readpos; uint64_t size; uint64_t atime; uint64_t ctime; uint64_t mtime; int32_t mode; MD_T hash; } file; struct { uint64_t atime; uint64_t ctime; uint64_t mtime; int32_t mode; } fifo; struct { int32_t mode; } filesystem; struct { int32_t duplex; int64_t 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]; int32_t type; int32_t monitor; int32_t nstart; int32_t ncycle; union { struct { uint64_t timestamp; int32_t mode; } directory; struct { uint64_t inode; uint64_t readpos; uint64_t size; uint64_t timestamp; int32_t mode; MD_T hash; } file; struct { uint64_t timestamp; int32_t mode; } fifo; struct { int32_t mode; int32_t flags; // Obsolete since Monit 5.21.0 } filesystem; struct { int32_t duplex; int64_t 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]; int32_t type; int32_t monitor; int32_t nstart; int32_t ncycle; union { struct { uint64_t inode; uint64_t 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; uint64_t error; // obsolete since Monit 5.0 } State0_T; static int file = -1; static uint64_t booted = 0ULL; static boolean_t _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 (systeminfo.booted == booted || 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; } } static void _updateFilePosition(Service_T S, uint64_t inode, uint64_t readpos) { S->inf.file->inode = (ino_t)inode; S->inf.file->readpos = (off_t)readpos; } static void _updateTimestamp(Service_T S, uint64_t atime, uint64_t ctime, uint64_t 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, int64_t 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, int64_t speed) { for (LinkSpeed_T l = S->linkspeedlist; l; l = l->next) { l->duplex = duplex; l->speed = speed; } } static void _restoreV4() { // 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() { // 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() { // System header booted = systeminfo.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() { // System header booted = systeminfo.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 = systeminfo.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 */ boolean_t State_open() { State_close(); if ((file = open(Run.files.state, O_RDWR | O_CREAT, 0600)) == -1) { LogError("State file '%s': cannot open for write -- %s\n", Run.files.state, STRERROR); return false; } atexit(State_close); return true; } void State_close() { if (file != -1) { if (close(file) == -1) LogError("State file '%s': close error -- %s\n", Run.files.state, STRERROR); else file = -1; } } void State_save() { 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, &systeminfo.booted, sizeof(systeminfo.booted)) != sizeof(systeminfo.booted)) { THROW(IOException, "Unable to write system boot time"); } for (Service_T service = servicelist; 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 = (uint64_t)service->inf.directory->timestamp.access; state.priv.directory.ctime = (uint64_t)service->inf.directory->timestamp.change; state.priv.directory.mtime = (uint64_t)service->inf.directory->timestamp.modify; state.priv.directory.mode = service->inf.directory->mode; break; case Service_Fifo: state.priv.fifo.atime = (uint64_t)service->inf.fifo->timestamp.access; state.priv.fifo.ctime = (uint64_t)service->inf.fifo->timestamp.change; state.priv.fifo.mtime = (uint64_t)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 = (int64_t)service->inf.file->size; state.priv.file.atime = (uint64_t)service->inf.file->timestamp.access; state.priv.file.ctime = (uint64_t)service->inf.file->timestamp.change; state.priv.file.mtime = (uint64_t)service->inf.file->timestamp.modify; state.priv.file.mode = service->inf.file->mode; strncpy(state.priv.file.hash, service->inf.file->cs_sum, sizeof(state.priv.file.hash) - 1); 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 { LogError("State file '%s': %s\n", Run.files.state, Exception_frame.message); } END_TRY; } void State_dirty() { _stateDirty = true; } void State_saveIfDirty() { if (_stateDirty) { State_save(); } } void State_restore() { /* 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: LogWarning("State file '%s': incompatible version %d\n", Run.files.state, version); break; } if (version != StateVersionLatest || booted != systeminfo.booted) { _stateDirty = true; } } } ELSE { LogError("State file '%s': %s\n", Run.files.state, Exception_frame.message); } END_TRY; } boolean_t State_reboot() { return systeminfo.booted == booted ? false : true; } monit-5.26.0/src/net.h0000664000175000017500000000563413507751326014411 0ustar martinpmartinp/* * 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 incomming 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 incomming 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 succes, -1 on error */ double icmp_echo(const char *hostname, Socket_Family family, Outgoing_T *outgoing, int size, int timeout, int count); #endif monit-5.26.0/src/validate.c0000664000175000017500000032462113507751326015407 0ustar martinpmartinp /* * 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 "socket.h" #include "net.h" #include "device.h" #include "ProcessTree.h" #include "protocol.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 = 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->response, (char[11]){})); } ELSE { rv = 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) { if (retry_count-- > 1) { LogWarning("'%s' %s (attempt %d/%d)\n", s->name, report, p->retry - retry_count, p->retry); goto retry; } Event_post(s, Event_Connection, State_Failed, p->action, "%s", report); } else { Event_post(s, Event_Connection, State_Succeeded, p->action, "connection succeeded to %s", Util_portDescription(p, buf, sizeof(buf))); } 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; } /** * 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, operatorshortnames[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, operatorshortnames[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, operatorshortnames[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), operatorshortnames[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, operatorshortnames[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, operatorshortnames[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), operatorshortnames[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, operatorshortnames[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]){}), operatorshortnames[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_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, operatorshortnames[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]){}), operatorshortnames[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_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, operatorshortnames[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; default: LogError("'%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 _checkLoadAverage(Resource_T r, double loadavg, 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, operatorshortnames[r->operator], r->limit); return State_Failed; } snprintf(report, STRLEN, "%s check succeeded [current %s = %.1f]", name, name, loadavg); return State_Succeeded; } 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 = #ifdef HAVE_CPU_WAIT (systeminfo.cpu.usage.wait > 0. ? systeminfo.cpu.usage.wait : 0.) + #endif (systeminfo.cpu.usage.system > 0. ? systeminfo.cpu.usage.system : 0.) + (systeminfo.cpu.usage.user > 0. ? systeminfo.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, operatorshortnames[r->operator], r->limit); } else { snprintf(report, STRLEN, "cpu usage check succeeded [current cpu usage = %.1f%%]", cpu); } } break; case Resource_CpuUser: if (systeminfo.cpu.usage.user < 0.) { DEBUG("'%s' cpu user usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, systeminfo.cpu.usage.user, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "cpu user usage of %.1f%% matches resource limit [cpu user usage %s %.1f%%]", systeminfo.cpu.usage.user, operatorshortnames[r->operator], r->limit); } else { snprintf(report, STRLEN, "cpu user usage check succeeded [current cpu user usage = %.1f%%]", systeminfo.cpu.usage.user); } break; case Resource_CpuSystem: if (systeminfo.cpu.usage.system < 0.) { DEBUG("'%s' cpu system usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, systeminfo.cpu.usage.system, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "cpu system usage of %.1f%% matches resource limit [cpu system usage %s %.1f%%]", systeminfo.cpu.usage.system, operatorshortnames[r->operator], r->limit); } else { snprintf(report, STRLEN, "cpu system usage check succeeded [current cpu system usage = %.1f%%]", systeminfo.cpu.usage.system); } break; case Resource_CpuWait: if (systeminfo.cpu.usage.wait < 0.) { DEBUG("'%s' cpu wait usage check skipped (initializing)\n", s->name); return State_Init; } else if (Util_evalDoubleQExpression(r->operator, systeminfo.cpu.usage.wait, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "cpu wait usage of %.1f%% matches resource limit [cpu wait usage %s %.1f%%]", systeminfo.cpu.usage.wait, operatorshortnames[r->operator], r->limit); } else { snprintf(report, STRLEN, "cpu wait usage check succeeded [current cpu wait usage = %.1f%%]", systeminfo.cpu.usage.wait); } break; case Resource_MemoryPercent: if (Util_evalDoubleQExpression(r->operator, systeminfo.memory.usage.percent, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "mem usage of %.1f%% matches resource limit [mem usage %s %.1f%%]", systeminfo.memory.usage.percent, operatorshortnames[r->operator], r->limit); } else { snprintf(report, STRLEN, "mem usage check succeeded [current mem usage = %.1f%%]", systeminfo.memory.usage.percent); } break; case Resource_MemoryKbyte: if (Util_evalDoubleQExpression(r->operator, systeminfo.memory.usage.bytes, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "mem amount of %s matches resource limit [mem amount %s %s]", Fmt_bytes2str(systeminfo.memory.usage.bytes, buf1), operatorshortnames[r->operator], Fmt_bytes2str(r->limit, buf2)); } else { snprintf(report, STRLEN, "mem amount check succeeded [current mem amount = %s]", Fmt_bytes2str(systeminfo.memory.usage.bytes, buf1)); } break; case Resource_SwapPercent: if (Util_evalDoubleQExpression(r->operator, systeminfo.swap.usage.percent, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "swap usage of %.1f%% matches resource limit [swap usage %s %.1f%%]", systeminfo.swap.usage.percent, operatorshortnames[r->operator], r->limit); } else { snprintf(report, STRLEN, "swap usage check succeeded [current swap usage = %.1f%%]", systeminfo.swap.usage.percent); } break; case Resource_SwapKbyte: if (s->type == Service_System) { if (Util_evalDoubleQExpression(r->operator, systeminfo.swap.usage.bytes, r->limit)) { rv = State_Failed; snprintf(report, STRLEN, "swap amount of %s matches resource limit [swap amount %s %s]", Fmt_bytes2str(systeminfo.swap.usage.bytes, buf1), operatorshortnames[r->operator], Fmt_bytes2str(r->limit, buf2)); } else { snprintf(report, STRLEN, "swap amount check succeeded [current swap amount = %s]", Fmt_bytes2str(systeminfo.swap.usage.bytes, buf1)); } } break; case Resource_LoadAverage1m: rv = _checkLoadAverage(r, systeminfo.loadavg[0], "loadavg (1min)", report); break; case Resource_LoadAverage5m: rv = _checkLoadAverage(r, systeminfo.loadavg[1], "loadavg (5min)", report); break; case Resource_LoadAverage15m: rv = _checkLoadAverage(r, systeminfo.loadavg[2], "loadavg (15min)", report); break; case Resource_LoadAveragePerCore1m: rv = _checkLoadAverage(r, systeminfo.loadavg[0] / (double)systeminfo.cpu.count, "loadavg per core (1min)", report); break; case Resource_LoadAveragePerCore5m: rv = _checkLoadAverage(r, systeminfo.loadavg[1] / (double)systeminfo.cpu.count, "loadavg per core (5min)", report); break; case Resource_LoadAveragePerCore15m: rv = _checkLoadAverage(r, systeminfo.loadavg[2] / (double)systeminfo.cpu.count, "loadavg per core (15min)", report); break; default: LogError("'%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 (Util_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; strncpy(cs->hash, s->inf.file->cs_sum, sizeof(cs->hash) - 1); } 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: LogError("'%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 */ strncpy(cs->hash, s->inf.file->cs_sum, sizeof(cs->hash) - 1); /* 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 != 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 != 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 (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; } /** * 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 != 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", timestampnames[t->type], s->path, t->lastTimestamp ? Time_string(t->lastTimestamp, (char[26]){}) : "N/A", Time_string(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", timestampnames[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", timestampnames[t->type], s->path, timestampnames[t->type], Time_string(timestamp, (char[26]){})); } else { Event_post(s, Event_Timestamp, State_Succeeded, t->action, "%s test succeeded for %s [current %s is %s]", timestampnames[t->type], s->path, timestampnames[t->type], Time_string(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 (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 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 %llu seconds", s->path, (unsigned long long)uptime); } else { Event_post(s, Event_Uptime, State_Succeeded, ul->action, "uptime test succeeded [current uptime = %llu seconds]", (unsigned long long)uptime); } } 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) { LogError("'%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 shrinked -> 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; LogError("'%s' cannot seek file %s: %s\n", s->name, s->path, STRERROR); goto final2; } if (! fgets(line, Run.limits.fileContentBuffer, file)) { if (! feof(file)) { rv = State_Failed; LogError("'%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(Run.limits.fileContentBuffer); if (StringBuffer_length(ml->log) < Run.limits.fileContentBuffer) { StringBuffer_append(ml->log, "%s\n", line); if (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; LogError("'%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)); 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); if (*(s->inf.filesystem->flags)) { if (s->inf.filesystem->flagsChanged) { s->inf.filesystem->flagsChanged = false; for (FsFlag_T l = s->fsflaglist; l; l = l->next) Event_post(s, Event_FsFlag, State_Changed, l->action, "filesystem flags changed to %s", s->inf.filesystem->flags); 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]", s->inf.filesystem->flags); 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)) { LogError("'%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, operatorshortnames[td->operator], td->limit_percent); return State_Failed; } } 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, operatorshortnames[td->operator], td->limit_absolute); return State_Failed; } } Event_post(s, Event_Resource, State_Succeeded, td->action, "inode usage test succeeded [current inode usage = %.1f%%]", s->inf.filesystem->inode_percent); 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, operatorshortnames[td->operator], td->limit_percent); return State_Failed; } } 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, operatorshortnames[td->operator], td->limit_absolute); return State_Failed; } } Event_post(s, Event_Resource, State_Succeeded, td->action, "inode free test succeeded [current inode free = %.1f%%]", 100. - s->inf.filesystem->inode_percent); 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, operatorshortnames[td->operator], td->limit_percent); return State_Failed; } } else { int64_t bytesUsed = s->inf.filesystem->f_blocksused * (s->inf.filesystem->f_bsize > 0 ? s->inf.filesystem->f_bsize : 1); if (Util_evalQExpression(td->operator, bytesUsed, td->limit_absolute)) { char buf1[10]; char buf2[10]; Fmt_bytes2str(bytesUsed, buf1); 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, operatorshortnames[td->operator], buf2); return State_Failed; } } Event_post(s, Event_Resource, State_Succeeded, td->action, "space usage test succeeded [current space usage = %.1f%%]", s->inf.filesystem->space_percent); 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, operatorshortnames[td->operator], td->limit_percent); return State_Failed; } } else { int64_t bytesFreeTotal = s->inf.filesystem->f_blocksfreetotal * (s->inf.filesystem->f_bsize > 0 ? s->inf.filesystem->f_bsize : 1); if (Util_evalQExpression(td->operator, bytesFreeTotal, td->limit_absolute)) { char buf1[10]; char buf2[10]; Fmt_bytes2str(bytesFreeTotal, buf1); 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, operatorshortnames[td->operator], buf2); return State_Failed; } } Event_post(s, Event_Resource, State_Succeeded, td->action, "space free test succeeded [current space free = %.1f%%]", 100. - s->inf.filesystem->space_percent); 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]){}), operatorshortnames[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, operatorshortnames[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]){}), operatorshortnames[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, operatorshortnames[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.; boolean_t hasReadTime = Statistics_initialized(&(s->inf.filesystem->time.read)); boolean_t hasWriteTime = Statistics_initialized(&(s->inf.filesystem->time.write)); boolean_t hasWaitTime = Statistics_initialized(&(s->inf.filesystem->time.wait)); boolean_t 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 %.3fms/operation matches resource limit [service time %s %s/operation]", serviceTime, operatorshortnames[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 = %.3f ms/operations]", serviceTime); } return State_Succeeded; default: LogError("'%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, actionnames[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 boolean_t _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)) { s->every.last_run = now; return true; } } return false; } /** * Returns true if validation should be skiped for this service in this cycle, otherwise false. Handle every statement */ static boolean_t _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; DEBUG("'%s' test skipped as current time (%lld) does not match every's cron spec \"%s\"\n", s->name, (long long)now, s->every.spec.cron); return true; } else if (s->every.type == Every_NotInCron && Time_incron(s->every.spec.cron, now)) { s->monitor |= Monitor_Waiting; DEBUG("'%s' test skipped as current time (%lld) matches every's cron spec \"not %s\"\n", s->name, (long long)now, 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 boolean_t _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", actionnames[action], rv ? "done" : "failed"); FREE(s->token); } 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() { Run.handler_flag = Handler_Succeeded; Event_queue_process(); update_system_info(); ProcessTree_init(ProcessEngine_None); gettimeofday(&systeminfo.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 = servicelist; s; s = s->next) _doScheduledAction(s); } int errors = 0; /* Check the services */ for (Service_T s = servicelist; s && ! interrupt(); s = s->next) { // FIXME: The Service_Program must collect the exit value from last run, even if the program start should be skipped in this cycle => let check program always run the test (to be refactored with new scheduler) if (! _doScheduledAction(s) && s->monitor && (s->type == Service_Program || ! _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; boolean_t 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))) { LogError("'%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); } /* 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; for (Resource_T pr = s->resourcelist; pr; pr = pr->next) if (_checkProcessResources(s, pr) == State_Failed) rv = State_Failed; } int64_t uptimeMilli = (int64_t)(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); } 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->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"); } } 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 (_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->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"); } } 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 (_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->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"); } } 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 (_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_getErrorStream(P), s->program->inprogressOutput); _programOutput(Process_getInputStream(P), s->program->inprogressOutput); // Is the program still running? if (Process_exitStatus(P) < 0) { int64_t execution_time = (now - s->program->started) * 1000; if (execution_time > s->program->timeout) { // Program timed out rv = State_Failed; LogError("'%s' program timed out after %s. Killing program with pid %ld\n", s->name, Fmt_time2str(execution_time, (char[11]){}), (long)Process_getPid(P)); Process_kill(P); Process_waitFor(P); // Wait for child to exit to get correct exit value // 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); // Save exit status for web-view display StringBuffer_trim(s->program->inprogressOutput); // Swap program output (instance finished) StringBuffer_clear(s->program->lastOutput); StringBuffer_append(s->program->lastOutput, "%s", StringBuffer_toString(s->program->inprogressOutput)); // 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); } } } Process_free(&s->program->P); } else { rv = State_Init; } //FIXME: the current off-by-one-cycle based design requires that the check program will collect the exit value next cycle even if program startup should be skipped in the given cycle => must test skip here (new scheduler will obsolete this deferred skip checking) if (s->monitor != Monitor_Not && ! _checkSkip(s)) { // 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->response = icmp_echo(s->path, icmp->family, &(icmp->outgoing), icmp->size, icmp->timeout, icmp->count); if (icmp->response == -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\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->response == -1) { rv = State_Failed; icmp->is_available = Connection_Failed; Event_post(s, Event_Icmp, State_Failed, icmp->action, "ping test failed"); } else { icmp->is_available = Connection_Ok; Event_post(s, Event_Icmp, State_Succeeded, icmp->action, "ping test succeeded [response time %s]", Fmt_time2str(icmp->response, (char[11]){})); } last_ping = icmp; break; default: LogError("'%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() - systeminfo.booted) == State_Failed) rv = State_Failed; return rv; } State_Type check_net(Service_T s) { boolean_t havedata = true; State_Type rv = State_Succeeded; TRY { Link_update(s->inf.net->stats); } ELSE { havedata = false; for (LinkStatus_T link = s->linkstatuslist; link; link = link->next) Event_post(s, Event_Link, State_Failed, link->action, "link data collection failed -- %s", Exception_frame.message); } END_TRY; if (! havedata) return State_Failed; // Terminate test if no data are available for (LinkStatus_T link = s->linkstatuslist; link; link = link->next) { Event_post(s, Event_Link, State_Succeeded, link->action, "link data collection succeeded"); } // State if (! Link_getState(s->inf.net->stats)) { for (LinkStatus_T link = s->linkstatuslist; link; link = link->next) Event_post(s, Event_Link, State_Failed, link->action, "link down"); return State_Failed; // Terminate test if the link is down } else { for (LinkStatus_T link = s->linkstatuslist; link; link = link->next) Event_post(s, Event_Link, State_Succeeded, link->action, "link up"); } // Link errors long long oerrors = Link_getErrorsOutPerSecond(s->inf.net->stats); 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); 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, operatorshortnames[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, operatorshortnames[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, operatorshortnames[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), operatorshortnames[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, operatorshortnames[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), operatorshortnames[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, operatorshortnames[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.26.0/src/ssl/0000775000175000017500000000000013507751326014243 5ustar martinpmartinpmonit-5.26.0/src/ssl/Ssl.c0000664000175000017500000011251713507751326015157 0ustar martinpmartinp/* * 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_STDIO_H #include #endif #ifdef HAVE_MEMORY_H #include #endif #ifdef HAVE_SYS_TYPES_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_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 { boolean_t 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; /* ----------------------------------------------------------------- Private */ static Ssl_Version _optionsVersion(int version) { return version != -1 ? version : Run.ssl.version != -1 ? Run.ssl.version : SSL_Auto; } static boolean_t _optionsVerify(short verify) { return verify != -1 ? verify : Run.ssl.verify != -1 ? Run.ssl.verify : false; } static boolean_t _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 *_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) { return checksumType ? checksumType : Run.ssl.checksumType ? Run.ssl.checksumType : Hash_Unknown; } static boolean_t _setVersion(SSL_CTX *ctx, SslOptions_T options) { long version = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1; #if defined HAVE_TLSV1_1 version |= SSL_OP_NO_TLSv1_1; #endif #if defined HAVE_TLSV1_2 version |= SSL_OP_NO_TLSv1_2; #endif #if defined HAVE_TLSV1_3 version |= SSL_OP_NO_TLSv1_3; #endif switch (_optionsVersion(options->version)) { case SSL_V2: #if defined OPENSSL_NO_SSL2 || ! defined HAVE_SSLV2 LogError("SSL: SSLv2 not supported\n"); return false; #else if (Run.flags & Run_FipsEnabled) { LogError("SSL: SSLv2 is not allowed in FIPS mode -- use TLS\n"); return false; } version &= ~SSL_OP_NO_SSLv2; #endif break; case SSL_V3: #if defined OPENSSL_NO_SSL3 LogError("SSL: SSLv3 not supported\n"); return false; #else if (Run.flags & Run_FipsEnabled) { LogError("SSL: SSLv3 is not allowed in FIPS mode -- use TLS\n"); return false; } version &= ~SSL_OP_NO_SSLv3; #endif break; case SSL_TLSV1: #if defined OPENSSL_NO_TLS1_METHOD LogError("SSL: TLSv1.0 not supported\n"); return false; #else version &= ~SSL_OP_NO_TLSv1; #endif break; case SSL_TLSV11: #if defined OPENSSL_NO_TLS1_1_METHOD || ! defined HAVE_TLSV1_1 LogError("SSL: TLSv1.1 not supported\n"); return false; #else version &= ~SSL_OP_NO_TLSv1_1; #endif break; case SSL_TLSV12: #if defined OPENSSL_NO_TLS1_2_METHOD || ! defined HAVE_TLSV1_2 LogError("SSL: TLSv1.2 not supported\n"); return false; #else version &= ~SSL_OP_NO_TLSv1_2; #endif break; case SSL_TLSV13: #if defined OPENSSL_NO_TLS1_3_METHOD || ! defined HAVE_TLSV1_3 LogError("SSL: TLSv1.3 not supported\n"); return false; #else version &= ~SSL_OP_NO_TLSv1_3; #endif break; case SSL_Auto: default: // Enable TLS protocols by default version &= ~SSL_OP_NO_TLSv1; #if defined HAVE_TLSV1_1 version &= ~SSL_OP_NO_TLSv1_1; #endif #if defined HAVE_TLSV1_2 version &= ~SSL_OP_NO_TLSv1_2; #endif #if defined HAVE_TLSV1_3 version &= ~SSL_OP_NO_TLSv1_3; #endif break; } SSL_CTX_set_options(ctx, version); return true; } static boolean_t _retry(int socket, int *timeout, int (*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, const char *file, 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) { LogError("SSL: cannot get application data"); 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) { LogError("SSL: cannot get application data"); 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))) { LogError("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: LogError("SSL: invalid certificate -- %s\n", X509_verify_cert_error_string(error)); return 0; } } #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) 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 LogError("SSL: no matching certificate found -- %s\n", SSLERROR); X509_STORE_CTX_set_error(ctx, X509_V_ERR_CERT_REJECTED); #if OPENSSL_VERSION_NUMBER >= 0x10100000L && ! defined(LIBRESSL_VERSION_NUMBER) X509_OBJECT_free(found_cert); #endif return 0; } #if OPENSSL_VERSION_NUMBER >= 0x10100000L && ! defined(LIBRESSL_VERSION_NUMBER) X509_OBJECT_free(found_cert); #endif return 1; } static boolean_t _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 boolean_t _setClientCertificate(T C, const char *file) { if (SSL_CTX_use_certificate_chain_file(C->ctx, file) != 1) { LogError("SSL client certificate chain loading failed: %s\n", SSLERROR); return false; } if (SSL_CTX_use_PrivateKey_file(C->ctx, file, SSL_FILETYPE_PEM) != 1) { LogError("SSL client private key loading failed: %s\n", SSLERROR); return false; } if (SSL_CTX_check_private_key(C->ctx) != 1) { LogError("SSL client private key doesn't match the certificate: %s\n", SSLERROR); return false; } return true; } /* ------------------------------------------------------------------ Public */ void Ssl_start() { #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); } void Ssl_stop() { #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() { #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) ERR_remove_thread_state(NULL); #endif } void Ssl_setFipsMode(boolean_t enabled) { #ifdef OPENSSL_FIPS 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) { LogError("SSL: client method initialization failed -- %s\n", SSLERROR); goto sslerror; } if (! (C->ctx = SSL_CTX_new(method))) { LogError("SSL: client context initialization failed -- %s\n", SSLERROR); goto sslerror; } 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)) { LogError("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) { LogError("SSL: client cipher list [%s] error -- no valid ciphers\n", ciphers); goto sslerror; } if (! (C->handler = SSL_new(C->ctx))) { LogError("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); boolean_t retry = false; int timeout = Run.limits.networkTimeout; do { int rv = SSL_shutdown(C->handler); if (rv == 0) { // close notify sent retry = _retry(C->socket, &timeout, Net_canRead); continue; } else if (rv == 1) { // 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); 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); boolean_t retry = false; do { 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); } int Ssl_write(T C, void *b, int size, int timeout) { ASSERT(C); int n = 0; if (size > 0) { boolean_t retry = false; do { 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) LogError("SSL: write error -- %s\n", ERR_error_string(error, NULL)); else if (n == 0) LogError("SSL: write error -- EOF\n"); else if (n == -1) LogError("SSL: write I/O error -- %s\n", STRERROR); } return -1; default: LogError("SSL: write error -- %s\n", SSLERROR); return -1; } } while (retry); } return n; } int Ssl_read(T C, void *b, int size, int timeout) { ASSERT(C); int n = 0; if (size > 0) { boolean_t retry = false; do { 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) LogError("SSL: read error -- %s\n", ERR_error_string(error, NULL)); else if (n == 0) LogError("SSL: read error -- EOF\n"); else if (n == -1) LogError("SSL: read I/O error -- %s\n", STRERROR); } return -1; default: LogError("SSL: read error -- %s\n", SSLERROR); return -1; } } while (retry); } return n; } int Ssl_getCertificateValidDays(T C) { if (C && C->certificate) { // Certificates which expired already are catched in preverify => we don't need to handle them here int deltadays = 0; #ifdef HAVE_ASN1_TIME_DIFF int deltaseconds; #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) if (! ASN1_TIME_diff(&deltadays, &deltaseconds, NULL, X509_get_notAfter(C->certificate))) { #else if (! ASN1_TIME_diff(&deltadays, &deltaseconds, NULL, X509_get0_notAfter(C->certificate))) { #endif THROW(IOException, "invalid time format in certificate's notAfter field"); } #else ASN1_GENERALIZEDTIME *t = ASN1_TIME_to_generalizedtime(X509_get_notAfter(C->certificate), 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) { snprintf(b + strlen(b), size - strlen(b) - 1, "version: %s", sslnames[options->version]); 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->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) { LogError("SSL: server method initialization failed -- %s\n", SSLERROR); goto sslerror; } if (! (S->ctx = SSL_CTX_new(method))) { LogError("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) { LogError("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) { LogError("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_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 *pemfile = _optionsServerPEMFile(options->pemfile); if (SSL_CTX_use_certificate_chain_file(S->ctx, pemfile) != 1) { LogError("SSL: server certificate chain loading failed -- %s\n", SSLERROR); goto sslerror; } if (SSL_CTX_use_PrivateKey_file(S->ctx, pemfile, SSL_FILETYPE_PEM) != 1) { LogError("SSL: server private key loading failed -- %s\n", SSLERROR); goto sslerror; } if (SSL_CTX_check_private_key(S->ctx) != 1) { LogError("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) { LogError("SSL: client PEM file %s error -- %s\n", clientpemfile, STRERROR); goto sslerror; } if (! S_ISREG(sb.st_mode)) { LogError("SSL: client PEM file %s is not a file\n", clientpemfile); goto sslerror; } if (! SSL_CTX_load_verify_locations(S->ctx, clientpemfile, NULL)) { LogError("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)) { LogError("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))) { LogError("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(SslServer_T S, T *C) { ASSERT(S); ASSERT(C && *C); Ssl_close(*C); Ssl_free(C); } boolean_t 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); boolean_t retry = false; do { 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) LogError("SSL client certificate verification error: %s\n", *C->error ? C->error : X509_verify_cert_error_string(rv)); else LogError("SSL accept error: %s\n", SSLERROR); return false; } } else { break; } } while (retry); return true; } #endif monit-5.26.0/src/ssl/Ssl.h0000664000175000017500000001204013507751326015152 0ustar martinpmartinp/* * 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 } __attribute__((__packed__)) Ssl_Flags; typedef enum { SSL_Auto, SSL_V2, SSL_V3, SSL_TLSV1, SSL_TLSV11, SSL_TLSV12, SSL_TLSV13 } __attribute__((__packed__)) Ssl_Version; typedef struct SslOptions_T { Ssl_Flags flags; /**< SSL flags */ short verify; /**< true if certificate verification is enabled */ short allowSelfSigned; /**< true if self signed certificate is allowed */ short version; /**< The SSL version to use for connection */ short checksumType; /**< Checksum type */ char *checksum; /**< The expected checksum of the server's certificate */ char *pemfile; /**< Optional server certificate */ 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); /** * Enable or disable FIPS-140 mode * @param enabled true to enable FIPS-140 mode */ void Ssl_setFipsMode(boolean_t enabled); /** * 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, 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 represantation of SSL options */ char *Ssl_printOptions(SslOptions_T options, char *b, int size); #undef T #endif monit-5.26.0/src/ssl/SslServer.h0000664000175000017500000000424013507751326016344 0ustar martinpmartinp/* * 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 S An SSL server object * @param C An SSL connection object reference */ void SslServer_freeConnection(T S, 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 */ boolean_t SslServer_accept(Ssl_T C, int socket, int timeout); #undef T #endif monit-5.26.0/src/http.c0000664000175000017500000001027013507751326014565 0ustar martinpmartinp/* * 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 "net.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 boolean_t 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. */ boolean_t can_http() { 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)) { LogError("%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; LogDebug("Shutting down Monit HTTP server\n"); Engine_stop(); Thread_join(thread); LogDebug("Monit HTTP server stopped\n"); running = false; break; case Httpd_Start: if (Run.httpd.flags & Httpd_Net) LogDebug("Starting Monit HTTP server at [%s]:%d\n", Run.httpd.socket.net.address ? Run.httpd.socket.net.address : "*", Run.httpd.socket.net.port); else if (Run.httpd.flags & Httpd_Unix) LogDebug("Starting Monit HTTP server at %s\n", Run.httpd.socket.unix.path); Thread_create(thread, thread_wrapper, NULL); LogDebug("Monit HTTP server started\n"); running = true; break; default: LogError("Monit: Unknown http server action\n"); break; } } /* ----------------------------------------------------------------- Private */ static void *thread_wrapper(void *arg) { set_signal_block(); Engine_start(); #ifdef HAVE_OPENSSL Ssl_threadCleanup(); #endif return NULL; } monit-5.26.0/src/alert.c0000664000175000017500000003123013507751326014714 0ustar martinpmartinp/* * 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 "net.h" #include "alert.h" #include "SMTP.h" // libmonit #include "system/Time.h" #include "util/Str.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 { LogWarning("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_string(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() { 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, false, Run.mailserver_timeout); if (mta->socket) break; else LogError("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 boolean_t _send(List_T list) { boolean_t 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_gmtstring(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" "Message-Id: <%lld.%"PRIx64"@%s>\r\n" "\r\n" "%s", m->to, m->subject, now, VERSION, (long long)Time_now(), System_randomNumber(), 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; LogError("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; } boolean_t _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.26.0/src/device/0000775000175000017500000000000013507751326014701 5ustar martinpmartinpmonit-5.26.0/src/device/sysdep_LINUX.c0000664000175000017500000004732313507751326017344 0ustar martinpmartinp/* * 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_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 #include "monit.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 boolean_t (*getBlockDiskActivity)(void *); // Disk activity callback: _getProcfsBlockDiskActivity (old kernels), _getSysfsBlockDiskActivity (new kernels) boolean_t (*getCifsDiskActivity)(void *); // Disk activity callback: _getCifsDiskActivity if /proc/fs/cifs/Stats is present, otherwise _getDummyDiskActivity } _statistics = {}; /* ----------------------------------------------------------------- Private */ static boolean_t _getDiskUsage(void *_inf) { Info_T inf = _inf; struct statvfs usage; if (statvfs(inf->filesystem->object.mountpoint, &usage) != 0) { LogError("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 boolean_t _getDummyDiskActivity(void *_inf) { return true; } static boolean_t _getCifsDiskActivity(void *_inf) { Info_T inf = _inf; FILE *f = fopen(CIFSSTAT, "r"); if (! f) { LogError("Cannot open %s\n", CIFSSTAT); return false; } uint64_t now = Time_milli(); char line[PATH_MAX]; boolean_t 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]; uint64_t operations; uint64_t bytes; if (sscanf(line, "%255[^:]: %"PRIu64" %255[^:]: %"PRIu64, 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 boolean_t _getNfsDiskActivity(void *_inf) { Info_T inf = _inf; FILE *f = fopen(NFSSTAT, "r"); if (! f) { LogError("Cannot open %s\n", NFSSTAT); return false; } uint64_t now = Time_milli(); char line[PATH_MAX]; char pattern[PATH_MAX]; boolean_t 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]; uint64_t operations; uint64_t bytesSent; uint64_t bytesReceived; uint64_t time; if (sscanf(line, " %255[^:]: %"PRIu64" %*u %*u %"PRIu64 " %"PRIu64" %*u %*u %"PRIu64, 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 boolean_t _getZfsDiskActivity(void *_inf) { Info_T inf = _inf; char path[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]; uint64_t now = Time_milli(); uint64_t waitTime = 0ULL, runTime = 0ULL; uint64_t readOperations = 0ULL, readBytes = 0ULL; uint64_t writeOperations = 0ULL, writeBytes = 0ULL; while (fgets(line, sizeof(line), f)) { if (sscanf(line, "%"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64" %*u %*u %"PRIu64"", &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; } LogError("filesystem statistic error: cannot read %s -- %s\n", path, STRERROR); return false; } static boolean_t _getSysfsBlockDiskActivity(void *_inf) { Info_T inf = _inf; char path[PATH_MAX]; snprintf(path, sizeof(path), "/sys/class/block/%s/stat", inf->filesystem->object.key); FILE *f = fopen(path, "r"); if (f) { uint64_t now = Time_milli(); uint64_t readOperations = 0ULL, readSectors = 0ULL, readTime = 0ULL; uint64_t writeOperations = 0ULL, writeSectors = 0ULL, writeTime = 0ULL; if (fscanf(f, "%"PRIu64" %*u %"PRIu64" %"PRIu64" %"PRIu64" %*u %"PRIu64" %"PRIu64" %*u %*u %*u", &readOperations, &readSectors, &readTime, &writeOperations, &writeSectors, &writeTime) != 6) { fclose(f); LogError("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; } LogError("filesystem statistic error: cannot read %s -- %s\n", path, STRERROR); return false; } static boolean_t _getProcfsBlockDiskActivity(void *_inf) { Info_T inf = _inf; FILE *f = fopen(DISKSTAT, "r"); if (f) { uint64_t now = Time_milli(); uint64_t readOperations = 0ULL, readSectors = 0ULL; uint64_t writeOperations = 0ULL, writeSectors = 0ULL; char line[PATH_MAX]; while (fgets(line, sizeof(line), f)) { char name[256] = {}; // Fallback for kernels < 2.6.25: the /proc/diskstats used to have just 4 statistics, the file is present on >= 2.6.25 too and has 11 fields (same format as /sys/class/block//stat), but we use sysfs for it // as we read the given partition directly instead of traversing the whole filesystems list. In this function we expect the old 4-statistics format - if it should be ever used as main data collector, it needs to // be modified to support >= 2.6.25 format too. if (fscanf(f, " %*d %*d %255s %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64, name, &readOperations, &readSectors, &writeOperations, &writeSectors) == 5 && Str_isEqual(name, inf->filesystem->object.key)) { Statistics_update(&(inf->filesystem->read.bytes), now, readSectors * 512); Statistics_update(&(inf->filesystem->read.operations), now, readOperations); Statistics_update(&(inf->filesystem->write.bytes), now, writeSectors * 512); Statistics_update(&(inf->filesystem->write.operations), now, writeOperations); break; } } fclose(f); return true; } LogError("filesystem statistic error: cannot read %s -- %s\n", DISKSTAT, STRERROR); return false; } static boolean_t _compareMountpoint(const char *mountpoint, struct mntent *mnt) { return IS(mountpoint, mnt->mnt_dir); } static boolean_t _compareDevice(const char *device, struct mntent *mnt) { char target[PATH_MAX] = {}; // The device listed in /etc/mtab can be a device mapper symlink (e.g. /dev/mapper/centos-root -> /dev/dm-1) ... lookup the device as is first (support for NFS/CIFS/SSHFS/etc.) and fallback to realpath if it didn't match return (Str_isEqual(device, mnt->mnt_fsname) || (realpath(mnt->mnt_fsname, target) && Str_isEqual(device, target))); } static boolean_t _setDevice(Info_T inf, const char *path, boolean_t (*compare)(const char *path, struct mntent *mnt)) { FILE *f = setmntent(MOUNTS, "r"); if (! f) { LogError("Cannot open %s\n", MOUNTS); return false; } inf->filesystem->object.generation = _statistics.generation; boolean_t 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 overriden bellow if statistics method is available for this filesystem) 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) { LogError("Lookup for '%s' filesystem failed -- not found in %s\n", path, MOUNTS); } else { // Evaluate filesystem flags for the last matching mount (overlay mounts for the same filesystem may have different mount flags) if (! IS(flags, inf->filesystem->flags)) { if (*(inf->filesystem->flags)) { inf->filesystem->flagsChanged = true; } snprintf(inf->filesystem->flags, sizeof(inf->filesystem->flags), "%s", flags); } } return mounted; } static boolean_t _getDevice(Info_T inf, const char *path, boolean_t (*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) { struct pollfd mountNotify = {.fd = _statistics.fd, .events = POLLPRI, .revents = 0}; if (poll(&mountNotify, 1, 0) != -1) { if (mountNotify.revents & POLLERR) { DEBUG("Mount table change detected\n"); _statistics.generation++; } } else { LogError("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); } 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() { 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() { if (_statistics.fd > -1) { close(_statistics.fd); } } /* ------------------------------------------------------------------ Public */ boolean_t Filesystem_getByMountpoint(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); return _getDevice(inf, path, _compareMountpoint); } boolean_t Filesystem_getByDevice(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); return _getDevice(inf, path, _compareDevice); } monit-5.26.0/src/device/sysdep_NETBSD.c0000664000175000017500000002706613507751326017426 0ustar martinpmartinp/* * 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" // libmonit #include "system/Time.h" #include "io/File.h" /* ------------------------------------------------------------- Definitions */ static struct { uint64_t 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 boolean_t _parseDevice(const char *path, Device_T device) { const unsigned char *base = File_basename(path); for (int len = strlen(base), i = len - 1; i >= 0; i--) { if (isdigit(*(base + i))) { strncpy(device->key, base, i + 1 < sizeof(device->key) ? i + 1 : sizeof(device->key) - 1); return true; } } return false; } static boolean_t _getStatistics(uint64_t 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) { LogError("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) { LogError("filesystem statistic error -- cannot get HW_IOSTATS: %s\n", STRERROR); return false; } _statistics.timestamp = now; } return true; } static boolean_t _getDummyDiskActivity(void *_inf) { return true; } static boolean_t _getBlockDiskActivity(void *_inf) { Info_T inf = _inf; uint64_t now = Time_milli(); boolean_t rv = _getStatistics(now); if (rv) { for (int 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 boolean_t _getDiskUsage(void *_inf) { Info_T inf = _inf; struct statvfs usage; if (statvfs(inf->filesystem->object.mountpoint, &usage) != 0) { LogError("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 boolean_t _compareMountpoint(const char *mountpoint, struct statvfs *mnt) { return IS(mountpoint, mnt->f_mntonname); } static boolean_t _compareDevice(const char *device, struct statvfs *mnt) { return IS(device, mnt->f_mntfromname); } static void _filesystemFlagsToString(Info_T inf, uint64_t flags) { struct mystable { uint64_t 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"} }; for (int i = 0, count = 0; i < sizeof(t) / sizeof(t[0]); i++) { if (flags & t[i].flag) { snprintf(inf->filesystem->flags + strlen(inf->filesystem->flags), sizeof(inf->filesystem->flags) - strlen(inf->filesystem->flags) - 1, "%s%s", count++ ? ", " : "", t[i].description); } } } static boolean_t _setDevice(Info_T inf, const char *path, boolean_t (*compare)(const char *path, struct statvfs *mnt)) { int countfs = getvfsstat(NULL, 0, MNT_NOWAIT); if (countfs != -1) { 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; } if ((mntItem->f_flag & MNT_VISFLAGMASK) != inf->filesystem->object.flags) { if (inf->filesystem->object.flags) { inf->filesystem->flagsChanged = true; } 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); } LogError("Lookup for '%s' filesystem failed\n", path); error: inf->filesystem->object.mounted = false; return false; } static boolean_t _getDevice(Info_T inf, const char *path, boolean_t (*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 */ boolean_t Filesystem_getByMountpoint(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); return _getDevice(inf, path, _compareMountpoint); } boolean_t Filesystem_getByDevice(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); return _getDevice(inf, path, _compareDevice); } monit-5.26.0/src/device/sysdep_DARWIN.c0000664000175000017500000003126113507751326017423 0ustar martinpmartinp/* * 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" // libmonit #include "system/Time.h" /* ----------------------------------------------------------------- Private */ static boolean_t _getDiskUsage(void *_inf) { Info_T inf = _inf; struct statfs usage; if (statfs(inf->filesystem->object.mountpoint, &usage) != 0) { LogError("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 boolean_t _getDummyDiskActivity(void *_inf) { return true; } static boolean_t _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; uint64_t 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 boolean_t _compareMountpoint(const char *mountpoint, struct statfs *mnt) { return IS(mountpoint, mnt->f_mntonname); } static boolean_t _compareDevice(const char *device, struct statfs *mnt) { return IS(device, mnt->f_mntfromname); } static void _filesystemFlagsToString(Info_T inf, uint64_t flags) { struct mystable { uint64_t flag; char *description; } t[]= { {MNT_RDONLY, "ro"}, {MNT_SYNCHRONOUS, "synchronous"}, {MNT_NOEXEC, "noexec"}, {MNT_NOSUID, "nosuid"}, {MNT_NODEV, "nodev"}, {MNT_UNION, "union"}, {MNT_ASYNC, "async"}, #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"} }; for (int i = 0, count = 0; i < sizeof(t) / sizeof(t[0]); i++) { if (flags & t[i].flag) { snprintf(inf->filesystem->flags + strlen(inf->filesystem->flags), sizeof(inf->filesystem->flags) - strlen(inf->filesystem->flags) - 1, "%s%s", count++ ? ", " : "", t[i].description); } } } static boolean_t _setDevice(Info_T inf, const char *path, boolean_t (*compare)(const char *path, struct statfs *mnt)) { int countfs = getfsstat(NULL, 0, MNT_NOWAIT); if (countfs != -1) { 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; } if ((mntItem->f_flags & MNT_VISFLAGMASK) != inf->filesystem->object.flags) { if (inf->filesystem->object.flags) { inf->filesystem->flagsChanged = true; } 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); } LogError("Lookup for '%s' filesystem failed\n", path); inf->filesystem->object.mounted = false; return false; } static boolean_t _getDevice(Info_T inf, const char *path, boolean_t (*compare)(const char *path, struct statfs *mnt)) { //FIXME: cache mount informations (register for mount/unmount notification) if (_setDevice(inf, path, compare)) { return (inf->filesystem->object.getDiskUsage(inf) && inf->filesystem->object.getDiskActivity(inf)); } return false; } /* ------------------------------------------------------------------ Public */ boolean_t Filesystem_getByMountpoint(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); return _getDevice(inf, path, _compareMountpoint); } boolean_t Filesystem_getByDevice(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); return _getDevice(inf, path, _compareDevice); } monit-5.26.0/src/device/device_common.c0000664000175000017500000001206313507751326017656 0ustar martinpmartinp/* * 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" boolean_t filesystem_usage(Service_T s) { ASSERT(s); struct stat sb; boolean_t 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)) { LogError("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)); LogError("Filesystem '%s' not mounted\n", s->path); } return rv; } monit-5.26.0/src/device/sysdep_FREEBSD.c0000664000175000017500000003420413507751326017511 0ustar martinpmartinp/* * 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" // libmonit #include "system/Time.h" #include "io/File.h" /* ------------------------------------------------------------- Definitions */ static struct { uint64_t 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 uint64_t _bintimeToMilli(struct bintime *time) { return time->sec * 1000 + (((uint64_t)1000 * (uint32_t)(time->frac >> 32)) >> 32); } // Parse the device path like /dev/da0p2 or /dev/gpt/myfilesystemlabel into name:instance -> da:0 static boolean_t _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)) { LogError("system statistics error -- cannot get kern.geom.conftxt size"); return false; } char buf[len + 1]; if (sysctlbyname("kern.geom.conftxt", buf, &len, NULL, 0)) { LogError("system statistics error -- cannot get kern.geom.conftxt"); 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 (int 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; } } } } } } } } LogError("filesystem statistics error -- cannot parse device '%s'\n", path); return false; } static boolean_t _getStatistics(uint64_t 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) { LogError("filesystem statistics error -- devstat_getdevs: %s\n", devstat_errbuf); return false; } _statistics.timestamp = now; } return true; } static boolean_t _getDummyDiskActivity(void *_inf) { return true; } static boolean_t _getBlockDiskActivity(void *_inf) { Info_T inf = _inf; uint64_t now = Time_milli(); boolean_t 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)) { uint64_t 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 boolean_t _getDiskUsage(void *_inf) { Info_T inf = _inf; struct statfs usage; if (statfs(inf->filesystem->object.mountpoint, &usage) != 0) { LogError("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 boolean_t _compareMountpoint(const char *mountpoint, struct statfs *mnt) { return IS(mountpoint, mnt->f_mntonname); } static boolean_t _compareDevice(const char *device, struct statfs *mnt) { return IS(device, mnt->f_mntfromname); } static void _filesystemFlagsToString(Info_T inf, uint64_t flags) { struct mystable { uint64_t 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"} }; for (int i = 0, count = 0; i < sizeof(t) / sizeof(t[0]); i++) { if (flags & t[i].flag) { snprintf(inf->filesystem->flags + strlen(inf->filesystem->flags), sizeof(inf->filesystem->flags) - strlen(inf->filesystem->flags) - 1, "%s%s", count++ ? ", " : "", t[i].description); } } } static boolean_t _setDevice(Info_T inf, const char *path, boolean_t (*compare)(const char *path, struct statfs *mnt)) { int countfs = getfsstat(NULL, 0, MNT_NOWAIT); if (countfs != -1) { 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 { //FIXME: can add ZFS support (see sysdep_SOLARIS.c), but libzfs headers are not installed on FreeBSD by default (part of "cddl" set) inf->filesystem->object.getDiskActivity = _getDummyDiskActivity; } if ((mntItem->f_flags & MNT_VISFLAGMASK) != inf->filesystem->object.flags) { if (inf->filesystem->object.flags) { inf->filesystem->flagsChanged = true; } 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); } LogError("Lookup for '%s' filesystem failed\n", path); error: inf->filesystem->object.mounted = false; return false; } static boolean_t _getDevice(Info_T inf, const char *path, boolean_t (*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 */ boolean_t Filesystem_getByMountpoint(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); return _getDevice(inf, path, _compareMountpoint); } boolean_t Filesystem_getByDevice(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); return _getDevice(inf, path, _compareDevice); } monit-5.26.0/src/device/sysdep_DRAGONFLY.c0000664000175000017500000002644013507751326017767 0ustar martinpmartinp/* * 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" // libmonit #include "system/Time.h" #include "io/File.h" /* ------------------------------------------------------------- Definitions */ static struct { uint64_t 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 uint64_t _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 boolean_t _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; } } LogError("filesystem statistics error -- cannot parse device '%s'\n", path); return false; } static boolean_t _getStatistics(uint64_t 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) { LogError("filesystem statistics error -- devstat_getdevs: %s\n", devstat_errbuf); return false; } _statistics.timestamp = now; } return true; } static boolean_t _getDummyDiskActivity(void *_inf) { return true; } static boolean_t _getBlockDiskActivity(void *_inf) { Info_T inf = _inf; uint64_t now = Time_milli(); boolean_t 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)) { uint64_t 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 boolean_t _getDiskUsage(void *_inf) { Info_T inf = _inf; struct statfs usage; if (statfs(inf->filesystem->object.mountpoint, &usage) != 0) { LogError("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 boolean_t _compareMountpoint(const char *mountpoint, struct statfs *mnt) { return IS(mountpoint, mnt->f_mntonname); } static boolean_t _compareDevice(const char *device, struct statfs *mnt) { return IS(device, mnt->f_mntfromname); } static void _filesystemFlagsToString(Info_T inf, uint64_t flags) { struct mystable { uint64_t 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"} }; for (int i = 0, count = 0; i < sizeof(t) / sizeof(t[0]); i++) { if (flags & t[i].flag) { snprintf(inf->filesystem->flags + strlen(inf->filesystem->flags), sizeof(inf->filesystem->flags) - strlen(inf->filesystem->flags) - 1, "%s%s", count++ ? ", " : "", t[i].description); } } } static boolean_t _setDevice(Info_T inf, const char *path, boolean_t (*compare)(const char *path, struct statfs *mnt)) { int countfs = getfsstat(NULL, 0, MNT_NOWAIT); if (countfs != -1) { 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; } if ((mntItem->f_flags & MNT_VISFLAGMASK) != inf->filesystem->object.flags) { if (inf->filesystem->object.flags) { inf->filesystem->flagsChanged = true; } 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); } LogError("Lookup for '%s' filesystem failed\n", path); error: inf->filesystem->object.mounted = false; return false; } static boolean_t _getDevice(Info_T inf, const char *path, boolean_t (*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 */ boolean_t Filesystem_getByMountpoint(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); return _getDevice(inf, path, _compareMountpoint); } boolean_t Filesystem_getByDevice(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); return _getDevice(inf, path, _compareDevice); } monit-5.26.0/src/device/sysdep_AIX.c0000664000175000017500000002150413507751326017057 0ustar martinpmartinp/* * 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" /* ------------------------------------------------------------- Definitions */ static struct { boolean_t 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 boolean_t _getDummyDiskActivity(void *_inf) { return true; } static boolean_t _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 boolean_t _getDiskUsage(void *_inf) { Info_T inf = _inf; struct statfs usage; if (statfs(inf->filesystem->object.mountpoint, &usage) != 0) { LogError("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 boolean_t _compareMountpoint(const char *mountpoint, struct mntent *mnt) { return IS(mountpoint, mnt->mnt_dir); } static boolean_t _compareDevice(const char *device, struct mntent *mnt) { return IS(device, mnt->mnt_fsname); } static boolean_t _setDevice(Info_T inf, const char *path, boolean_t (*compare)(const char *path, struct mntent *mnt)) { FILE *f = setmntent(MOUNTED, "r"); if (! f) { LogError("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); if (! IS(mnt->mnt_opts, inf->filesystem->flags)) { if (*(inf->filesystem->flags)) { inf->filesystem->flagsChanged = true; } snprintf(inf->filesystem->flags, sizeof(inf->filesystem->flags), "%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; } } LogError("Lookup for '%s' filesystem failed -- not found in %s\n", path, MOUNTED); endmntent(f); inf->filesystem->object.mounted = false; return false; } static boolean_t _getDevice(Info_T inf, const char *path, boolean_t (*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 */ boolean_t Filesystem_getByMountpoint(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); return _getDevice(inf, path, _compareMountpoint); } boolean_t Filesystem_getByDevice(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); return _getDevice(inf, path, _compareDevice); } monit-5.26.0/src/device/sysdep_UNKNOWN.c0000664000175000017500000000312113507751326017570 0ustar martinpmartinp/* * 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" /* ------------------------------------------------------------------ Public */ boolean_t Filesystem_getByMountpoint(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); LogError("Unsupported filesystem data collection method\n"); return false; } boolean_t Filesystem_getByDevice(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); LogError("Unsupported filesystem data collection method\n"); return false; } monit-5.26.0/src/device/device.h0000664000175000017500000000234213507751326016312 0ustar martinpmartinp/* * 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 boolean_t filesystem_usage(Service_T); boolean_t Filesystem_getByMountpoint(Info_T inf, const char *path); boolean_t Filesystem_getByDevice(Info_T inf, const char *path); #endif monit-5.26.0/src/device/sysdep_SOLARIS.c0000664000175000017500000003612313507751326017555 0ustar martinpmartinp/* * 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" // 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 uint64_t timestamp; // /etc/mnttab timestamp [ms] (changed on mount/unmount) } _statistics = {}; /* ----------------------------------------------------------------- Private */ static boolean_t _getDummyDiskActivity(void *_inf) { return true; } static boolean_t _getZfsDiskActivity(void *_inf) { Info_T inf = _inf; boolean_t 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)); uint64_t 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 boolean_t _getKstatDiskActivity(void *_inf) { Info_T inf = _inf; boolean_t 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) { LogError("filesystem statistics error: kstat_read failed -- %s\n", STRERROR); } else { uint64_t 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 boolean_t _getDiskUsage(void *_inf) { Info_T inf = _inf; struct statvfs usage; if (statvfs(inf->filesystem->object.mountpoint, &usage) != 0) { LogError("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 boolean_t _compareMountpoint(const char *mountpoint, struct extmnttab *mnt) { return IS(mountpoint, mnt->mnt_mountp); } static boolean_t _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 boolean_t _setDevice(Info_T inf, const char *path, boolean_t (*compare)(const char *path, struct extmnttab *mnt)) { FILE *f = fopen(MNTTAB, "r"); if (! f) { LogError("Cannot open %s\n", MNTTAB); return false; } resetmnttab(f); struct extmnttab mnt; boolean_t 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 if (! IS(mnt.mnt_mntopts, inf->filesystem->flags)) { if (*(inf->filesystem->flags)) { inf->filesystem->flagsChanged = true; } snprintf(inf->filesystem->flags, sizeof(inf->filesystem->flags), "%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, '/'); strncpy(inf->filesystem->object.key, mnt.mnt_special, slash ? slash - 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) LogError("Lookup for '%s' filesystem failed -- %s\n", path, STRERROR); } else if (! Str_startsWith(special, "/devices/")) { LogError("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) { LogError("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; } } LogError("Lookup for '%s' filesystem failed -- not found in %s\n", path, MNTTAB); fclose(f); inf->filesystem->object.mounted = false; return false; } static boolean_t _getDevice(Info_T inf, const char *path, boolean_t (*compare)(const char *path, struct extmnttab *mnt)) { struct stat sb; if (stat(MNTTAB, &sb) != 0 || _statistics.timestamp != (uint64_t)((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 */ boolean_t Filesystem_getByMountpoint(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); return _getDevice(inf, path, _compareMountpoint); } boolean_t Filesystem_getByDevice(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); return _getDevice(inf, path, _compareDevice); } monit-5.26.0/src/device/sysdep_OPENBSD.c0000664000175000017500000002550513507751326017535 0ustar martinpmartinp/* * 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" // libmonit #include "system/Time.h" #include "io/File.h" /* ------------------------------------------------------------- Definitions */ static struct { uint64_t timestamp; size_t diskCount; size_t diskLength; struct diskstats *disk; } _statistics = {}; /* ------------------------------------------------------- Static destructor */ static void __attribute__ ((destructor)) _destructor() { FREE(_statistics.disk); } /* ----------------------------------------------------------------- Private */ static uint64_t _timevalToMilli(struct timeval *time) { return time->tv_sec * 1000 + time->tv_usec / 1000.; } // Parse the device path like /dev/sd0a -> sd0 static boolean_t _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))) { strncpy(device->key, base, i + 1 < sizeof(device->key) ? i + 1 : sizeof(device->key) - 1); return true; } } return false; } static boolean_t _getStatistics(uint64_t 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 = sizeof(_statistics.diskCount); int mib[2] = {CTL_HW, HW_DISKCOUNT}; if (sysctl(mib, 2, &(_statistics.diskCount), &len, NULL, 0) == -1) { LogError("filesystem statistic error -- cannot get disks count: %s\n", STRERROR); return false; } int length = _statistics.diskCount * sizeof(struct diskstats); if (_statistics.diskLength != length) { _statistics.diskLength = length; RESIZE(_statistics.disk, length); } mib[1] = HW_DISKSTATS; if (sysctl(mib, 2, _statistics.disk, &(_statistics.diskLength), NULL, 0) == -1) { LogError("filesystem statistic error -- cannot get disks statistics: %s\n", STRERROR); return false; } _statistics.timestamp = now; } return true; } static boolean_t _getDummyDiskActivity(void *_inf) { return true; } static boolean_t _getBlockDiskActivity(void *_inf) { Info_T inf = _inf; uint64_t now = Time_milli(); boolean_t rv = _getStatistics(now); if (rv) { for (int 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 boolean_t _getDiskUsage(void *_inf) { Info_T inf = _inf; struct statfs usage; if (statfs(inf->filesystem->object.mountpoint, &usage) != 0) { LogError("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 boolean_t _compareMountpoint(const char *mountpoint, struct statfs *mnt) { return IS(mountpoint, mnt->f_mntonname); } static boolean_t _compareDevice(const char *device, struct statfs *mnt) { return IS(device, mnt->f_mntfromname); } static void _filesystemFlagsToString(Info_T inf, uint64_t flags) { struct mystable { uint64_t 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"} }; for (int i = 0, count = 0; i < sizeof(t) / sizeof(t[0]); i++) { if (flags & t[i].flag) { snprintf(inf->filesystem->flags + strlen(inf->filesystem->flags), sizeof(inf->filesystem->flags) - strlen(inf->filesystem->flags) - 1, "%s%s", count++ ? ", " : "", t[i].description); } } } static boolean_t _setDevice(Info_T inf, const char *path, boolean_t (*compare)(const char *path, struct statfs *mnt)) { int countfs = getfsstat(NULL, 0, MNT_NOWAIT); if (countfs != -1) { 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; } if ((mntItem->f_flags & MNT_VISFLAGMASK) != inf->filesystem->object.flags) { if (inf->filesystem->object.flags) { inf->filesystem->flagsChanged = true; } 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); } LogError("Lookup for '%s' filesystem failed\n", path); error: inf->filesystem->object.mounted = false; return false; } static boolean_t _getDevice(Info_T inf, const char *path, boolean_t (*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 */ boolean_t Filesystem_getByMountpoint(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); return _getDevice(inf, path, _compareMountpoint); } boolean_t Filesystem_getByDevice(Info_T inf, const char *path) { ASSERT(inf); ASSERT(path); return _getDevice(inf, path, _compareDevice); } monit-5.26.0/src/md5_crypt.c0000664000175000017500000001264013507751326015517 0ustar martinpmartinp/* * 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" /* 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.26.0/src/process/0000775000175000017500000000000013507751326015120 5ustar martinpmartinpmonit-5.26.0/src/process/sysdep_LINUX.c0000664000175000017500000004632413507751326017563 0ustar martinpmartinp/* * 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_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 #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 { 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; uint64_t read_bytes; uint64_t write_bytes; char name[4096]; char secattr[STRLEN]; } *Proc_T; /* --------------------------------------- Static constructor and destructor */ static void __attribute__ ((constructor)) _constructor() { 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_syst = 0; static unsigned long long old_cpu_wait = 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() { struct sysinfo info; if (sysinfo(&info) < 0) { LogError("system statistic error -- cannot get system uptime: %s\n", STRERROR); return 0; } return Time_now() - info.uptime; } // parse /proc/PID/stat static boolean_t _parseProcPidStat(Proc_T proc) { char buf[4096]; char *tmp = NULL; if (! file_readProc(buf, sizeof(buf), "stat", proc->pid, NULL)) { DEBUG("system statistic error -- cannot read /proc/%d/stat\n", proc->pid); return false; } if (! (tmp = strrchr(buf, ')'))) { DEBUG("system statistic error -- file /proc/%d/stat parse error\n", proc->pid); return false; } *tmp = 0; if (sscanf(buf, "%*d (%255s", proc->name) != 1) { DEBUG("system statistic error -- file /proc/%d/stat process name parse error\n", proc->pid); return false; } tmp += 2; if (sscanf(tmp, "%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->item_state), &(proc->ppid), &(proc->item_utime), &(proc->item_stime), &(proc->item_cutime), &(proc->item_cstime), &(proc->item_threads), &(proc->item_starttime), &(proc->item_rss)) != 9) { DEBUG("system statistic error -- file /proc/%d/stat parse error\n", proc->pid); return false; } return true; } // parse /proc/PID/status static boolean_t _parseProcPidStatus(Proc_T proc) { char buf[4096]; char *tmp = NULL; if (! file_readProc(buf, sizeof(buf), "status", proc->pid, NULL)) { DEBUG("system statistic error -- cannot read /proc/%d/status\n", proc->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->uid), &(proc->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->gid)) != 1) { DEBUG("system statistic error -- cannot read process gid\n"); return false; } return true; } // parse /proc/PID/io static boolean_t _parseProcPidIO(Proc_T proc) { char buf[4096]; char *tmp = NULL; if (_statistics.hasIOStatistics) { if (file_readProc(buf, sizeof(buf), "io", proc->pid, NULL)) { if (! (tmp = strstr(buf, "read_bytes:"))) { DEBUG("system statistic error -- cannot find process read_bytes\n"); return false; } if (sscanf(tmp + 11, "\t%"PRIu64, &(proc->read_bytes)) != 1) { DEBUG("system statistic error -- cannot get process read bytes\n"); return false; } if (! (tmp = strstr(buf, "write_bytes:"))) { DEBUG("system statistic error -- cannot find process write_bytes\n"); return false; } if (sscanf(tmp + 12, "\t%"PRIu64, &(proc->write_bytes)) != 1) { DEBUG("system statistic error -- cannot get process write bytes\n"); return false; } } } return true; } // parse /proc/PID/cmdline static boolean_t _parseProcPidCmdline(Proc_T proc, ProcessEngine_Flags pflags) { if (pflags & ProcessEngine_CollectCommandLine) { int bytes = 0; char buf[4096]; if (! file_readProc(buf, sizeof(buf), "cmdline", proc->pid, &bytes)) { DEBUG("system statistic error -- cannot read /proc/%d/cmdline\n", proc->pid); return false; } for (int j = 0; j < (bytes - 1); j++) // The cmdline file contains argv elements/strings terminated separated by '\0' => join the string if (buf[j] == 0) buf[j] = ' '; if (*buf) snprintf(proc->name, sizeof(proc->name), "%s", buf); } return true; } // parse /proc/PID/attr/current static boolean_t _parseProcPidAttrCurrent(Proc_T proc) { if (file_readProc(proc->secattr, sizeof(proc->secattr), "attr/current", proc->pid, NULL)) { Str_trim(proc->secattr); return true; } return false; } 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 */ boolean_t init_process_info_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 ((systeminfo.cpu.count = sysconf(_SC_NPROCESSORS_CONF)) < 0) { DEBUG("system statistic error -- cannot get cpu count: %s\n", STRERROR); return false; } else if (systeminfo.cpu.count == 0) { DEBUG("system reports cpu count 0, setting dummy cpu count 1\n"); systeminfo.cpu.count = 1; } FILE *f = fopen("/proc/meminfo", "r"); if (f) { char line[STRLEN]; systeminfo.memory.size = 0L; while (fgets(line, sizeof(line), f)) { if (sscanf(line, "MemTotal: %"PRIu64, &systeminfo.memory.size) == 1) { systeminfo.memory.size *= 1024; break; } } fclose(f); if (! systeminfo.memory.size) DEBUG("system statistic error -- cannot get real memory amount\n"); } else { DEBUG("system statistic error -- cannot open /proc/meminfo\n"); } f = fopen("/proc/stat", "r"); if (f) { char line[STRLEN]; systeminfo.booted = 0; while (fgets(line, sizeof(line), f)) { if (sscanf(line, "btime %"PRIu64, &systeminfo.booted) == 1) { break; } } fclose(f); if (! systeminfo.booted) DEBUG("system statistic error -- cannot get system boot time\n"); } else { DEBUG("system statistic error -- cannot open /proc/stat\n"); } 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 initprocesstree_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) { LogError("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 = {}; time_t starttime = _getStartTime(); for (int i = 0; i < globbuf.gl_pathc; i++) { proc.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) _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.pid; pt[count].ppid = proc.ppid; pt[count].cred.uid = proc.uid; pt[count].cred.euid = proc.euid; pt[count].cred.gid = proc.gid; pt[count].threads.self = proc.item_threads; pt[count].uptime = starttime > 0 ? (systeminfo.time / 10. - (starttime + (time_t)(proc.item_starttime / hz))) : 0; pt[count].cpu.time = (double)(proc.item_utime + proc.item_stime) / hz * 10.; // jiffies -> seconds = 1/hz pt[count].memory.usage = (uint64_t)proc.item_rss * (uint64_t)page_size; pt[count].read.bytes = proc.read_bytes; pt[count].write.bytes = proc.write_bytes; pt[count].zombie = proc.item_state == 'Z' ? true : false; pt[count].cmdline = Str_dup(proc.name); pt[count].secattr = Str_dup(proc.secattr); count++; memset(&proc, 0, sizeof(struct Proc_T)); } } *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 */ boolean_t used_system_memory_sysdep(SystemInfo_T *si) { char *ptr; char buf[2048]; unsigned long mem_free = 0UL; unsigned long buffers = 0UL; unsigned long cached = 0UL; unsigned long slabreclaimable = 0UL; unsigned long swap_total = 0UL; unsigned long swap_free = 0UL; uint64_t zfsarcsize = 0ULL; if (! file_readProc(buf, sizeof(buf), "meminfo", -1, NULL)) { LogError("system statistic error -- cannot get real memory free amount\n"); goto error; } /* Memory */ if (! (ptr = strstr(buf, "MemFree:")) || sscanf(ptr + 8, "%ld", &mem_free) != 1) { LogError("system statistic error -- cannot get real memory free amount\n"); goto error; } if (! (ptr = strstr(buf, "Buffers:")) || sscanf(ptr + 8, "%ld", &buffers) != 1) DEBUG("system statistic error -- cannot get real memory buffers amount\n"); if (! (ptr = strstr(buf, "Cached:")) || sscanf(ptr + 7, "%ld", &cached) != 1) DEBUG("system statistic error -- cannot get real memory cache amount\n"); if (! (ptr = strstr(buf, "SReclaimable:")) || sscanf(ptr + 13, "%ld", &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 %"PRIu64, &zfsarcsize) == 1) { break; } } fclose(f); } si->memory.usage.bytes = systeminfo.memory.size - zfsarcsize - (uint64_t)(mem_free + buffers + cached + slabreclaimable) * 1024; /* Swap */ if (! (ptr = strstr(buf, "SwapTotal:")) || sscanf(ptr + 10, "%ld", &swap_total) != 1) { LogError("system statistic error -- cannot get swap total amount\n"); goto error; } if (! (ptr = strstr(buf, "SwapFree:")) || sscanf(ptr + 9, "%ld", &swap_free) != 1) { LogError("system statistic error -- cannot get swap free amount\n"); goto error; } si->swap.size = (uint64_t)swap_total * 1024; si->swap.usage.bytes = (uint64_t)(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) */ boolean_t used_system_cpu_sysdep(SystemInfo_T *si) { boolean_t rv; unsigned long long cpu_total; unsigned long long cpu_user; unsigned long long cpu_nice; unsigned long long cpu_syst; unsigned long long cpu_idle; unsigned long long cpu_wait; unsigned long long cpu_irq; unsigned long long cpu_softirq; char buf[STRLEN]; if (! file_readProc(buf, sizeof(buf), "stat", -1, NULL)) { LogError("system statistic error -- cannot read /proc/stat\n"); goto error; } rv = sscanf(buf, "cpu %llu %llu %llu %llu %llu %llu %llu", &cpu_user, &cpu_nice, &cpu_syst, &cpu_idle, &cpu_wait, &cpu_irq, &cpu_softirq); if (rv < 4) { LogError("system statistic error -- cannot read cpu usage\n"); goto error; } else if (rv == 4) { /* linux 2.4.x doesn't support these values */ cpu_wait = 0; cpu_irq = 0; cpu_softirq = 0; } cpu_total = cpu_user + cpu_nice + cpu_syst + cpu_idle + cpu_wait + cpu_irq + cpu_softirq; cpu_user = cpu_user + cpu_nice; if (old_cpu_total == 0) { si->cpu.usage.user = -1.; si->cpu.usage.system = -1.; si->cpu.usage.wait = -1.; } else { double delta = cpu_total - old_cpu_total; si->cpu.usage.user = _usagePercent(old_cpu_user, cpu_user, delta); si->cpu.usage.system = _usagePercent(old_cpu_syst, cpu_syst, delta); si->cpu.usage.wait = _usagePercent(old_cpu_wait, cpu_wait, delta); } old_cpu_user = cpu_user; old_cpu_syst = cpu_syst; old_cpu_wait = cpu_wait; old_cpu_total = cpu_total; return true; error: si->cpu.usage.user = 0.; si->cpu.usage.system = 0.; si->cpu.usage.wait = 0.; return false; } monit-5.26.0/src/process/sysdep_NETBSD.c0000664000175000017500000002231513507751326017635 0ustar martinpmartinp/* * 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_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 data collecting code for NetBSD. * * @file */ /* ----------------------------------------------------------------- Private */ static int pagesize; static long total_old = 0; static long cpu_user_old = 0; static long cpu_syst_old = 0; static unsigned maxslp; /* ------------------------------------------------------------------ Public */ boolean_t init_process_info_sysdep(void) { int mib[2] = {CTL_HW, HW_NCPU}; size_t len = sizeof(systeminfo.cpu.count); if (sysctl(mib, 2, &systeminfo.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(systeminfo.memory.size); if (sysctl(mib, 2, &systeminfo.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 { systeminfo.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 initprocesstree_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) { LogError("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) { LogError("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); LogError("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); LogError("system statistic error -- kvm_openfiles failed: %s\n", buf); return 0; } 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 = systeminfo.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 = (uint64_t)pinfo[i].p_vm_rssize * (uint64_t)pagesize; pt[i].zombie = pinfo[i].p_stat == SZOMB ? true : false; pt[i].read.operations = pinfo[i].p_uru_inblock; pt[i].write.operations = pinfo[i].p_uru_oublock; 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) */ boolean_t 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) { LogError("system statistic error -- cannot get memory usage: %s\n", STRERROR); si->swap.size = 0ULL; return false; } si->memory.usage.bytes = (uint64_t)(vm.active + vm.wired) * (uint64_t)vm.pagesize; si->swap.size = (uint64_t)vm.swpages * (uint64_t)vm.pagesize; si->swap.usage.bytes = (uint64_t)vm.swpginuse * (uint64_t)vm.pagesize; return true; } /** * This routine returns system/user CPU time in use. * @return: true if successful, false if failed */ boolean_t 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) { LogError("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.system = (total > 0) ? (100. * (double)(cp_time[CP_SYS] - cpu_syst_old) / total) : -1.; si->cpu.usage.wait = 0; /* there is no wait statistic available */ cpu_user_old = cp_time[CP_USER]; cpu_syst_old = cp_time[CP_SYS]; return true; } monit-5.26.0/src/process/sysdep_DARWIN.c0000664000175000017500000002751113507751326017645 0ustar martinpmartinp/* * 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 #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_syst_old = 0; /* ------------------------------------------------------------------ Public */ boolean_t init_process_info_sysdep(void) { size_t size = sizeof(systeminfo.cpu.count); if (sysctlbyname("hw.logicalcpu", &systeminfo.cpu.count, &size, NULL, 0) == -1) { DEBUG("system statistics error -- sysctl hw.logicalcpu failed: %s\n", STRERROR); return false; } size = sizeof(systeminfo.memory.size); if (sysctlbyname("hw.memsize", &systeminfo.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(systeminfo.argmax); if (sysctlbyname("kern.argmax", &systeminfo.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 { systeminfo.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 initprocesstree_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) { LogError("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); LogError("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, systeminfo.argmax + 1); } for (int i = 0; i < treesize; i++) { pt[i].uptime = systeminfo.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 = systeminfo.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 && p < args + systeminfo.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)) { FREE(pt[i].cmdline); 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 (rv < sizeof(tinfo)) { LogError("proc_pidinfo for pid %d -- invalid result size\n", pt[i].pid); } else { pt[i].memory.usage = (uint64_t)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 = rusage.ri_diskio_bytesread; pt[i].write.bytes = rusage.ri_diskio_byteswritten; } #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) */ boolean_t 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 = (uint64_t)(page_info.wire_count + page_info.active_count) * (uint64_t)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 = (uint64_t)swap.xsu_total; si->swap.usage.bytes = (uint64_t)swap.xsu_used; return true; } /** * This routine returns system/user CPU time in use. * @return: true if successful, false if failed */ boolean_t 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.system = (total > 0) ? (100. * (double)(cpu_info.cpu_ticks[CPU_STATE_SYSTEM] - cpu_syst_old) / total) : -1.; si->cpu.usage.wait = 0.; /* there is no wait statistic available */ cpu_user_old = cpu_info.cpu_ticks[CPU_STATE_USER]; cpu_syst_old = cpu_info.cpu_ticks[CPU_STATE_SYSTEM]; return true; } return false; } monit-5.26.0/src/process/sysdep_FREEBSD.c0000664000175000017500000002536313507751326017736 0ustar martinpmartinp/* * 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_syst_old = 0; /* ------------------------------------------------------------------ Public */ boolean_t init_process_info_sysdep(void) { int mib[2] = {CTL_HW, HW_NCPU}; size_t len = sizeof(systeminfo.cpu.count); if (sysctl(mib, 2, &systeminfo.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(systeminfo.memory.size); if (sysctl(mib, 2, &systeminfo.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 { systeminfo.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 initprocesstree_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) { LogError("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)) { LogError("system statistics error -- kvm_getprocs: %s\n", kvm_geterr(kvm_handle)); kvm_close(kvm_handle); return 0; } uint64_t 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 = systeminfo.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.operations = pinfo[i].ki_rusage.ru_inblock; 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) */ boolean_t 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) { LogError("system statistics error -- cannot get active memory usage: %s\n", STRERROR); return false; } if (len != sizeof(unsigned int)) { LogError("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) { LogError("system statistics error -- cannot get wired memory usage: %s\n", STRERROR); return false; } if (len != sizeof(unsigned int)) { LogError("system statistics error -- wired memory usage statics error\n"); return false; } uint64_t arcsize = 0ULL; len = sizeof(arcsize); if (sysctlbyname("kstat.zfs.misc.arcstats.size", &arcsize, &len, NULL, 0) == 0) { if (len != sizeof(arcsize)) { LogError("system statistics error -- ZFS ARC memory usage statics error\n"); return false; } } si->memory.usage.bytes = (uint64_t)(active + wired) * (uint64_t)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) { LogError("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) { LogError("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 = (uint64_t)total * (uint64_t)pagesize; si->swap.usage.bytes = (uint64_t)used * (uint64_t)pagesize; return true; } /** * This routine returns system/user CPU time in use. * @return: true if successful, false if failed */ boolean_t 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) { LogError("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) { LogError("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.system = (total > 0) ? (100. * (double)(cp_time[CP_SYS] - cpu_syst_old) / total) : -1.; si->cpu.usage.wait = 0.; /* there is no wait statistic available */ cpu_user_old = cp_time[CP_USER]; cpu_syst_old = cp_time[CP_SYS]; return true; } monit-5.26.0/src/process/process_sysdep.h0000664000175000017500000000254313507751326020342 0ustar martinpmartinp/* * 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 boolean_t init_process_info_sysdep(void); int init_proc_info_sysdep(void); int getloadavg_sysdep (double *, int); boolean_t used_system_memory_sysdep(SystemInfo_T *); boolean_t used_system_cpu_sysdep(SystemInfo_T *); int initprocesstree_sysdep(ProcessTree_T **, ProcessEngine_Flags); #endif monit-5.26.0/src/process/sysdep_DRAGONFLY.c0000664000175000017500000002416113507751326020204 0ustar martinpmartinp/* * 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_syst_old = 0; /* ------------------------------------------------------------------ Public */ boolean_t init_process_info_sysdep(void) { int mib[2] = {CTL_HW, HW_NCPU}; size_t len = sizeof(systeminfo.cpu.count); if (sysctl(mib, 2, &systeminfo.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(systeminfo.memory.size); if (sysctl(mib, 2, &systeminfo.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 { systeminfo.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 initprocesstree_sysdep(ProcessTree_T **reference, ProcessEngine_Flags pflags) { kvm_t *kvm_handle = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, prog); if (! kvm_handle) { LogError("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)) { LogError("system statistic error -- cannot get process tree\n"); kvm_close(kvm_handle); return 0; } 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].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 = systeminfo.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 = (uint64_t)pinfo[i].kp_vm_rssize * (uint64_t)pagesize; pt[i].read.operations = pinfo[i].kp_ru.ru_inblock; pt[i].write.operations = pinfo[i].kp_ru.ru_oublock; 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) */ boolean_t 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) { LogError("system statistic error -- cannot get for active memory usage: %s\n", STRERROR); return false; } if (len != sizeof(unsigned int)) { LogError("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) { LogError("system statistic error -- cannot get for wired memory usage: %s\n", STRERROR); return false; } if (len != sizeof(unsigned int)) { LogError("system statistic error -- wired memory usage statics error\n"); return false; } si->memory.usage.bytes = (uint64_t)(active + wired) * (uint64_t)pagesize; /* Swap */ unsigned int used; if (sysctlbyname("vm.swap_anon_use", &used, &len, NULL, 0) == -1) { LogError("system statistic error -- cannot get swap usage: %s\n", STRERROR); si->swap.size = 0; return false; } si->swap.usage.bytes = (uint64_t)used * (uint64_t)pagesize; if (sysctlbyname("vm.swap_cache_use", &used, &len, NULL, 0) == -1) { LogError("system statistic error -- cannot get swap usage: %s\n", STRERROR); si->swap.size = 0; return false; } si->swap.usage.bytes += (uint64_t)used * (uint64_t)pagesize; unsigned int free; if (sysctlbyname("vm.swap_size", &free, &len, NULL, 0) == -1) { LogError("system statistic error -- cannot get swap usage: %s\n", STRERROR); si->swap.size = 0; return false; } si->swap.size = (uint64_t)free * (uint64_t)pagesize + si->swap.usage.bytes; return true; } /** * This routine returns system/user CPU time in use. * @return: true if successful, false if failed */ boolean_t 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) { LogError("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) { LogError("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.system = (total > 0) ? (100. * (double)(cp_time[CP_SYS] - cpu_syst_old) / total) : -1.; si->cpu.usage.wait = 0.; /* there is no wait statistic available */ cpu_user_old = cp_time[CP_USER]; cpu_syst_old = cp_time[CP_SYS]; return true; } monit-5.26.0/src/process/sysdep_AIX.c0000664000175000017500000002553013507751326017301 0ustar martinpmartinp/* * 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_wait_old = 0ULL; boolean_t init_process_info_sysdep(void) { perfstat_memory_total_t mem; if (perfstat_memory_total(NULL, &mem, sizeof(perfstat_memory_total_t), 1) < 1) { LogError("system statistic error -- perfstat_memory_total failed: %s\n", STRERROR); return false; } page_size = getpagesize(); systeminfo.memory.size = (uint64_t)mem.real_total * (uint64_t)page_size; systeminfo.cpu.count = sysconf(_SC_NPROCESSORS_ONLN); setutxent(); struct utmpx _booted = {.ut_type = BOOT_TIME}; struct utmpx *booted = getutxid(&_booted); if (booted) systeminfo.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) { LogError("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 initprocesstree_sysdep(ProcessTree_T **reference, ProcessEngine_Flags pflags) { int treesize; pid_t firstproc = 0; if ((treesize = getprocs64(NULL, 0, NULL, 0, &firstproc, PID_MAX)) < 0) { LogError("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); LogError("system statistic error -- getprocs64 failed: %s\n", STRERROR); return 0; } 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 = systeminfo.time / 10. - procs[i].pi_start; pt[i].memory.usage = (uint64_t)(procs[i].pi_drss + procs[i].pi_trss) * (uint64_t)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.operations = procs[i].pi_ru.ru_inblock; pt[i].write.operations = procs[i].pi_ru.ru_oublock; 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) LogError("Socket close failed -- %s\n", STRERROR); continue; } if (close(fd) < 0) LogError("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[4096]; 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) */ boolean_t 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) { LogError("system statistic error -- perfstat_memory_total failed: %s\n", STRERROR); return false; } si->memory.usage.bytes = (uint64_t)(mem.real_total - mem.real_free - mem.numperm) * (uint64_t)page_size; /* Swap */ si->swap.size = (uint64_t)mem.pgsp_total * 4096; /* 4kB blocks */ si->swap.usage.bytes = (uint64_t)(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) */ boolean_t 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_wait = 0ULL; if (perfstat_cpu_total(NULL, &cpu, sizeof(perfstat_cpu_total_t), 1) < 0) { LogError("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_wait = 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.wait = 100. * ((double)(cpu_wait - cpu_wait_old) / (double)cpu_total); } else { si->cpu.usage.user = 0.; si->cpu.usage.system = 0.; si->cpu.usage.wait = 0.; } } cpu_user_old = cpu_user; cpu_syst_old = cpu_syst; cpu_wait_old = cpu_wait; cpu_initialized = 1; return true; } monit-5.26.0/src/process/sysdep_UNKNOWN.c0000664000175000017500000000461113507751326020014 0ustar martinpmartinp/* * 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_process_info_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 initprocesstree_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) */ boolean_t 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) */ boolean_t used_system_cpu_sysdep(SystemInfo_T *si) { return false; } monit-5.26.0/src/process/ProcessTree.h0000664000175000017500000000664013507751326017535 0ustar martinpmartinp/* * 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 { boolean_t visited; boolean_t 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 { uint64_t usage; uint64_t usage_total; } memory; struct { uint64_t time; uint64_t bytes; uint64_t operations; } read; struct { uint64_t time; uint64_t bytes; uint64_t operations; } write; time_t uptime; char *cmdline; char *secattr; } 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 infomation. * @param s A Service object * @param pid Process PID to update * @return true if succeeded otherwise false. */ boolean_t 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); /** * Initialize the system information * @return true if succeeded otherwise false. */ boolean_t init_system_info(void); /** * Update system statistic * @return true if successful, otherwise false */ boolean_t update_system_info(void); #endif monit-5.26.0/src/process/sysdep_SOLARIS.c0000664000175000017500000003427113507751326017776 0ustar martinpmartinp/* * 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 #define _SYS_VNODE_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 "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_wait = 0; static long old_total = 0; #define MAXSTRSIZE 80 boolean_t init_process_info_sysdep(void) { systeminfo.cpu.count = sysconf( _SC_NPROCESSORS_ONLN); page_size = getpagesize(); systeminfo.memory.size = (uint64_t)sysconf(_SC_PHYS_PAGES) * (uint64_t)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) systeminfo.booted = (uint64_t)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 initprocesstree_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) { LogError("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 = systeminfo.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 = (uint64_t)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.operations = usage->pr_inblk; pt[i].write.operations = usage->pr_oublk; } } } *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) */ boolean_t 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) { LogError("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 = (uint64_t)rss->value.i64; } else { /* Solaris Zone */ size_t nres; vmusage_t result; if (getvmusage(VMUSAGE_ZONE, Run.polltime, &result, &nres) != 0) { LogError("system statistic error -- getvmusage failed\n"); kstat_close(kctl); return false; } si->memory.usage.bytes = (uint64_t)result.vmu_rss_all; } } else { kstat = kstat_lookup(kctl, "unix", 0, "system_pages"); if (kstat_read(kctl, kstat, 0) == -1) { LogError("system statistic error -- memory usage data collection failed\n"); kstat_close(kctl); return false; } knamed = kstat_data_lookup(kstat, "freemem"); if (knamed) { uint64_t freemem = (uint64_t)knamed->value.ul * (uint64_t)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 = (uint64_t)knamed->value.ul; } si->memory.usage.bytes = systeminfo.memory.size - freemem - arcsize; } } kstat_close(kctl); /* Swap */ again: if ((num = swapctl(SC_GETNSWP, 0)) == -1) { LogError("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 *)ALLOC(num * sizeof(swapent_t) + sizeof(struct swaptable)); strtab = (char *)ALLOC((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) { LogError("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 = (uint64_t)total * (uint64_t)page_size; si->swap.usage.bytes = (uint64_t)used * (uint64_t)page_size; return true; } /** * This routine returns system/user CPU time in use. * @return: true if successful, false if failed (or not available) */ boolean_t used_system_cpu_sysdep(SystemInfo_T *si) { int ncpu = 0, ncpus; long cpu_user = 0, cpu_syst = 0, cpu_wait = 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.wait = 0; kctl = kstat_open(); kstat = kstat_lookup(kctl, "unix", 0, "system_misc"); if (kstat_read(kctl, kstat, 0) == -1) { LogError("system statistic -- failed to lookup unix::system_misc kstat\n"); goto error; } if (NULL == (knamed = kstat_data_lookup(kstat, "ncpus"))) { LogError("system statistic -- ncpus kstat lookup failed\n"); goto error; } if ((ncpus = knamed->value.ui32) == 0) { LogError("system statistic -- ncpus is 0\n"); goto error; } cpu_ks = (kstat_t **)ALLOC(ncpus * sizeof(kstat_t *)); cpu_stat = (cpu_stat_t *)ALLOC(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)) { LogError("system statistic -- failed to read cpu_stat kstat\n"); goto error2; } cpu_ks[ncpu] = kstat; if (++ncpu > ncpus) { LogError("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])) { LogError("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_wait += 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.wait = -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.wait = (100. * (cpu_wait - old_cpu_wait)) / diff_total; } old_cpu_user = cpu_user; old_cpu_syst = cpu_syst; old_cpu_wait = cpu_wait; 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; } monit-5.26.0/src/process/ProcessTree.c0000664000175000017500000005526613507751326017540 0ustar martinpmartinp/* * 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 #ifdef HAVE_COREFOUNDATION_COREFOUNDATION_H #include #endif #include "monit.h" #include "event.h" #include "ProcessTree.h" #include "process_sysdep.h" #include "Box.h" #include "Color.h" // libmonit #include "system/Time.h" /** * General purpose /proc methods. * * @file */ /* ------------------------------------------------------------- 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 recusively 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; 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; } } } /** * 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 informations * @param prev Process informations from previous cycle * @param delta The delta of system time between current and previous cycle * @return Process' CPU usage [%] since last cycle */ static float _cpuUsage(float rawUsage, unsigned threads) { if (systeminfo.cpu.count > 0 && rawUsage > 0) { int divisor; if (threads > 1) { if (threads >= systeminfo.cpu.count) { // Multithreaded application with more threads then CPU cores divisor = systeminfo.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' 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); } } systeminfo.time_prev = systeminfo.time; systeminfo.time = Time_milli() / 100.; if ((ptreesize = initprocesstree_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 = systeminfo.time - systeminfo.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 (systeminfo.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' 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() { _delete(&ptree, &ptreesize); } boolean_t 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; if (systeminfo.memory.size > 0) { s->inf.process->total_mem_percent = ptree[leaf].memory.usage_total >= systeminfo.memory.size ? 100. : (100. * (double)ptree[leaf].memory.usage_total / (double)systeminfo.memory.size); s->inf.process->mem_percent = ptree[leaf].memory.usage >= systeminfo.memory.size ? 100. : (100. * (double)ptree[leaf].memory.usage / (double)systeminfo.memory.size); } if (ptree[leaf].read.bytes) Statistics_update(&(s->inf.process->read.bytes), ptree[leaf].read.time, ptree[leaf].read.bytes); if (ptree[leaf].read.operations) Statistics_update(&(s->inf.process->read.operations), ptree[leaf].read.time, ptree[leaf].read.operations); if (ptree[leaf].write.bytes) Statistics_update(&(s->inf.process->write.bytes), ptree[leaf].write.time, ptree[leaf].write.bytes); if (ptree[leaf].write.operations) 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; } pid_t ProcessTree_findProcess(Service_T s) { ASSERT(s); // Test the cached PID first if (s->inf.process->pid > 0) { errno = 0; if (getpgid(s->inf.process->pid) > -1 || errno == EPERM) return s->inf.process->pid; } // If the cached PID is not running, scan for the process again if (s->matchlist) { // 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 { pid_t pid = Util_getPid(s->path); if (pid > 0) { errno = 0; if (getpgid(pid) > -1 || errno == EPERM) return pid; DEBUG("'%s' process test failed [pid=%d] -- %s\n", s->name, pid, STRERROR); } } 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); Box_T t = Box_new(output, 4, (BoxColumn_T []){ {.name = "", .width = 1, .wrap = false, .align = BoxAlign_Left}, {.name = "PID", .width = 5, .wrap = false, .align = BoxAlign_Right}, {.name = "PPID", .width = 5, .wrap = false, .align = BoxAlign_Right}, {.name = "Command", .width = 56, .wrap = true, .align = BoxAlign_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) { Box_setColumn(t, 1, COLOR_BOLD "*" COLOR_RESET); Box_setColumn(t, 2, COLOR_BOLD "%d" COLOR_RESET, ptree[i].pid); Box_setColumn(t, 3, COLOR_BOLD "%d" COLOR_RESET, ptree[i].ppid); Box_setColumn(t, 4, COLOR_BOLD "%s" COLOR_RESET, ptree[i].cmdline); } else { Box_setColumn(t, 2, "%d", ptree[i].pid); Box_setColumn(t, 3, "%d", ptree[i].ppid); Box_setColumn(t, 4, "%s", ptree[i].cmdline); } Box_printRow(t); count++; } } } Box_free(&t); if (Run.flags & Run_Batch || ! Color_support()) Color_strip(Box_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); } //FIXME: move to standalone system class boolean_t init_system_info(void) { memset(&systeminfo, 0, sizeof(SystemInfo_T)); gettimeofday(&systeminfo.collected, NULL); if (uname(&systeminfo.uname) < 0) { LogError("'%s' resource monitoring initialization error -- uname failed: %s\n", Run.system->name, STRERROR); return false; } #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, systeminfo.uname.sysname, sizeof(systeminfo.uname.sysname), CFStringGetSystemEncoding()); } value = CFDictionaryGetValue(propertyList, CFSTR("ProductVersion")); if (value) { CFStringGetCString(value, systeminfo.uname.release, sizeof(systeminfo.uname.release), CFStringGetSystemEncoding()); } CFRelease(propertyList); } CFReadStreamClose(stream); } CFRelease(stream); } CFRelease(url); } #endif systeminfo.cpu.usage.user = -1.; systeminfo.cpu.usage.system = -1.; systeminfo.cpu.usage.wait = -1.; return (init_process_info_sysdep()); } //FIXME: move to standalone system class boolean_t update_system_info() { if (getloadavg_sysdep(systeminfo.loadavg, 3) == -1) { LogError("'%s' statistic error -- load average data collection failed\n", Run.system->name); goto error1; } if (! used_system_memory_sysdep(&systeminfo)) { LogError("'%s' statistic error -- memory usage data collection failed\n", Run.system->name); goto error2; } systeminfo.memory.usage.percent = systeminfo.memory.size > 0ULL ? (100. * (double)systeminfo.memory.usage.bytes / (double)systeminfo.memory.size) : 0.; systeminfo.swap.usage.percent = systeminfo.swap.size > 0ULL ? (100. * (double)systeminfo.swap.usage.bytes / (double)systeminfo.swap.size) : 0.; if (! used_system_cpu_sysdep(&systeminfo)) { LogError("'%s' statistic error -- cpu usage data collection failed\n", Run.system->name); goto error3; } return true; error1: systeminfo.loadavg[0] = 0; systeminfo.loadavg[1] = 0; systeminfo.loadavg[2] = 0; error2: systeminfo.memory.usage.bytes = 0ULL; systeminfo.memory.usage.percent = 0.; systeminfo.swap.usage.bytes = 0ULL; systeminfo.swap.usage.percent = 0.; error3: systeminfo.cpu.usage.user = 0.; systeminfo.cpu.usage.system = 0.; systeminfo.cpu.usage.wait = 0.; return false; } monit-5.26.0/src/process/sysdep_OPENBSD.c0000664000175000017500000002404313507751326017750 0ustar martinpmartinp/* * 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_syst_old = 0; static unsigned maxslp; /* ------------------------------------------------------------------ Public */ boolean_t init_process_info_sysdep(void) { int mib[2] = {CTL_HW, HW_NCPU}; size_t len = sizeof(systeminfo.cpu.count); if (sysctl(mib, 2, &systeminfo.cpu.count, &len, NULL, 0) == -1) { DEBUG("system statistic error -- cannot get cpu count: %s\n", STRERROR); return false; } int64_t 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; } systeminfo.memory.size = (uint64_t)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 { systeminfo.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 initprocesstree_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) { LogError("system statistic error -- vm.maxslp failed\n"); return 0; } if (sysctl(mib_proc, 6, NULL, &size, NULL, 0) == -1) { LogError("system statistic error -- kern.proc #1 failed\n"); return 0; } size *= 2; // Add reserve for new processes which were created between calls of sysctl 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); LogError("system statistic error -- kern.proc #2 failed\n"); return 0; } treesize = (int)(size / sizeof(struct kinfo_proc)); pt = CALLOC(sizeof(ProcessTree_T), treesize); uint64_t now = Time_milli(); if (! (kvm_handle = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, buf))) { FREE(pinfo); FREE(pt); LogError("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 = systeminfo.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 = (uint64_t)pinfo[i].p_vm_rssize * (uint64_t)pagesize; pt[index].zombie = pinfo[i].p_stat == SZOMB ? true : false; pt[index].read.operations = pinfo[i].p_uru_inblock; 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) */ boolean_t 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; LogError("system statistic error -- cannot get memory usage: %s\n", STRERROR); return false; } si->memory.usage.bytes = (uint64_t)(vm.active + vm.wired) * (uint64_t)pagesize; si->swap.size = (uint64_t)vm.swpages * (uint64_t)pagesize; si->swap.usage.bytes = (uint64_t)vm.swpginuse * (uint64_t)pagesize; return true; } /** * This routine returns system/user CPU time in use. * @return: true if successful, false if failed */ boolean_t 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) { LogError("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.system = (total > 0) ? (100. * (double)(cp_time[CP_SYS] - cpu_syst_old) / total) : -1.; si->cpu.usage.wait = 0; /* there is no wait statistic available */ cpu_user_old = cp_time[CP_USER]; cpu_syst_old = cp_time[CP_SYS]; return true; } monit-5.26.0/src/md5.c0000664000175000017500000003236613507751326014305 0ustar martinpmartinp/* 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 #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) 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 (! ((data - (const md5_byte_t *)0) & 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); } 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.26.0/src/sha1.h0000664000175000017500000000271113507751326014450 0ustar martinpmartinp/* * 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.26.0/src/sha1.c0000664000175000017500000001466713507751326014460 0ustar martinpmartinp/* * 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. */ 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; block = (CHAR64LONG16*)buffer; /* 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, (unsigned char *)"\200", 1); while ((context->count[0] & 504) != 448) sha1_append(context, (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.26.0/aclocal.m40000664000175000017500000012246713507751337014531 0ustar martinpmartinp# generated automatically by aclocal 1.15.1 -*- Autoconf -*- # Copyright (C) 1996-2017 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.69],, [m4_warning([this file was generated for autoconf 2.69. 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-2017 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.15' 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.15.1], [], [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.15.1])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-2017 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-2017 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-2017 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-2017 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. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _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. FIXME. This creates each '.P' file that we will # 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" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2017 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 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_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([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 ]) 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-2017 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-2017 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-2017 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 to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2017 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 case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac 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-2017 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-2017 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-2017 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-2017 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-2017 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-2017 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-2017 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-2017 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]) monit-5.26.0/m4/0000775000175000017500000000000013507751355013175 5ustar martinpmartinpmonit-5.26.0/m4/lt~obsolete.m40000644000175000017500000001377413507751336016022 0ustar martinpmartinp# 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.26.0/m4/libtool.m40000644000175000017500000112617113507751336015111 0ustar martinpmartinp# 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 cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru 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[[91]]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[[012]][[,.]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _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=cru} _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 if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && 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' ;; # 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.26.0/m4/ltoptions.m40000644000175000017500000003426213507751336015476 0ustar martinpmartinp# 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.26.0/m4/ltversion.m40000644000175000017500000000127313507751336015464 0ustar martinpmartinp# 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.26.0/m4/ltsugar.m40000644000175000017500000001044013507751336015114 0ustar martinpmartinp# 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.26.0/configure0000775000175000017500000204244713507751340014573 0ustar martinpmartinp#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for monit 5.26.0. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -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_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: 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_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If 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 } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null 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.26.0' PACKAGE_STRING='monit 5.26.0' 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_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS ENABLE_PROFILING_FALSE ENABLE_PROFILING_TRUE ssllibdir sslincldir ARCH LIBOBJS CPP 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__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC subdirs AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V 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' 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_largefiles enable_largefile with_zlib with_pam with_ssl_static with_ssl with_ssl_dir with_ssl_incl_dir with_ssl_lib_dir enable_optimized enable_profiling ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS LT_SYS_LIBRARY_PATH CPP' 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 # Accept the important Cygnus configure options, so we can diagnose typos. 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=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_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=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_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=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_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=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. 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. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; 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" ;; *) $as_echo "$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 || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then 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.26.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/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.26.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-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-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). --without-ipv6 Disable the IPv6 support (default: enabled) --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-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. CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _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=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF monit configure 5.26.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## --------------------------------------- ## ## Report this to monit-general@nongnu.org ## ## --------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { 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 cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { 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 eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #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 eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl 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.26.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file 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,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in config "$srcdir"/config; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. am__api_version='1.15' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if 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+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # 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' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "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=`$as_echo "$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 case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. 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 (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ '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+set}" = set; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi 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+set}" = set; 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} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else 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 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$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.26.0' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # 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 -' # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$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" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : 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= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_YACC+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_YACC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 $as_echo "$YACC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_FLEX+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_FLEX="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_FLEX" && ac_cv_path_FLEX="no" ;; esac fi FLEX=$ac_cv_path_FLEX if test -n "$FLEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FLEX" >&5 $as_echo "$FLEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_POD2MAN+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_POD2MAN="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_POD2MAN" && ac_cv_path_POD2MAN="no" ;; esac fi POD2MAN=$ac_cv_path_POD2MAN if test -n "$POD2MAN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $POD2MAN" >&5 $as_echo "$POD2MAN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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.26.0 --date='www.mmonit.com' --lax" fi # ------------------------------------------------------------------------ # Libtool # ------------------------------------------------------------------------ # Check whether --enable-static was given. if test "${enable_static+set}" = set; 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 enable_static=no fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "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*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. 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 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. 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 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$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+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else 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 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; 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=$? $as_echo "$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=$? $as_echo "$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.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac 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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # 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=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && 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=$? $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else 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|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 $as_echo "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 $as_echo_n "checking for a working dd... " >&6; } if ${ac_cv_path_lt_DD+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 $as_echo "$ac_cv_path_lt_DD" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 $as_echo_n "checking how to truncate binary pipes... " >&6; } if ${lt_cv_truncate_bin+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 $as_echo "$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+set}" = set; 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=$? $as_echo "$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=$? $as_echo "$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=$? $as_echo "$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=$? $as_echo "$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" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else 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 () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$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=$? $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else 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 test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else 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 () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else 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 cru libconftest.a conftest.o" >&5 $AR cru 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$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[91]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _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_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : 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 : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; 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 enable_shared=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; 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 pic_mode=default fi # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; 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 enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test "${with_aix_soname+set}" = set; 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 if ${lt_cv_with_aix_soname+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$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' ;; # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$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\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "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 ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; 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$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 ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; 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$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) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else 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 lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $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=$? $as_echo "$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=$? $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "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 ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else 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 () { ; 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$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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$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 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_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$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 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_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$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_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$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_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$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" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else 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=$? $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$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\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else 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=$? $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$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= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "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" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "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" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report what library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } if ${ac_cv_lib_socket_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_socket=yes else ac_cv_lib_socket_socket=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } if test "x$ac_cv_lib_socket_socket" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF LIBS="-lsocket $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -linet" >&5 $as_echo_n "checking for socket in -linet... " >&6; } if ${ac_cv_lib_inet_socket+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_inet_socket=yes else ac_cv_lib_inet_socket=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet_socket" >&5 $as_echo "$ac_cv_lib_inet_socket" >&6; } if test "x$ac_cv_lib_inet_socket" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBINET 1 _ACEOF LIBS="-linet $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_addr in -lnsl" >&5 $as_echo_n "checking for inet_addr in -lnsl... " >&6; } if ${ac_cv_lib_nsl_inet_addr+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char inet_addr (); int main () { return inet_addr (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_inet_addr=yes else ac_cv_lib_nsl_inet_addr=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_inet_addr" >&5 $as_echo "$ac_cv_lib_nsl_inet_addr" >&6; } if test "x$ac_cv_lib_nsl_inet_addr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNSL 1 _ACEOF LIBS="-lnsl $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lresolv" >&5 $as_echo_n "checking for inet_aton in -lresolv... " >&6; } if ${ac_cv_lib_resolv_inet_aton+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char inet_aton (); int main () { return inet_aton (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_resolv_inet_aton=yes else ac_cv_lib_resolv_inet_aton=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_inet_aton" >&5 $as_echo "$ac_cv_lib_resolv_inet_aton" >&6; } if test "x$ac_cv_lib_resolv_inet_aton" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBRESOLV 1 _ACEOF LIBS="-lresolv $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lc" >&5 $as_echo_n "checking for crypt in -lc... " >&6; } if ${ac_cv_lib_c_crypt+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char crypt (); int main () { return crypt (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_c_crypt=yes else ac_cv_lib_c_crypt=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_crypt" >&5 $as_echo "$ac_cv_lib_c_crypt" >&6; } if test "x$ac_cv_lib_c_crypt" = xyes; then : : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5 $as_echo_n "checking for crypt in -lcrypt... " >&6; } if ${ac_cv_lib_crypt_crypt+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char crypt (); int main () { return crypt (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_crypt_crypt=yes else ac_cv_lib_crypt_crypt=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt" >&5 $as_echo "$ac_cv_lib_crypt_crypt" >&6; } if test "x$ac_cv_lib_crypt_crypt" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBCRYPT 1 _ACEOF LIBS="-lcrypt $LIBS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_create=yes else ac_cv_lib_pthread_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF LIBS="-lpthread $LIBS" else as_fn_error $? "POSIX thread library is required" "$LINENO" 5 fi # ------------------------------------------------------------------------ # Header files # ------------------------------------------------------------------------ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if ${ac_cv_header_sys_wait_h+:} false; then : $as_echo_n "(cached) " >&6 else cat 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 () { 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 ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 $as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5 $as_echo_n "checking whether stat file-mode macros are broken... " >&6; } if ${ac_cv_header_stat_broken+:} false; then : $as_echo_n "(cached) " >&6 else 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 ac_cv_header_stat_broken=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5 $as_echo "$ac_cv_header_stat_broken" >&6; } if test $ac_cv_header_stat_broken = yes; then $as_echo "#define STAT_MACROS_BROKEN 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi for ac_header in \ 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/boolean.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 \ setjmp.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/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 \ inttypes.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in \ libperfstat.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " #ifdef HAVE_SYS_PROTOSW_H #include #endif " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in \ netinet/ip.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " #ifdef HAVE_SYS_TYPES_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif #if HAVE_NETINET_IN_SYSTM_H #include #endif " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in \ net/if.h \ netinet/ip_icmp.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " #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 eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in \ netinet/icmp6.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " #ifdef HAVE_SYS_TYPES_H #include #endif #if HAVE_NETINET_IP_H #include #endif " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in \ sys/sysctl.h \ sys/mount.h \ sys/proc.h \ sys/swap.h \ sys/ucred.h \ sys/user.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " #ifdef HAVE_SYS_PARAM_H #include #endif " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in \ machine/vmparam.h \ vm/pmap.h \ machine/pmap.h \ vm/vm_map.h \ vm/vm_object.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " #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 eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in \ sys/resourcevar.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_SYS_RESOURCE_H #include #endif " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in \ uvm/uvm_map.h \ uvm/uvm_pmap.h \ uvm/uvm_object.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " #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 eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in \ uvm/uvm.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " #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 eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # ------------------------------------------------------------------------ # Types # ------------------------------------------------------------------------ ac_fn_c_check_type "$LINENO" "boolean_t" "ac_cv_type_boolean_t" " #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_MACH_BOOLEAN_H #include #endif #ifdef HAVE_UVM_UVM_PARAM_H #include #endif #ifdef HAVE_VM_VM_H #include #endif #ifdef HAVE_KINFO_H #include #endif " if test "x$ac_cv_type_boolean_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_BOOLEAN_T 1 _ACEOF fi 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 cat >>confdefs.h <<_ACEOF #define mode_t int _ACEOF 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 cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF 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 cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF 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 cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if ${ac_cv_type_signal+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF # Check for structures. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } if ${ac_cv_struct_tm+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { 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 ac_cv_struct_tm=sys/time.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 $as_echo "$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then $as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h 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 : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_GMTOFF 1 _ACEOF fi # ------------------------------------------------------------------------ # Functions # ------------------------------------------------------------------------ # Checks for library functions. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5 $as_echo_n "checking for error_at_line... " >&6; } if ${ac_cv_lib_error_at_line+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { 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 ac_cv_lib_error_at_line=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_error_at_line" >&5 $as_echo "$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 for ac_header in vfork.h do : ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" if test "x$ac_cv_header_vfork_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VFORK_H 1 _ACEOF fi done for ac_func in fork vfork do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } if ${ac_cv_func_fork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_fork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_fork_works=yes else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } if ${ac_cv_func_vfork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_vfork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* 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 #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { 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 () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); 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); /* 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 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 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 $as_echo "$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 $as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h else $as_echo "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then : $as_echo_n "(cached) " >&6 else rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then if test "$cross_compiling" = yes; then : ac_cv_func_lstat_dereferences_slashed_symlink=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { 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 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 $as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && cat >>confdefs.h <<_ACEOF #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 _ACEOF 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5 $as_echo_n "checking whether stat accepts an empty string... " >&6; } if ${ac_cv_func_stat_empty_string_bug+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_stat_empty_string_bug=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { 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 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5 $as_echo "$ac_cv_func_stat_empty_string_bug" >&6; } if test $ac_cv_func_stat_empty_string_bug = yes; then case " $LIBOBJS " in *" stat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;; esac cat >>confdefs.h <<_ACEOF #define HAVE_STAT_EMPTY_STRING_BUG 1 _ACEOF 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 : cat >>confdefs.h <<_ACEOF #define HAVE_STRFTIME 1 _ACEOF else # strftime is in -lintl on SCO UNIX. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5 $as_echo_n "checking for strftime in -lintl... " >&6; } if ${ac_cv_lib_intl_strftime+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char strftime (); int main () { return strftime (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_strftime=yes else ac_cv_lib_intl_strftime=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5 $as_echo "$ac_cv_lib_intl_strftime" >&6; } if test "x$ac_cv_lib_intl_strftime" = xyes; then : $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h LIBS="-lintl $LIBS" fi fi done for ac_func in statfs do : ac_fn_c_check_func "$LINENO" "statfs" "ac_cv_func_statfs" if test "x$ac_cv_func_statfs" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STATFS 1 _ACEOF fi done for ac_func in statvfs do : ac_fn_c_check_func "$LINENO" "statvfs" "ac_cv_func_statvfs" if test "x$ac_cv_func_statvfs" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STATVFS 1 _ACEOF fi done for ac_func in setlocale do : ac_fn_c_check_func "$LINENO" "setlocale" "ac_cv_func_setlocale" if test "x$ac_cv_func_setlocale" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETLOCALE 1 _ACEOF fi done for ac_func in getaddrinfo do : ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo" if test "x$ac_cv_func_getaddrinfo" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETADDRINFO 1 _ACEOF fi done for ac_func in syslog do : ac_fn_c_check_func "$LINENO" "syslog" "ac_cv_func_syslog" if test "x$ac_cv_func_syslog" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYSLOG 1 _ACEOF fi done for ac_func in vsyslog do : ac_fn_c_check_func "$LINENO" "vsyslog" "ac_cv_func_vsyslog" if test "x$ac_cv_func_vsyslog" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VSYSLOG 1 _ACEOF fi done for ac_func in backtrace do : ac_fn_c_check_func "$LINENO" "backtrace" "ac_cv_func_backtrace" if test "x$ac_cv_func_backtrace" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_BACKTRACE 1 _ACEOF fi done for ac_func in getloadavg do : ac_fn_c_check_func "$LINENO" "getloadavg" "ac_cv_func_getloadavg" if test "x$ac_cv_func_getloadavg" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETLOADAVG 1 _ACEOF fi done for ac_func in getopt_long do : ac_fn_c_check_func "$LINENO" "getopt_long" "ac_cv_func_getopt_long" if test "x$ac_cv_func_getopt_long" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETOPT_LONG 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for va_copy" >&5 $as_echo_n "checking for va_copy... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { va_list ap; va_list ap_copy; va_copy(ap, ap_copy); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_VA_COPY 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext # ------------------------------------------------------------------------ # Compiler # ------------------------------------------------------------------------ # Compiler characteristics { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else 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.$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 () { #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 () { #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 ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi 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 () { #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 () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi 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. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; 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 () { 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.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* 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 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#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 # If the compiler is gcc, tune warnings and make the char type unsigned # and enable C99 support if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -Wall -Wunused -Wno-unused-label -funsigned-char"; # Add C99 support CFLAGS="$CFLAGS -D_GNU_SOURCE -std=c99" # does this compiler support -Wno-pointer-sign ? svd_CFLAGS="$CFLAGS" CFLAGS="-Wno-pointer-sign $CFLAGS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else CFLAGS="$svd_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # does this compiler support -Wno-address ? svd_CFLAGS="$CFLAGS" CFLAGS="-Wno-address $CFLAGS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else CFLAGS="$svd_CFLAGS" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi # ------------------------------------------------------------------------ # IPv6 Support # ------------------------------------------------------------------------ # Check whether --with-ipv6 was given. if test "${with_ipv6+set}" = set; then : withval=$with_ipv6; if test "x$withval" = "xno" then use_ipv6=0 elif test "x$withval" = "xyes" then use_ipv6=1 fi else use_ipv6=1 fi if test $use_ipv6 = 1 then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IPv6 support" >&5 $as_echo_n "checking for IPv6 support... " >&6; } if ${ac_cv_ipv6+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_ipv6=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #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.*/ main() { 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 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ipv6" >&5 $as_echo "$ac_cv_ipv6" >&6; } if test $ac_cv_ipv6 = yes then $as_echo "#define HAVE_IPV6 1" >>confdefs.h else use_ipv6=0 fi fi # ------------------------------------------------------------------------ # Paths # ------------------------------------------------------------------------ # Find the right directory to put the root-mode PID file in { $as_echo "$as_me:${as_lineno-$LINENO}: checking pid file location" >&5 $as_echo_n "checking pid file location... " >&6; } if test -d "/run" then piddir="/run" elif test -d "/var/run"; then piddir="/var/run" elif test -d "/etc"; then piddir="/etc" fi cat >>confdefs.h <<_ACEOF #define PIDDIR "$piddir" _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $piddir" >&5 $as_echo "$piddir" >&6; } # Test mounted filesystem description file if test -f "/etc/mtab" then $as_echo "#define HAVE_MTAB 1" >>confdefs.h elif test -f "/etc/mnttab"; then $as_echo "#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" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libzfs_init in -lzfs" >&5 $as_echo_n "checking for libzfs_init in -lzfs... " >&6; } if ${ac_cv_lib_zfs_libzfs_init+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char libzfs_init (); int main () { return libzfs_init (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_zfs_libzfs_init=yes else ac_cv_lib_zfs_libzfs_init=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_zfs_libzfs_init" >&5 $as_echo "$ac_cv_lib_zfs_libzfs_init" >&6; } if test "x$ac_cv_lib_zfs_libzfs_init" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBZFS 1 _ACEOF LIBS="-lzfs $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nvlist_free in -lnvpair" >&5 $as_echo_n "checking for nvlist_free in -lnvpair... " >&6; } if ${ac_cv_lib_nvpair_nvlist_free+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char nvlist_free (); int main () { return nvlist_free (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nvpair_nvlist_free=yes else ac_cv_lib_nvpair_nvlist_free=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nvpair_nvlist_free" >&5 $as_echo "$ac_cv_lib_nvpair_nvlist_free" >&6; } if test "x$ac_cv_lib_nvpair_nvlist_free" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNVPAIR 1 _ACEOF LIBS="-lnvpair $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kstat_open in -lkstat" >&5 $as_echo_n "checking for kstat_open in -lkstat... " >&6; } if ${ac_cv_lib_kstat_kstat_open+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char kstat_open (); int main () { return kstat_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_kstat_kstat_open=yes else ac_cv_lib_kstat_kstat_open=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kstat_kstat_open" >&5 $as_echo "$ac_cv_lib_kstat_kstat_open" >&6; } if test "x$ac_cv_lib_kstat_kstat_open" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBKSTAT 1 _ACEOF LIBS="-lkstat $LIBS" fi $as_echo "#define HAVE_CPU_WAIT 1" >>confdefs.h 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" if test `uname -r | awk -F '.' '{print$1$2}'` -ge "26" then $as_echo "#define HAVE_CPU_WAIT 1" >>confdefs.h fi elif test "$architecture" = "OpenBSD" then ARCH="OPENBSD" CFLAGS="$CFLAGS -D _REENTRANT" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5 $as_echo_n "checking for kvm_open in -lkvm... " >&6; } if ${ac_cv_lib_kvm_kvm_open+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char kvm_open (); int main () { return kvm_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_kvm_kvm_open=yes else ac_cv_lib_kvm_kvm_open=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5 $as_echo "$ac_cv_lib_kvm_kvm_open" >&6; } if test "x$ac_cv_lib_kvm_kvm_open" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBKVM 1 _ACEOF LIBS="-lkvm $LIBS" fi use_pam=0 # No PAM on OpenBSD (supports BSD Auth API instead of PAM) elif test "$architecture" = "FreeBSD" then ARCH="FREEBSD" CFLAGS="$CFLAGS -D _REENTRANT" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for devstat_getnumdevs in -ldevstat" >&5 $as_echo_n "checking for devstat_getnumdevs in -ldevstat... " >&6; } if ${ac_cv_lib_devstat_devstat_getnumdevs+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char devstat_getnumdevs (); int main () { return devstat_getnumdevs (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_devstat_devstat_getnumdevs=yes else ac_cv_lib_devstat_devstat_getnumdevs=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_devstat_devstat_getnumdevs" >&5 $as_echo "$ac_cv_lib_devstat_devstat_getnumdevs" >&6; } if test "x$ac_cv_lib_devstat_devstat_getnumdevs" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDEVSTAT 1 _ACEOF LIBS="-ldevstat $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5 $as_echo_n "checking for kvm_open in -lkvm... " >&6; } if ${ac_cv_lib_kvm_kvm_open+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char kvm_open (); int main () { return kvm_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_kvm_kvm_open=yes else ac_cv_lib_kvm_kvm_open=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5 $as_echo "$ac_cv_lib_kvm_kvm_open" >&6; } if test "x$ac_cv_lib_kvm_kvm_open" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBKVM 1 _ACEOF LIBS="-lkvm $LIBS" fi elif test "$architecture" = "GNU/kFreeBSD" then ARCH="FREEBSD" CFLAGS="$CFLAGS -D _REENTRANT" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for devstat_getnumdevs in -ldevstat" >&5 $as_echo_n "checking for devstat_getnumdevs in -ldevstat... " >&6; } if ${ac_cv_lib_devstat_devstat_getnumdevs+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char devstat_getnumdevs (); int main () { return devstat_getnumdevs (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_devstat_devstat_getnumdevs=yes else ac_cv_lib_devstat_devstat_getnumdevs=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_devstat_devstat_getnumdevs" >&5 $as_echo "$ac_cv_lib_devstat_devstat_getnumdevs" >&6; } if test "x$ac_cv_lib_devstat_devstat_getnumdevs" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDEVSTAT 1 _ACEOF LIBS="-ldevstat $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5 $as_echo_n "checking for kvm_open in -lkvm... " >&6; } if ${ac_cv_lib_kvm_kvm_open+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char kvm_open (); int main () { return kvm_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_kvm_kvm_open=yes else ac_cv_lib_kvm_kvm_open=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5 $as_echo "$ac_cv_lib_kvm_kvm_open" >&6; } if test "x$ac_cv_lib_kvm_kvm_open" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBKVM 1 _ACEOF LIBS="-lkvm $LIBS" fi elif test "$architecture" = "NetBSD" then ARCH="NETBSD" CFLAGS="$CFLAGS -D _REENTRANT -Wno-char-subscripts" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5 $as_echo_n "checking for kvm_open in -lkvm... " >&6; } if ${ac_cv_lib_kvm_kvm_open+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char kvm_open (); int main () { return kvm_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_kvm_kvm_open=yes else ac_cv_lib_kvm_kvm_open=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5 $as_echo "$ac_cv_lib_kvm_kvm_open" >&6; } if test "x$ac_cv_lib_kvm_kvm_open" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBKVM 1 _ACEOF LIBS="-lkvm $LIBS" fi elif test "$architecture" = "DragonFly" then ARCH="DRAGONFLY" CFLAGS="$CFLAGS -D _REENTRANT" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5 $as_echo_n "checking for kvm_open in -lkvm... " >&6; } if ${ac_cv_lib_kvm_kvm_open+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char kvm_open (); int main () { return kvm_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_kvm_kvm_open=yes else ac_cv_lib_kvm_kvm_open=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5 $as_echo "$ac_cv_lib_kvm_kvm_open" >&6; } if test "x$ac_cv_lib_kvm_kvm_open" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBKVM 1 _ACEOF LIBS="-lkvm $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getnumdevs in -ldevstat" >&5 $as_echo_n "checking for getnumdevs in -ldevstat... " >&6; } if ${ac_cv_lib_devstat_getnumdevs+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char getnumdevs (); int main () { return getnumdevs (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_devstat_getnumdevs=yes else ac_cv_lib_devstat_getnumdevs=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_devstat_getnumdevs" >&5 $as_echo "$ac_cv_lib_devstat_getnumdevs" >&6; } if test "x$ac_cv_lib_devstat_getnumdevs" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDEVSTAT 1 _ACEOF 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" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kvm_open in -lkvm" >&5 $as_echo_n "checking for kvm_open in -lkvm... " >&6; } if ${ac_cv_lib_kvm_kvm_open+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char kvm_open (); int main () { return kvm_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_kvm_kvm_open=yes else ac_cv_lib_kvm_kvm_open=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_kvm_kvm_open" >&5 $as_echo "$ac_cv_lib_kvm_kvm_open" >&6; } if test "x$ac_cv_lib_kvm_kvm_open" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBKVM 1 _ACEOF LIBS="-lkvm $LIBS" fi LIBS="$LIBS -framework System -framework CoreFoundation -framework DiskArbitration -framework IOKit -multiply_defined suppress" 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" $as_echo "#define HAVE_CPU_WAIT 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Architecture not supported: ${architecture}" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for large files support" >&5 $as_echo_n "checking for large files support... " >&6; } # Check whether --with-largefiles was given. if test "${with_largefiles+set}" = set; then : withval=$with_largefiles; if test "x$withval" = "xno" ; then use_largefiles=0 { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 $as_echo "disabled" >&6; } fi if test "x$withval" = "xyes" ; then use_largefiles=1 { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 $as_echo "enabled" >&6; } fi else if test `uname` = "AIX" then use_largefiles=0 { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 $as_echo "disabled" >&6; } else use_largefiles=1 { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 $as_echo "enabled" >&6; } fi fi # Settings for largefiles support if test "$use_largefiles" = 1; then # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then : enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } if ${ac_cv_sys_largefile_CC+:} false; then : $as_echo_n "(cached) " >&6 else 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 () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : break fi rm -f core conftest.err conftest.$ac_objext 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 break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 $as_echo "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if ${ac_cv_sys_file_offset_bits+:} false; then : $as_echo_n "(cached) " >&6 else 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 () { ; 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.$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 () { ; 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.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 $as_echo "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } if ${ac_cv_sys_large_files+:} false; then : $as_echo_n "(cached) " >&6 else 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 () { ; 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.$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 () { ; 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.$ac_ext ac_cv_sys_large_files=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 $as_echo "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF ;; esac rm -rf conftest* fi fi $as_echo "#define HAVE_LARGEFILES 1" >>confdefs.h fi # ------------------------------------------------------------------------ # zlib Code # ------------------------------------------------------------------------ # Check whether --with-zlib was given. if test "${with_zlib+set}" = set; then : withval=$with_zlib; if test "x$withval" = "xyes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlibVersion in -lz" >&5 $as_echo_n "checking for zlibVersion in -lz... " >&6; } if ${ac_cv_lib_z_zlibVersion+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char zlibVersion (); int main () { return zlibVersion (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_zlibVersion=yes else ac_cv_lib_z_zlibVersion=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_zlibVersion" >&5 $as_echo "$ac_cv_lib_z_zlibVersion" >&6; } if test "x$ac_cv_lib_z_zlibVersion" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBZ 1 _ACEOF LIBS="-lz $LIBS" else zlib="false" as_fn_error $? "libz not found" "$LINENO" 5 fi for ac_header in zlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" if test "x$ac_cv_header_zlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ZLIB_H 1 _ACEOF fi done elif test "x$withval" != "xno"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlib in $withval" >&5 $as_echo_n "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 $as_echo "#define HAVE_LIBZ 1" >>confdefs.h $as_echo "#define HAVE_ZLIB_H 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } else zlib="false" as_fn_error $? "zlib not found in $withval" "$LINENO" 5 fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlibVersion in -lz" >&5 $as_echo_n "checking for zlibVersion in -lz... " >&6; } if ${ac_cv_lib_z_zlibVersion+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char zlibVersion (); int main () { return zlibVersion (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_zlibVersion=yes else ac_cv_lib_z_zlibVersion=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_zlibVersion" >&5 $as_echo "$ac_cv_lib_z_zlibVersion" >&6; } if test "x$ac_cv_lib_z_zlibVersion" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBZ 1 _ACEOF LIBS="-lz $LIBS" else zlib="false" as_fn_error $? "libz not found" "$LINENO" 5 fi for ac_header in zlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" if test "x$ac_cv_header_zlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ZLIB_H 1 _ACEOF fi done fi # ------------------------------------------------------------------------ # PAM Code # ------------------------------------------------------------------------ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PAM support" >&5 $as_echo_n "checking for PAM support... " >&6; } # Check whether --with-pam was given. if test "${with_pam+set}" = set; then : withval=$with_pam; if test "x$withval" = "xno" ; then use_pam=0 { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 $as_echo "disabled" >&6; } fi if test "x$withval" = "xyes" ; then use_pam=1 { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 $as_echo "enabled" >&6; } fi else if test "$use_pam" = "0"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 $as_echo "disabled" >&6; } else use_pam=1 { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 $as_echo "enabled" >&6; } fi fi if test "$use_pam" = "1"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pam_start in -lpam" >&5 $as_echo_n "checking for pam_start in -lpam... " >&6; } if ${ac_cv_lib_pam_pam_start+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char pam_start (); int main () { return pam_start (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pam_pam_start=yes else ac_cv_lib_pam_pam_start=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pam_pam_start" >&5 $as_echo "$ac_cv_lib_pam_pam_start" >&6; } if test "x$ac_cv_lib_pam_pam_start" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPAM 1 _ACEOF LIBS="-lpam $LIBS" else 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 # ------------------------------------------------------------------------ # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for static SSL support" >&5 $as_echo_n "checking for static SSL support... " >&6; } # Check whether --with-ssl-static was given. if test "${with_ssl_static+set}" = set; 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 use_sslstatic=1 LDFLAGS="`echo $LDFLAGS | sed -e 's/-rdynamic/-ldl/g'`" { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 $as_echo "enabled" >&6; } $as_echo "#define HAVE_OPENSSL 1" >>confdefs.h CFLAGS="$CFLAGS -I$sslincldir" LIBS="$LIBS $ssllibdir/libssl.a $ssllibdir/libcrypto.a" else use_sslstatic=0 { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 $as_echo "disabled" >&6; } fi if test "$use_sslstatic" = "0" then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL support" >&5 $as_echo_n "checking for SSL support... " >&6; } # Check whether --with-ssl was given. if test "${with_ssl+set}" = set; then : withval=$with_ssl; if test "x$withval" = "xno" ; then use_ssl=0 { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 $as_echo "disabled" >&6; } fi if test "x$withval" = "xyes" ; then use_ssl=1 { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 $as_echo "enabled" >&6; } fi else use_ssl=1 { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled" >&5 $as_echo "enabled" >&6; } fi # Check for SSL directory if test "$use_ssl" = "1"; then # Check whether --with-ssl-dir was given. if test "${with_ssl_dir+set}" = set; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL include directory" >&5 $as_echo_n "checking for SSL include directory... " >&6; } # Check whether --with-ssl-incl-dir was given. if test "${with_ssl_incl_dir+set}" = set; then : withval=$with_ssl_incl_dir; checksslincldir "$withval" else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: Not found" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sslincldir" >&5 $as_echo "$sslincldir" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL library directory" >&5 $as_echo_n "checking for SSL library directory... " >&6; } # Check whether --with-ssl-lib-dir was given. if test "${with_ssl_lib_dir+set}" = set; then : withval=$with_ssl_lib_dir; checkssllibdirdynamic "$withval" else 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/${build} \ $maindir/lib/${build_alias}; do checkssllibdirdynamic $dir && break 2 done done fi fi if test -z "$ssllibdir"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: Not found" >&5 $as_echo "Not found" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_new in -lssl" >&5 $as_echo_n "checking for SSL_new in -lssl... " >&6; } if ${ac_cv_lib_ssl_SSL_new+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char SSL_new (); int main () { return SSL_new (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ssl_SSL_new=yes else ac_cv_lib_ssl_SSL_new=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_new" >&5 $as_echo "$ac_cv_lib_ssl_SSL_new" >&6; } if test "x$ac_cv_lib_ssl_SSL_new" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSSL 1 _ACEOF LIBS="-lssl $LIBS" else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CRYPTO_new_ex_data in -lcrypto" >&5 $as_echo_n "checking for CRYPTO_new_ex_data in -lcrypto... " >&6; } if ${ac_cv_lib_crypto_CRYPTO_new_ex_data+:} false; then : $as_echo_n "(cached) " >&6 else 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. */ #ifdef __cplusplus extern "C" #endif char CRYPTO_new_ex_data (); int main () { 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 ac_cv_lib_crypto_CRYPTO_new_ex_data=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_CRYPTO_new_ex_data" >&5 $as_echo "$ac_cv_lib_crypto_CRYPTO_new_ex_data" >&6; } if test "x$ac_cv_lib_crypto_CRYPTO_new_ex_data" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBCRYPTO 1 _ACEOF LIBS="-lcrypto $LIBS" else 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ssllibdir" >&5 $as_echo "$ssllibdir" >&6; } fi $as_echo "#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 "$use_sslstatic" = "1" -o "$use_ssl" = "1"; then if test "x$sslincldir" != "x"; then CFLAGS="$CFLAGS -I$sslincldir" fi if test "x$ssllibdir" != "x"; then LIBS="$LIBS -L$ssllibdir" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSLv2" >&5 $as_echo_n "checking for SSLv2... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { SSLv2_client_method() ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : sslv2=yes else sslv2=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sslv2" >&5 $as_echo "$sslv2" >&6; } if test "$sslv2" = "yes" ; then $as_echo "#define HAVE_SSLV2 1" >>confdefs.h fi ac_fn_c_check_decl "$LINENO" "SSL_OP_NO_TLSv1_1" "ac_cv_have_decl_SSL_OP_NO_TLSv1_1" "#include " if test "x$ac_cv_have_decl_SSL_OP_NO_TLSv1_1" = xyes; then : $as_echo "#define HAVE_TLSV1_1 1" >>confdefs.h fi ac_fn_c_check_decl "$LINENO" "SSL_OP_NO_TLSv1_2" "ac_cv_have_decl_SSL_OP_NO_TLSv1_2" "#include " if test "x$ac_cv_have_decl_SSL_OP_NO_TLSv1_2" = xyes; then : $as_echo "#define HAVE_TLSV1_2 1" >>confdefs.h fi ac_fn_c_check_decl "$LINENO" "SSL_OP_NO_TLSv1_3" "ac_cv_have_decl_SSL_OP_NO_TLSv1_3" "#include " if test "x$ac_cv_have_decl_SSL_OP_NO_TLSv1_3" = xyes; then : $as_echo "#define HAVE_TLSV1_3 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EC_KEY support" >&5 $as_echo_n "checking for EC_KEY support... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { EC_KEY_new_by_curve_name(0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ec=yes else ec=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ec" >&5 $as_echo "$ec" >&6; } if test "$ec" = "yes" ; then $as_echo "#define HAVE_EC_KEY 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ASN1_TIME_diff support" >&5 $as_echo_n "checking for ASN1_TIME_diff support... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { ASN1_TIME_diff(0, 0, 0, 0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : asn1timediff=yes else asn1timediff=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $asn1timediff" >&5 $as_echo "$asn1timediff" >&6; } if test "$asn1timediff" = "yes" ; then $as_echo "#define HAVE_ASN1_TIME_DIFF 1" >>confdefs.h fi fi # --------------------------------------------------------------------------- # Build options # --------------------------------------------------------------------------- # Check whether --enable-optimized was given. if test "${enable_optimized+set}" = set; 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" OPTIMIZED=1 else OPTIMIZED=0 fi else OPTIMIZED=0 fi # Check whether --enable-profiling was given. if test "${enable_profiling+set}" = set; 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" profile="true" else profile="false" fi else profile="false" fi if test x$profile = xtrue; then ENABLE_PROFILING_TRUE= ENABLE_PROFILING_FALSE='#' else ENABLE_PROFILING_TRUE='#' ENABLE_PROFILING_FALSE= 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_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `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+set}" = set || &/ 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 { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$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=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "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 "${ENABLE_PROFILING_TRUE}" && test -z "${ENABLE_PROFILING_FALSE}"; then as_fn_error $? "conditional \"ENABLE_PROFILING\" 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" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by monit $as_me 5.26.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac 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 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ monit config.status 5.26.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' 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 ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # 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"`' 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; 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; 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+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || 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=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac 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@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t 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"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$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 || $as_echo 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) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$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. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "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='' # 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 # ### 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" ;; 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=`$as_echo "$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=`$as_echo "$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)" $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 $as_echo "$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=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" # Check for guested configure; otherwise get Cygnus style configure. 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 elif test -f "$ac_srcdir/configure.in"; then # This should be Cygnus configure. ac_sub_configure=$ac_aux_dir/configure else { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi echo echo "Monit Build Information:" echo echo " Architecture: ${ARCH}" if test "$use_sslstatic" = "1" -o "$use_ssl" = "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 <