mtr-0.92/0000775000175000017500000000000013114223754011266 5ustar wolffwolffmtr-0.92/AUTHORS0000664000175000017500000000474113031772644012351 0ustar wolffwolff Matt Kimball is the primary author of mtr. Roger Wolff is currently maintaining mtr. Bug reports and feature requests should be sent as described in the README file. Thanks to everyone who has provided feedback on mtr. Thanks especially to those of you who have sent code: (Reverse alphabetical order, and sometimes I just add people at the end... ) Bohdan Vlasyuk Evgeniy Tretyak John Thacker Juha Takala David Sward David Stone Andrew Stesin Greg Stark Robert Sparks Mike Simons Aaron Scarisbrick Craig Milo Rogers Antonio Querubin Russell Nelson Davin Milun Josh Martin Alexander V. Lukyanov Charles Levert Bertrand Leconte Anand Kumria Olav Kvittem Adam Kramer Philip Kizer Simon Kirby Sami Kerola Christophe Kalt Steve Kann Brett Johnson Roland Illig Damian Gryski Rob Foehl Mircea Damian Cougar Travis Cross Brian Casey Andrew Brown Bill Bogstad Marc Bejarano Moritz Barsnick Thomas Klausner Roderick Groesbeek Kyle J. McKay Joseph Carter Thales "Min" Vaibhav Bajpai Jürgen Schönwälder and anyone who has slipped through the cracks of my mail file. Authors: If you want your Email mentioned here, send it to me. If you don't want your Email mentioned here, tell me. -- REW mtr-0.92/aclocal.m40000664000175000017500000014142513114217051013126 0ustar wolffwolff# generated automatically by aclocal 1.15 -*- Autoconf -*- # Copyright (C) 1996-2014 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'.])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # 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. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES # PKG_INSTALLDIR(DIRECTORY) # ------------------------- # Substitutes the variable pkgconfigdir as the location where a module # should install pkg-config .pc files. By default the directory is # $libdir/pkgconfig, but the default can be changed by passing # DIRECTORY. The user can override through the --with-pkgconfigdir # parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ]) dnl PKG_INSTALLDIR # PKG_NOARCH_INSTALLDIR(DIRECTORY) # ------------------------- # Substitutes the variable noarch_pkgconfigdir as the location where a # module should install arch-independent pkg-config .pc files. By # default the directory is $datadir/pkgconfig, but the default can be # changed by passing DIRECTORY. The user can override through the # --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ]) dnl PKG_NOARCH_INSTALLDIR # PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # ------------------------------------------- # Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])# PKG_CHECK_VAR # Copyright (C) 2002-2014 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], [], [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])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-2014 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-2014 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-2014 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-2014 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-2014 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-2014 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-2014 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-2014 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-2014 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-2014 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-2014 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-2014 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-2014 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-2014 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-2014 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-2014 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-2014 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 mtr-0.92/config.h.in0000664000175000017500000001213513114174131013305 0ustar wolffwolff/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to enable IPv6 */ #undef ENABLE_IPV6 /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_NAMESER_COMPAT_H /* Define if a curses library available */ #undef HAVE_CURSES /* Define to 1 if you have the header file. */ #undef HAVE_CURSESX_H /* Define to 1 if you have the header file. */ #undef HAVE_CURSES_H /* Define to 1 if you have the declaration of `errno', and to 0 if you don't. */ #undef HAVE_DECL_ERRNO /* Define to 1 if you have the header file. */ #undef HAVE_ERROR_H /* Define to 1 if you have the `fcntl' function. */ #undef HAVE_FCNTL /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define if libc has getopt_long */ #undef HAVE_GETOPT /* Define if gtk+-2.0 library available */ #undef HAVE_GTK /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define when ipinfo lookups are in use */ #undef HAVE_IPINFO /* Define to 1 if you have the `cap' library (-lcap). */ #undef HAVE_LIBCAP /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM /* Define to 1 if you have the `nsl' library (-lnsl). */ #undef HAVE_LIBNSL /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_ICMP_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_NCURSES_CURSES_H /* Define to 1 if you have the header file. */ #undef HAVE_NCURSES_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_SOCKET_H /* Define if your system has socklen_t */ #undef HAVE_SOCKLEN_T /* 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_EXT_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_SYS_CDEFS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_LIMITS_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_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_XTI_H /* Define to 1 if the system has the type `time_t'. */ #undef HAVE_TIME_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_VALUES_H /* Define to 1 if you have the `verr' function. */ #undef HAVE_VERR /* Define to 1 if you have the `verrx' function. */ #undef HAVE_VERRX /* Define to 1 if you have the `vwarn' function. */ #undef HAVE_VWARN /* Define to 1 if you have the `vwarnx' function. */ #undef HAVE_VWARNX /* Define to 1 if you have the `__fpending' function. */ #undef HAVE___FPENDING /* 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 /* The size of `unsigned char', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_CHAR /* The size of `unsigned int', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_INT /* The size of `unsigned long', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_LONG /* The size of `unsigned short', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_SHORT /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Version number of package */ #undef VERSION /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE mtr-0.92/test/0000775000175000017500000000000013114174404012242 5ustar wolffwolffmtr-0.92/test/mtrpacket.py0000664000175000017500000002464313031772644014627 0ustar wolffwolff# # mtr -- a network diagnostic tool # Copyright (C) 2016 Matt Kimball # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # '''Infrastructure for running tests which invoke mtr-packet.''' import fcntl import os import select import socket import subprocess import sys import time import unittest # # typing is used for mypy type checking, but isn't required to run, # so it's okay if we can't import it. # try: # pylint: disable=locally-disabled, unused-import from typing import Dict, List except ImportError: pass IPV6_TEST_HOST = 'google-public-dns-a.google.com' class MtrPacketExecuteError(Exception): "Exception raised when MtrPacketTest can't execute mtr-packet" pass class ReadReplyTimeout(Exception): 'Exception raised by TestProbe.read_reply upon timeout' pass class WriteCommandTimeout(Exception): 'Exception raised by TestProbe.write_command upon timeout' pass class MtrPacketReplyParseError(Exception): "Exception raised when MtrPacketReply can't parse the reply string" pass class PacketListenError(Exception): 'Exception raised when we have unexpected results from mtr-packet-listen' pass def set_nonblocking(file_descriptor): # type: (int) -> None 'Put a file descriptor into non-blocking mode' flags = fcntl.fcntl(file_descriptor, fcntl.F_GETFL) # pylint: disable=locally-disabled, no-member fcntl.fcntl(file_descriptor, fcntl.F_SETFL, flags | os.O_NONBLOCK) def check_for_local_ipv6(): '''Check for IPv6 support on the test host, to see if we should skip the IPv6 tests''' addrinfo = socket.getaddrinfo(IPV6_TEST_HOST, 1, socket.AF_INET6) if len(addrinfo): addr = addrinfo[0][4] # Create a UDP socket and check to see it can be connected to # IPV6_TEST_HOST. (Connecting UDP requires no packets sent, just # a route present.) sock = socket.socket( socket.AF_INET6, socket.SOCK_DGRAM, socket.IPPROTO_UDP) connect_success = False try: sock.connect(addr) connect_success = True except socket.error: pass sock.close() if not connect_success: sys.stderr.write( 'This host has no IPv6. Skipping IPv6 tests.\n') return connect_success HAVE_IPV6 = check_for_local_ipv6() # pylint: disable=locally-disabled, too-few-public-methods class MtrPacketReply(object): 'A parsed reply from mtr-packet' def __init__(self, reply): # type: (unicode) -> None self.token = 0 # type: int self.command_name = None # type: unicode self.argument = {} # type: Dict[unicode, unicode] self.parse_reply(reply) def parse_reply(self, reply): # type (unicode) -> None 'Parses a reply string into members for the instance of this class' tokens = reply.split() # type List[unicode] try: self.token = int(tokens[0]) self.command_name = tokens[1] except IndexError: raise MtrPacketReplyParseError(reply) i = 2 while i < len(tokens): try: name = tokens[i] value = tokens[i + 1] except IndexError: raise MtrPacketReplyParseError(reply) self.argument[name] = value i += 2 class PacketListen(object): 'A test process which listens for a single packet' def __init__(self, *args): self.process_args = list(args) # type: List[unicode] self.listen_process = None # type: subprocess.Popen self.attrib = None # type: Dict[unicode, unicode] def __enter__(self): try: self.listen_process = subprocess.Popen( ['./mtr-packet-listen'] + self.process_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE) except OSError: raise PacketListenError('unable to launch mtr-packet-listen') status = self.listen_process.stdout.readline().decode('utf-8') if status != 'status listening\n': raise PacketListenError('unexpected status') return self def __exit__(self, exc_type, exc_value, traceback): self.wait_for_exit() self.attrib = {} for line in self.listen_process.stdout.readlines(): tokens = line.decode('utf-8').split() if len(tokens) >= 2: name = tokens[0] value = tokens[1] self.attrib[name] = value self.listen_process.stdin.close() self.listen_process.stdout.close() def wait_for_exit(self): '''Poll the subprocess for up to ten seconds, until it exits. We need to wait for its exit to ensure we are able to read its output.''' wait_time = 10 wait_step = 0.1 steps = int(wait_time / wait_step) exit_value = None # pylint: disable=locally-disabled, unused-variable for i in range(steps): exit_value = self.listen_process.poll() if exit_value is not None: break time.sleep(wait_step) if exit_value is None: raise PacketListenError('mtr-packet-listen timeout') if exit_value != 0: raise PacketListenError('mtr-packet-listen unexpected error') class MtrPacketTest(unittest.TestCase): '''Base class for tests invoking mtr-packet. Start a new mtr-packet subprocess for each test, and kill it at the conclusion of the test. Provide methods for writing commands and reading replies. ''' def __init__(self, *args): self.reply_buffer = None # type: unicode self.packet_process = None # type: subprocess.Popen self.stdout_fd = None # type: int super(MtrPacketTest, self).__init__(*args) def setUp(self): 'Set up a test case by spawning a mtr-packet process' packet_path = os.environ.get('MTR_PACKET', './mtr-packet') self.reply_buffer = '' try: self.packet_process = subprocess.Popen( [packet_path], stdin=subprocess.PIPE, stdout=subprocess.PIPE) except OSError: raise MtrPacketExecuteError(packet_path) # Put the mtr-packet process's stdout in non-blocking mode # so that we can read from it without a timeout when # no reply is available. self.stdout_fd = self.packet_process.stdout.fileno() set_nonblocking(self.stdout_fd) self.stdin_fd = self.packet_process.stdin.fileno() set_nonblocking(self.stdin_fd) def tearDown(self): 'After a test, kill the running mtr-packet instance' self.packet_process.stdin.close() self.packet_process.stdout.close() try: self.packet_process.kill() except OSError: return def parse_reply(self, timeout=10.0): # type: (float) -> MtrPacketReply '''Read the next reply from mtr-packet and parse it into an MtrPacketReply object.''' reply_str = self.read_reply(timeout) return MtrPacketReply(reply_str) def read_reply(self, timeout=10.0): # type: (float) -> unicode '''Read the next reply from mtr-packet. Attempt to read the next command reply from mtr-packet. If no reply is available withing the timeout time, raise ReadReplyTimeout instead.''' start_time = time.time() # Read from mtr-packet until either the timeout time has elapsed # or we read a newline character, which indicates a finished # reply. while True: now = time.time() elapsed = now - start_time select_time = timeout - elapsed if select_time < 0: select_time = 0 select.select([self.stdout_fd], [], [], select_time) reply_bytes = None try: reply_bytes = os.read(self.stdout_fd, 1024) except OSError: pass if reply_bytes: self.reply_buffer += reply_bytes.decode('utf-8') # If we have read a newline character, we can stop waiting # for more input. newline_ix = self.reply_buffer.find('\n') if newline_ix != -1: break if elapsed >= timeout: raise ReadReplyTimeout() reply = self.reply_buffer[:newline_ix] self.reply_buffer = self.reply_buffer[newline_ix + 1:] return reply def write_command(self, cmd, timeout=10.0): # type: (unicode, float) -> None '''Send a command string to the mtr-packet instance, timing out if we are unable to write for an extended period of time. The timeout is to avoid deadlocks with the child process where both the parent and the child are writing to their end of the pipe and expecting the other end to be reading.''' command_str = cmd + '\n' command_bytes = command_str.encode('utf-8') start_time = time.time() while True: now = time.time() elapsed = now - start_time select_time = timeout - elapsed if select_time < 0: select_time = 0 select.select([], [self.stdin_fd], [], select_time) bytes_written = 0 try: bytes_written = os.write(self.stdin_fd, command_bytes) except OSError: pass command_bytes = command_bytes[bytes_written:] if not len(command_bytes): break if elapsed >= timeout: raise WriteCommandTimeout() def check_running_as_root(): 'Print a warning to stderr if we are not running as root.' # pylint: disable=locally-disabled, no-member if sys.platform != 'cygwin' and os.getuid() > 0: sys.stderr.write( 'Warning: many tests require running as root\n') mtr-0.92/test/packet_listen.c0000664000175000017500000001342213031772644015245 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include "packet/protocols.h" #define MAX_PACKET_SIZE 9000 /* The first probe sent by mtr-packet will have this sequence number, so wait for an ICMP packet with this sequence ID. */ #define SEQUENCE_NUM 33000 /* Check to see if the packet we've recieved is intended for this test process. We expected the ICMP sequence number to be equal to our process ID. */ bool is_packet_for_us4( char *packet, int packet_size) { int ip_icmp_size = sizeof(struct IPHeader) + sizeof(struct ICMPHeader); int expected_sequence; struct IPHeader *ip; struct ICMPHeader *icmp; if (packet_size < ip_icmp_size) { return false; } ip = (struct IPHeader *)packet; icmp = (struct ICMPHeader *)(ip + 1); expected_sequence = htons(SEQUENCE_NUM); if (icmp->sequence == expected_sequence) { return true; } return false; } /* Check to see if the ICMPv6 packet is for us. Unlike ICMPv4 packets, ICMPv6 packets don't include the IP header. */ bool is_packet_for_us6( char *packet, int packet_size) { int expected_sequence; struct ICMPHeader *icmp; if (packet_size < sizeof(struct ICMPHeader)) { return false; } icmp = (struct ICMPHeader *)packet; expected_sequence = htons(SEQUENCE_NUM); if (icmp->sequence == expected_sequence) { return true; } return false; } /* Check that all the bytes in the body of the packet have the same value. If so, return that value. If not, return -1. */ int get_packet_pattern( unsigned char *packet, int packet_size) { int fill_value; int i; if (packet_size <= 0) { return -1; } fill_value = packet[0]; for (i = 1; i < packet_size; i++) { if (packet[i] != fill_value) { return -1; } } return fill_value; } /* Print information about the ICMPv4 packet we received */ void dump_packet_info4( char *packet, int packet_size) { int ip_icmp_size = sizeof(struct IPHeader) + sizeof(struct ICMPHeader); int pattern; struct IPHeader *ip; struct ICMPHeader *icmp; unsigned char *body; int body_size; ip = (struct IPHeader *)packet; icmp = (struct ICMPHeader *)(ip + 1); body = (unsigned char *)(icmp + 1); body_size = packet_size - ip_icmp_size; printf("size %d\n", packet_size); printf("tos %d\n", ip->tos); pattern = get_packet_pattern(body, body_size); if (pattern < 0) { printf("bitpattern none\n"); } else { printf("bitpattern %d\n", pattern); } } /* Print information about an ICMPv6 packet */ void dump_packet_info6( char *packet, int packet_size) { int pattern; struct ICMPHeader *icmp; unsigned char *body; int body_size; int total_size; icmp = (struct ICMPHeader *)packet; body = (unsigned char *)(icmp + 1); body_size = packet_size - sizeof(struct ICMPHeader); total_size = packet_size + sizeof(struct IP6Header); printf("size %d\n", total_size); pattern = get_packet_pattern(body, body_size); if (pattern < 0) { printf("bitpattern none\n"); } else { printf("bitpattern %d\n", pattern); } } /* Receive ICMP packets until we get one intended for this test process */ void loop_on_receive( int icmp_socket, int ip_version) { int packet_size; char packet[MAX_PACKET_SIZE]; while (true) { packet_size = recv(icmp_socket, packet, MAX_PACKET_SIZE, 0); if (packet_size < -1) { perror("Failure during receive"); exit(EXIT_FAILURE); } if (ip_version == 6) { if (is_packet_for_us6(packet, packet_size)) { dump_packet_info6(packet, packet_size); return; } } else { if (is_packet_for_us4(packet, packet_size)) { dump_packet_info4(packet, packet_size); return; } } } } /* Parse the commandline arguments */ void parse_cmdline( int argc, char **argv, int *ip_version) { int opt; *ip_version = 4; while ((opt = getopt(argc, argv, "46")) != -1) { if (opt == '4') { *ip_version = 4; } if (opt == '6') { *ip_version = 6; } } } /* A helper for mtr-packet testing which waits for an ICMP packet intended for this test process, and then prints information about it. */ int main( int argc, char **argv) { int icmp_socket; int ip_version; parse_cmdline(argc, argv, &ip_version); if (ip_version == 6) { icmp_socket = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); } else { icmp_socket = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); } if (icmp_socket < 0) { perror("Failure opening listening socket"); exit(EXIT_FAILURE); } printf("status listening\n"); fflush(stdout); loop_on_receive(icmp_socket, ip_version); return EXIT_SUCCESS; } mtr-0.92/test/cmdparse.py0000775000175000017500000000677713031772644014446 0ustar wolffwolff#!/usr/bin/env python # # mtr -- a network diagnostic tool # Copyright (C) 2016 Matt Kimball # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # '''Test mtr-packet's command parsing.''' import time import unittest import mtrpacket class TestCommandParse(mtrpacket.MtrPacketTest): '''Test cases with malformed commands and version checks''' def test_unknown_command(self): 'Test sending a command unknown to mtr-packet' self.write_command('13 argle-bargle') self.assertEqual(self.read_reply(), '13 unknown-command') def test_malformed_command(self): 'Test sending a malformed command request to mtr-packet' self.write_command('malformed') self.assertEqual(self.read_reply(), '0 command-parse-error') def test_exit_on_stdin_closed(self): '''Test that the packet process terminates after stdin is closed Test that, when outstanding requests are complete, the process terminates following stdin being closed.''' self.write_command('15 send-probe ip-4 8.8.254.254 timeout 1') self.packet_process.stdin.close() time.sleep(2) self.read_reply() exit_code = self.packet_process.poll() self.assertIsNotNone(exit_code) def test_invalid_argument(self): 'Test sending invalid arguments with probe requests' bad_commands = [ '22 send-probe', '23 send-probe ip-4 str-value', '24 send-probe ip-4 8.8.8.8 timeout str-value', '25 send-probe ip-4 8.8.8.8 ttl str-value', ] for cmd in bad_commands: self.write_command(cmd) reply = self.parse_reply() self.assertEqual(reply.command_name, 'invalid-argument') def test_versioning(self): 'Test version checks and feature support checks' feature_tests = [ ('31 check-support feature ip-4', 'ok'), ('32 check-support feature send-probe', 'ok'), ('33 check-support feature bogus-feature', 'no') ] self.write_command('30 check-support feature version') reply = self.parse_reply() self.assertEqual(reply.token, 30) self.assertEqual(reply.command_name, 'feature-support') self.assertIn('support', reply.argument) for (request, expected) in feature_tests: self.write_command(request) reply = self.parse_reply() self.assertEqual(reply.command_name, 'feature-support') self.assertIn('support', reply.argument) self.assertEqual(reply.argument['support'], expected) def test_command_overflow(self): 'Test overflowing the incoming command buffer' big_buffer = 'x' * (64 * 1024) self.write_command(big_buffer) reply = self.read_reply() self.assertEqual(reply, '0 command-buffer-overflow') if __name__ == '__main__': mtrpacket.check_running_as_root() unittest.main() mtr-0.92/test/param.py0000775000175000017500000000501413031772644013727 0ustar wolffwolff#!/usr/bin/env python # # mtr -- a network diagnostic tool # Copyright (C) 2016 Matt Kimball # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # '''Test probe customization parameters''' import sys import unittest import mtrpacket @unittest.skipIf(sys.platform == 'cygwin', 'No Cygwin test') class TestParameters(mtrpacket.MtrPacketTest): 'Use parameter arguments to mtr-packet and examine the resulting packet' def test_size(self): 'Test probes sent with an explicit packet size' with mtrpacket.PacketListen('-4') as listen: cmd = '20 send-probe ip-4 127.0.0.1 size 512' self.write_command(cmd) self.assertEqual(listen.attrib['size'], '512') def test_pattern(self): 'Test probes are filled with the requested bit pattern' with mtrpacket.PacketListen('-4') as listen: cmd = '20 send-probe ip-4 127.0.0.1 bit-pattern 44' self.write_command(cmd) self.assertEqual(listen.attrib['bitpattern'], '44') def test_tos(self): 'Test setting the TOS field' with mtrpacket.PacketListen('-4') as listen: cmd = '20 send-probe ip-4 127.0.0.1 tos 62' self.write_command(cmd) self.assertEqual(listen.attrib['tos'], '62') @unittest.skipIf(sys.platform == 'cygwin', 'No Cygwin test') class TestIPv6Parameters(mtrpacket.MtrPacketTest): 'Test packet paramter customization for IPv6' @unittest.skipUnless(mtrpacket.HAVE_IPV6, 'No IPv6') def test_param(self): 'Test a variety of packet parameters' with mtrpacket.PacketListen('-6') as listen: param = 'size 256 bit-pattern 51 tos 77' cmd = '20 send-probe ip-6 ::1 ' + param self.write_command(cmd) self.assertEqual(listen.attrib['size'], '256') self.assertEqual(listen.attrib['bitpattern'], '51') if __name__ == '__main__': mtrpacket.check_running_as_root() unittest.main() mtr-0.92/test/probe.py0000775000175000017500000003250213031772644013740 0ustar wolffwolff#!/usr/bin/env python # # mtr -- a network diagnostic tool # Copyright (C) 2016 Matt Kimball # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # '''Test sending probes and receiving respones.''' import socket import sys import time import unittest import mtrpacket def resolve_ipv6_address(hostname): # type: (str) -> str 'Resolve a hostname to an IP version 6 address' for addrinfo in socket.getaddrinfo(hostname, 0): # pylint: disable=locally-disabled, unused-variable (family, socktype, proto, name, sockaddr) = addrinfo if family == socket.AF_INET6: sockaddr6 = sockaddr # type: tuple (address, port, flow, scope) = sockaddr6 return address raise LookupError(hostname) def check_feature(test, feature): 'Check for support for a particular feature with mtr-packet' check_cmd = '70 check-support feature ' + feature test.write_command(check_cmd) reply = test.parse_reply() test.assertEqual(reply.command_name, 'feature-support') test.assertIn('support', reply.argument) if reply.argument['support'] != 'ok': return False return True def test_basic_remote_probe(test, ip_version, protocol): 'Test a probe to a remote host with a TTL of 1' protocol_str = 'protocol ' + protocol if ip_version == 6: address_str = 'ip-6 ' + resolve_ipv6_address(mtrpacket.IPV6_TEST_HOST) elif ip_version == 4: address_str = 'ip-4 8.8.8.8' else: raise ValueError(ip_version) cmd = '60 send-probe ' + \ protocol_str + ' ' + address_str + ' port 164 ttl 1' test.write_command(cmd) reply = test.parse_reply() test.assertEqual(reply.command_name, 'ttl-expired') def test_basic_local_probe(test, ip_version, protocol): 'Test a probe to a closed port on localhost' protocol_str = 'protocol ' + protocol if ip_version == 6: address_str = 'ip-6 ::1' elif ip_version == 4: address_str = 'ip-4 127.0.0.1' cmd = '61 send-probe ' + \ protocol_str + ' ' + address_str + ' port 164' test.write_command(cmd) reply = test.parse_reply() test.assertEqual(reply.command_name, 'reply') if ip_version == 6: test.assertIn('ip-6', reply.argument) test.assertEqual(reply.argument['ip-6'], '::1') elif ip_version == 4: test.assertIn('ip-4', reply.argument) test.assertEqual(reply.argument['ip-4'], '127.0.0.1') def test_basic_probe(test, ip_version, protocol): # type: (mtrpacket.MtrPacketTest, int, unicode) -> None '''Test a probe with TTL expiration and a probe which reaches its destination with a particular protocol.''' if not check_feature(test, protocol): err_str = 'Skipping ' + protocol + ' test due to no support\n' sys.stderr.write(err_str.encode('utf-8')) return test_basic_remote_probe(test, ip_version, protocol) test_basic_local_probe(test, ip_version, protocol) class TestProbeICMPv4(mtrpacket.MtrPacketTest): '''Test sending probes using IP version 4''' def test_probe(self): 'Test sending regular ICMP probes to known addresses' # Probe Google's well-known DNS server and expect a reply self.write_command('14 send-probe ip-4 8.8.8.8') reply = self.parse_reply() self.assertEqual(reply.token, 14) self.assertEqual(reply.command_name, 'reply') self.assertIn('ip-4', reply.argument) self.assertEqual(reply.argument['ip-4'], '8.8.8.8') self.assertIn('round-trip-time', reply.argument) def test_timeout(self): 'Test timeouts when sending to a non-existant address' # # Probe a non-existant address, and expect no reply # # I'm not sure what the best way to find an address that doesn't # exist, but is still route-able. If we use a reserved IP # address range, Windows will tell us it is non-routeable, # rather than timing out when transmitting to that address. # # We're just using a currently unused address in Google's # range instead. This is probably not the best solution. # # pylint: disable=locally-disabled, unused-variable for i in range(16): self.write_command('15 send-probe ip-4 8.8.254.254 timeout 1') reply = self.parse_reply() self.assertEqual(reply.token, 15) self.assertEqual(reply.command_name, 'no-reply') def test_exhaust_probes(self): 'Test exhausting all available probes' probe_count = 4 * 1024 token = 1024 # pylint: disable=locally-disabled, unused-variable for i in range(probe_count): command = str(token) + ' send-probe ip-4 8.8.254.254 timeout 60' token += 1 self.write_command(command) reply = None try: reply = self.parse_reply(0) except mtrpacket.ReadReplyTimeout: pass if reply: if reply.command_name == 'probes-exhausted': break self.assertIsNotNone(reply) self.assertEqual(reply.command_name, 'probes-exhausted') def test_timeout_values(self): '''Test that timeout values wait the right amount of time Give each probe a half-second grace period to probe a timeout reply after the expected timeout time.''' begin = time.time() self.write_command('19 send-probe ip-4 8.8.254.254 timeout 0') self.parse_reply() elapsed = time.time() - begin self.assertLess(elapsed, 0.5) begin = time.time() self.write_command('20 send-probe ip-4 8.8.254.254 timeout 1') self.parse_reply() elapsed = time.time() - begin self.assertGreaterEqual(elapsed, 0.9) self.assertLess(elapsed, 1.5) begin = time.time() self.write_command('21 send-probe ip-4 8.8.254.254 timeout 3') self.parse_reply() elapsed = time.time() - begin self.assertGreaterEqual(elapsed, 2.9) self.assertLess(elapsed, 3.5) def test_ttl_expired(self): 'Test sending a probe which will have its time-to-live expire' # Probe Goolge's DNS server, but give the probe only one hop # to live. self.write_command('16 send-probe ip-4 8.8.8.8 ttl 1') reply = self.parse_reply() self.assertEqual(reply.command_name, 'ttl-expired') self.assertIn('ip-4', reply.argument) self.assertIn('round-trip-time', reply.argument) def test_parallel_probes(self): '''Test sending multiple probes in parallel We will expect the probes to complete out-of-order by sending a probe to a distant host immeidately followed by a probe to the local host.''' success_count = 0 loop_count = 32 # pylint: disable=locally-disabled, unused-variable for i in range(loop_count): # Probe the distant host before the local host. self.write_command('17 send-probe ip-4 8.8.8.8 timeout 1') self.write_command('18 send-probe ip-4 127.0.0.1 timeout 1') reply = self.parse_reply() if reply.command_name == 'no-reply': continue self.assertEqual(reply.command_name, 'reply') self.assertIn('ip-4', reply.argument) self.assertEqual(reply.argument['ip-4'], '127.0.0.1') self.assertIn('round-trip-time', reply.argument) first_time = int(reply.argument['round-trip-time']) reply = self.parse_reply() if reply.command_name == 'no-reply': continue self.assertEqual(reply.command_name, 'reply') self.assertIn('ip-4', reply.argument) self.assertEqual(reply.argument['ip-4'], '8.8.8.8') self.assertIn('round-trip-time', reply.argument) second_time = int(reply.argument['round-trip-time']) # Ensure we got a reply from the host with the lowest latency # first. self.assertLess(first_time, second_time) success_count += 1 # We need 90% success to pass. This allows a few probes to be # occasionally dropped by the network without failing the test. required_success = int(loop_count * 0.90) self.assertGreaterEqual(success_count, required_success) class TestProbeICMPv6(mtrpacket.MtrPacketTest): '''Test sending probes using IP version 6''' def __init__(self, *args): google_addr = resolve_ipv6_address(mtrpacket.IPV6_TEST_HOST) self.google_addr = google_addr # type: str super(TestProbeICMPv6, self).__init__(*args) @unittest.skipUnless(mtrpacket.HAVE_IPV6, 'No IPv6') def test_probe(self): "Test a probe to Google's public DNS server" # Probe Google's well-known DNS server and expect a reply self.write_command('51 send-probe ip-6 ' + self.google_addr) reply = self.parse_reply() self.assertEqual(reply.command_name, 'reply') self.assertIn('ip-6', reply.argument) self.assertIn('round-trip-time', reply.argument) # Probe the loopback, and check the address we get a reply from is # also the loopback. While implementing IPv6, I had a bug where # the low bits of the received address got zeroed. This checks for # that bug. self.write_command('52 send-probe ip-6 ::1') reply = self.parse_reply() self.assertEqual(reply.command_name, 'reply') self.assertIn('ip-6', reply.argument) self.assertIn('round-trip-time', reply.argument) self.assertEqual(reply.argument['ip-6'], '::1') @unittest.skipUnless(mtrpacket.HAVE_IPV6, 'No IPv6') def test_ttl_expired(self): 'Test sending a probe which will have its time-to-live expire' # Probe Goolge's DNS server, but give the probe only one hop # to live. cmd = '53 send-probe ip-6 ' + self.google_addr + ' ttl 1' self.write_command(cmd) reply = self.parse_reply() self.assertEqual('ttl-expired', reply.command_name) self.assertIn('ip-6', reply.argument) self.assertIn('round-trip-time', reply.argument) class TestProbeUDP(mtrpacket.MtrPacketTest): 'Test transmitting probes using UDP' def udp_port_test(self, address): # type: (unicode) -> None 'Test UDP probes with variations on source port and dest port' if not check_feature(self, 'udp'): return cmd = '80 send-probe protocol udp ' + address self.write_command(cmd) reply = self.parse_reply() self.assertEqual('reply', reply.command_name) cmd = '81 send-probe protocol udp port 990 ' + address self.write_command(cmd) reply = self.parse_reply() self.assertEqual('reply', reply.command_name) cmd = '82 send-probe protocol udp local-port 1991 ' + address self.write_command(cmd) reply = self.parse_reply() self.assertEqual('reply', reply.command_name) def test_udp_v4(self): 'Test IPv4 UDP probes' test_basic_probe(self, 4, 'udp') self.udp_port_test('ip-4 127.0.0.1') @unittest.skipUnless(mtrpacket.HAVE_IPV6, 'No IPv6') def test_udp_v6(self): 'Test IPv6 UDP probes' test_basic_probe(self, 6, 'udp') self.udp_port_test('ip-6 ::1') class TestProbeTCP(mtrpacket.MtrPacketTest): 'Test TCP probe support' def test_tcp_v4(self): '''Test IPv4 TCP probes, with TTL expiration, to a refused port and to an open port''' test_basic_probe(self, 4, 'tcp') if not check_feature(self, 'tcp'): return # Probe a local port assumed to be open (ssh) cmd = '80 send-probe ip-4 127.0.0.1 protocol tcp port 22' self.write_command(cmd) reply = self.parse_reply() self.assertEqual(reply.command_name, 'reply') @unittest.skipUnless(mtrpacket.HAVE_IPV6, 'No IPv6') def test_tcp_v6(self): 'Test IPv6 TCP probes' test_basic_probe(self, 6, 'tcp') if not check_feature(self, 'tcp'): return # Probe a local port assumed to be open (ssh) cmd = '80 send-probe ip-6 ::1 protocol tcp port 22' self.write_command(cmd) reply = self.parse_reply() self.assertEqual(reply.command_name, 'reply') class TestProbeSCTP(mtrpacket.MtrPacketTest): 'Test SCTP probes' def test_sctp_v4(self): 'Test basic SCTP probes over IPv4' test_basic_probe(self, 4, 'sctp') @unittest.skipUnless(mtrpacket.HAVE_IPV6, 'No IPv6') def test_sctp_v6(self): 'Test basic SCTP probes over IPv6' test_basic_probe(self, 6, 'sctp') if __name__ == '__main__': mtrpacket.check_running_as_root() unittest.main() mtr-0.92/test/lint.sh0000775000175000017500000000025313031772644013557 0ustar wolffwolff#!/bin/sh # Check the Python test source for good style PYTHON_SOURCE=*.py pep8 $PYTHON_SOURCE pylint --reports=n $PYTHON_SOURCE 2>/dev/null mypy --py2 $PYTHON_SOURCE mtr-0.92/.gitignore0000664000175000017500000000102113034463046013251 0ustar wolffwolff# .gitignore *.o *.pyc Makefile Makefile.in aclocal.m4 confdefs.h config.* configure confinc confmf conftest.* stamp-h1* /build-aux/compile /build-aux/depcomp /build-aux/install-sh /build-aux/missing /build-aux/test-driver /autom4te.cache/ /.deps/ /packet/.deps/ /packet/.dirstamp /packet/testpacket.py.log /packet/testpacket.py.trs /test-suite.log /ChangeLog /INSTALL /mtr /mtr-packet /mtr-packet-listen /mtr.8 /mtr-packet.8 /test/.deps/ /test/.dirstamp /ui/.deps/ /ui/.dirstamp /test/*.py.log /test/*.py.trs /mtr-*.tar.gz mtr-0.92/compile0000755000175000017500000001624512441555431012654 0ustar wolffwolff#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2013 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: mtr-0.92/portability/0000775000175000017500000000000013114174404013625 5ustar wolffwolffmtr-0.92/portability/.gitignore0000664000175000017500000000002212776730076015627 0ustar wolffwolff/.deps /.dirstamp mtr-0.92/portability/getopt1.c0000664000175000017500000001017212776730076015375 0ustar wolffwolff/* getopt_long and getopt_long_only entry points for GNU getopt. Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994 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 version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "getopt.h" #if !defined (__STDC__) || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const #define const #endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #if defined (_LIBC) || !defined (__GNU_LIBRARY__) /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #include #else char *getenv (); #endif #ifndef NULL #define NULL 0 #endif int getopt_long (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 1); } #endif /* _LIBC or not __GNU_LIBRARY__. */ #ifdef TEST #include int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; int option_index = 0; static struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 0, 0, 0}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); if (c == EOF) break; switch (c) { case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case 'd': printf ("option d with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit(EXIT_SUCCESS); } #endif /* TEST */ mtr-0.92/portability/error.c0000664000175000017500000000225312776730076015144 0ustar wolffwolff /* Linux error(3) function go around for systems that has err(3) and warn(3), but no error(3). MacOS is good example of such. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation version 2. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include #include void error(int status, int errnum, const char *format, ...) { va_list arg; va_start(arg, format); if (errnum == 0) { if (status == 0) vwarnx(format, arg); else verrx(status, format, arg); } else { if (status == 0) vwarn(format, arg); else verr(status, format, arg); } va_end(arg); } mtr-0.92/portability/error.h0000664000175000017500000000156212776730076015153 0ustar wolffwolff /* Linux error(3) function go around for systems that has err(3) and warn(3), but no error(3). MacOS is good example of such. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation version 2. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ void error(int status, int errnum, const char *format, ...); mtr-0.92/portability/getopt.h0000664000175000017500000001364612776730076015332 0ustar wolffwolff/* Declarations for getopt. Copyright (C) 1989-1994,1996-1999,2001,2003,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation version 2. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _GETOPT_H #ifndef __need_getopt #define _GETOPT_H 1 #endif /* If __GNU_LIBRARY__ is not already defined, either we are being used standalone, or this is the first header included in the source file. If we are being used with glibc, we need to include , but that does not exist if we are standalone. So: if __GNU_LIBRARY__ is not defined, include , which will pull in for us if it's from glibc. (Why ctype.h? It's guaranteed to exist and it doesn't flood the namespace with stuff the way some other headers do.) */ #if !defined __GNU_LIBRARY__ # include #endif #ifndef __THROW # ifndef __GNUC_PREREQ # define __GNUC_PREREQ(maj, min) (0) # endif # if defined __cplusplus && __GNUC_PREREQ (2,8) # define __THROW throw () # else # define __THROW # endif #endif #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; #ifndef __need_getopt /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { const char *name; /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ #define no_argument 0 #define required_argument 1 #define optional_argument 2 #endif /* need getopt */ /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options missing arguments, `optopt' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter takes an argument, to be placed in `optarg'. If a letter in OPTS is followed by two colons, its argument is optional. This behavior is specific to the GNU `getopt'. The argument `--' causes premature termination of argument scanning, explicitly telling `getopt' that there are no more options. If OPTS begins with `--', then non-option arguments are treated as arguments to the option '\0'. This behavior is specific to the GNU `getopt'. */ #ifdef __GNU_LIBRARY__ /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW; #else /* not __GNU_LIBRARY__ */ extern int getopt (); #endif /* __GNU_LIBRARY__ */ #ifndef __need_getopt extern int getopt_long (int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW; extern int getopt_long_only (int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind) __THROW; #endif #ifdef __cplusplus } #endif /* Make sure we later can get all the definitions and declarations. */ #undef __need_getopt #endif /* getopt.h */ mtr-0.92/portability/getopt.c0000664000175000017500000005326312776730076015324 0ustar wolffwolff/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu before changing it! Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95 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 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, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* This tells Alpha OSF/1 not to define a getopt prototype in . Ditto for AIX 3.2 and . */ #ifndef _NO_PROTO #define _NO_PROTO #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif #if !defined (__STDC__) || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const #define const #endif #endif #include #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #if defined (_LIBC) || !defined (__GNU_LIBRARY__) /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ #include #endif /* GNU C library. */ #ifndef _ /* This is for other GNU distributions with internationalized messages. When compiling libc, the _ macro is predefined. */ #ifdef HAVE_LIBINTL_H # include # define _(msgid) gettext (msgid) #else # define _(msgid) (msgid) #endif #endif /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg = NULL; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* XXX 1003.2 says this must be 1 before any call. */ int optind = 0; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return EOF with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; /* Value of POSIXLY_CORRECT environment variable. */ static char *posixly_correct; #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ #include #define my_index strchr #else /* Avoid depending on library functions or files whose names are inconsistent. */ char *getenv (); static char * my_index (str, chr) const char *str; int chr; { while (*str) { if (*str == chr) return (char *) str; str++; } return 0; } /* If using GCC, we can safely declare strlen this way. If not using GCC, it is ok not to declare it. */ #ifdef __GNUC__ /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. That was relevant to code that was here before. */ #if !defined (__STDC__) || !__STDC__ /* gcc with -traditional declares the built-in strlen to return int, and has done so at least since version 2.4.5. -- rms. */ extern int strlen (const char *); #endif /* not __STDC__ */ #endif /* __GNUC__ */ #endif /* not __GNU_LIBRARY__ */ /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ static void exchange (argv) char **argv; { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ static const char * _getopt_initialize (optstring) const char *optstring; { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind = 1; nextchar = NULL; posixly_correct = getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (posixly_correct != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns `EOF'. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int argc; char *const *argv; const char *optstring; const struct option *longopts; int *longind; int long_only; { optarg = NULL; if (optind == 0) { optstring = _getopt_initialize (optstring); optind = 1; /* Don't scan ARGV[0], the program name. */ } if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && (argv[optind][0] != '-' || argv[optind][1] == '\0')) optind++; last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp (argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return EOF; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if ((argv[optind][0] != '-' || argv[optind][1] == '\0')) { if (ordering == REQUIRE_ORDER) return EOF; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if (nameend - nextchar == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (opterr) { if (argv[optind - 1][1] == '-') /* --option */ fprintf (stderr, _("%s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); else /* +option or -option */ fprintf (stderr, _("%s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); } nextchar += strlen (nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index (optstring, *nextchar) == NULL) { if (opterr) { if (argv[optind][1] == '-') /* --option */ fprintf (stderr, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); else /* +option or -option */ fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; optind++; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = my_index (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (opterr) { if (posixly_correct) /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); else fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); } optopt = c; return '?'; } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif /* _LIBC or not __GNU_LIBRARY__. */ #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == EOF) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit(EXIT_SUCCESS); } #endif /* TEST */ mtr-0.92/portability/queue.h0000664000175000017500000006143013031772644015136 0ustar wolffwolff/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)queue.h 8.5 (Berkeley) 8/20/94 * $FreeBSD: releng/11.0/sys/sys/queue.h 284915 2015-06-28 21:06:45Z hselasky $ */ #ifndef _SYS_QUEUE_H_ #define _SYS_QUEUE_H_ #include "config.h" #ifdef HAVE_SYS_CDEFS_H #include #endif /* * This file defines four types of data structures: singly-linked lists, * singly-linked tail queues, lists and tail queues. * * A singly-linked list is headed by a single forward pointer. The elements * are singly linked for minimum space and pointer manipulation overhead at * the expense of O(n) removal for arbitrary elements. New elements can be * added to the list after an existing element or at the head of the list. * Elements being removed from the head of the list should use the explicit * macro for this purpose for optimum efficiency. A singly-linked list may * only be traversed in the forward direction. Singly-linked lists are ideal * for applications with large datasets and few or no removals or for * implementing a LIFO queue. * * A singly-linked tail queue is headed by a pair of pointers, one to the * head of the list and the other to the tail of the list. The elements are * singly linked for minimum space and pointer manipulation overhead at the * expense of O(n) removal for arbitrary elements. New elements can be added * to the list after an existing element, at the head of the list, or at the * end of the list. Elements being removed from the head of the tail queue * should use the explicit macro for this purpose for optimum efficiency. * A singly-linked tail queue may only be traversed in the forward direction. * Singly-linked tail queues are ideal for applications with large datasets * and few or no removals or for implementing a FIFO queue. * * A list is headed by a single forward pointer (or an array of forward * pointers for a hash table header). The elements are doubly linked * so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before * or after an existing element or at the head of the list. A list * may be traversed in either direction. * * A tail queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before or * after an existing element, at the head of the list, or at the end of * the list. A tail queue may be traversed in either direction. * * For details on the use of these macros, see the queue(3) manual page. * * * SLIST LIST STAILQ TAILQ * _HEAD + + + + * _CLASS_HEAD + + + + * _HEAD_INITIALIZER + + + + * _ENTRY + + + + * _CLASS_ENTRY + + + + * _INIT + + + + * _EMPTY + + + + * _FIRST + + + + * _NEXT + + + + * _PREV - + - + * _LAST - - + + * _FOREACH + + + + * _FOREACH_FROM + + + + * _FOREACH_SAFE + + + + * _FOREACH_FROM_SAFE + + + + * _FOREACH_REVERSE - - - + * _FOREACH_REVERSE_FROM - - - + * _FOREACH_REVERSE_SAFE - - - + * _FOREACH_REVERSE_FROM_SAFE - - - + * _INSERT_HEAD + + + + * _INSERT_BEFORE - + - + * _INSERT_AFTER + + + + * _INSERT_TAIL - - + + * _CONCAT - - + + * _REMOVE_AFTER + - + - * _REMOVE_HEAD + - + - * _REMOVE + + + + * _SWAP + + + + * */ #ifdef QUEUE_MACRO_DEBUG /* Store the last 2 places the queue element or head was altered */ struct qm_trace { unsigned long lastline; unsigned long prevline; const char *lastfile; const char *prevfile; }; #define TRACEBUF struct qm_trace trace; #define TRACEBUF_INITIALIZER { __LINE__, 0, __FILE__, NULL } , #define TRASHIT(x) do {(x) = (void *)-1;} while (0) #define QMD_SAVELINK(name, link) void **name = (void *)&(link) #define QMD_TRACE_HEAD(head) do { \ (head)->trace.prevline = (head)->trace.lastline; \ (head)->trace.prevfile = (head)->trace.lastfile; \ (head)->trace.lastline = __LINE__; \ (head)->trace.lastfile = __FILE__; \ } while (0) #define QMD_TRACE_ELEM(elem) do { \ (elem)->trace.prevline = (elem)->trace.lastline; \ (elem)->trace.prevfile = (elem)->trace.lastfile; \ (elem)->trace.lastline = __LINE__; \ (elem)->trace.lastfile = __FILE__; \ } while (0) #else #define QMD_TRACE_ELEM(elem) #define QMD_TRACE_HEAD(head) #define QMD_SAVELINK(name, link) #define TRACEBUF #define TRACEBUF_INITIALIZER #define TRASHIT(x) #endif /* QUEUE_MACRO_DEBUG */ #ifdef __cplusplus /* * In C++ there can be structure lists and class lists: */ #define QUEUE_TYPEOF(type) type #else #define QUEUE_TYPEOF(type) struct type #endif /* * Singly-linked List declarations. */ #define SLIST_HEAD(name, type) \ struct name { \ struct type *slh_first; /* first element */ \ } #define SLIST_CLASS_HEAD(name, type) \ struct name { \ class type *slh_first; /* first element */ \ } #define SLIST_HEAD_INITIALIZER(head) \ { NULL } #define SLIST_ENTRY(type) \ struct { \ struct type *sle_next; /* next element */ \ } #define SLIST_CLASS_ENTRY(type) \ struct { \ class type *sle_next; /* next element */ \ } /* * Singly-linked List functions. */ #define SLIST_EMPTY(head) ((head)->slh_first == NULL) #define SLIST_FIRST(head) ((head)->slh_first) #define SLIST_FOREACH(var, head, field) \ for ((var) = SLIST_FIRST((head)); \ (var); \ (var) = SLIST_NEXT((var), field)) #define SLIST_FOREACH_FROM(var, head, field) \ for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \ (var); \ (var) = SLIST_NEXT((var), field)) #define SLIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = SLIST_FIRST((head)); \ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \ (var) = (tvar)) #define SLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \ for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \ (var) && ((tvar) = SLIST_NEXT((var), field), 1); \ (var) = (tvar)) #define SLIST_FOREACH_PREVPTR(var, varp, head, field) \ for ((varp) = &SLIST_FIRST((head)); \ ((var) = *(varp)) != NULL; \ (varp) = &SLIST_NEXT((var), field)) #define SLIST_INIT(head) do { \ SLIST_FIRST((head)) = NULL; \ } while (0) #define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \ SLIST_NEXT((slistelm), field) = (elm); \ } while (0) #define SLIST_INSERT_HEAD(head, elm, field) do { \ SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \ SLIST_FIRST((head)) = (elm); \ } while (0) #define SLIST_NEXT(elm, field) ((elm)->field.sle_next) #define SLIST_REMOVE(head, elm, type, field) do { \ QMD_SAVELINK(oldnext, (elm)->field.sle_next); \ if (SLIST_FIRST((head)) == (elm)) { \ SLIST_REMOVE_HEAD((head), field); \ } \ else { \ QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head); \ while (SLIST_NEXT(curelm, field) != (elm)) \ curelm = SLIST_NEXT(curelm, field); \ SLIST_REMOVE_AFTER(curelm, field); \ } \ TRASHIT(*oldnext); \ } while (0) #define SLIST_REMOVE_AFTER(elm, field) do { \ SLIST_NEXT(elm, field) = \ SLIST_NEXT(SLIST_NEXT(elm, field), field); \ } while (0) #define SLIST_REMOVE_HEAD(head, field) do { \ SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \ } while (0) #define SLIST_SWAP(head1, head2, type) do { \ QUEUE_TYPEOF(type) *swap_first = SLIST_FIRST(head1); \ SLIST_FIRST(head1) = SLIST_FIRST(head2); \ SLIST_FIRST(head2) = swap_first; \ } while (0) /* * Singly-linked Tail queue declarations. */ #define STAILQ_HEAD(name, type) \ struct name { \ struct type *stqh_first;/* first element */ \ struct type **stqh_last;/* addr of last next element */ \ } #define STAILQ_CLASS_HEAD(name, type) \ struct name { \ class type *stqh_first; /* first element */ \ class type **stqh_last; /* addr of last next element */ \ } #define STAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).stqh_first } #define STAILQ_ENTRY(type) \ struct { \ struct type *stqe_next; /* next element */ \ } #define STAILQ_CLASS_ENTRY(type) \ struct { \ class type *stqe_next; /* next element */ \ } /* * Singly-linked Tail queue functions. */ #define STAILQ_CONCAT(head1, head2) do { \ if (!STAILQ_EMPTY((head2))) { \ *(head1)->stqh_last = (head2)->stqh_first; \ (head1)->stqh_last = (head2)->stqh_last; \ STAILQ_INIT((head2)); \ } \ } while (0) #define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) #define STAILQ_FIRST(head) ((head)->stqh_first) #define STAILQ_FOREACH(var, head, field) \ for((var) = STAILQ_FIRST((head)); \ (var); \ (var) = STAILQ_NEXT((var), field)) #define STAILQ_FOREACH_FROM(var, head, field) \ for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \ (var); \ (var) = STAILQ_NEXT((var), field)) #define STAILQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = STAILQ_FIRST((head)); \ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define STAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \ for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define STAILQ_INIT(head) do { \ STAILQ_FIRST((head)) = NULL; \ (head)->stqh_last = &STAILQ_FIRST((head)); \ } while (0) #define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ STAILQ_NEXT((tqelm), field) = (elm); \ } while (0) #define STAILQ_INSERT_HEAD(head, elm, field) do { \ if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ STAILQ_FIRST((head)) = (elm); \ } while (0) #define STAILQ_INSERT_TAIL(head, elm, field) do { \ STAILQ_NEXT((elm), field) = NULL; \ *(head)->stqh_last = (elm); \ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ } while (0) #define STAILQ_LAST(head, type, field) \ (STAILQ_EMPTY((head)) ? NULL : \ __containerof((head)->stqh_last, \ QUEUE_TYPEOF(type), field.stqe_next)) #define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) #define STAILQ_REMOVE(head, elm, type, field) do { \ QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \ if (STAILQ_FIRST((head)) == (elm)) { \ STAILQ_REMOVE_HEAD((head), field); \ } \ else { \ QUEUE_TYPEOF(type) *curelm = STAILQ_FIRST(head); \ while (STAILQ_NEXT(curelm, field) != (elm)) \ curelm = STAILQ_NEXT(curelm, field); \ STAILQ_REMOVE_AFTER(head, curelm, field); \ } \ TRASHIT(*oldnext); \ } while (0) #define STAILQ_REMOVE_AFTER(head, elm, field) do { \ if ((STAILQ_NEXT(elm, field) = \ STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ } while (0) #define STAILQ_REMOVE_HEAD(head, field) do { \ if ((STAILQ_FIRST((head)) = \ STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \ (head)->stqh_last = &STAILQ_FIRST((head)); \ } while (0) #define STAILQ_SWAP(head1, head2, type) do { \ QUEUE_TYPEOF(type) *swap_first = STAILQ_FIRST(head1); \ QUEUE_TYPEOF(type) **swap_last = (head1)->stqh_last; \ STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \ (head1)->stqh_last = (head2)->stqh_last; \ STAILQ_FIRST(head2) = swap_first; \ (head2)->stqh_last = swap_last; \ if (STAILQ_EMPTY(head1)) \ (head1)->stqh_last = &STAILQ_FIRST(head1); \ if (STAILQ_EMPTY(head2)) \ (head2)->stqh_last = &STAILQ_FIRST(head2); \ } while (0) /* * List declarations. */ #define LIST_HEAD(name, type) \ struct name { \ struct type *lh_first; /* first element */ \ } #define LIST_CLASS_HEAD(name, type) \ struct name { \ class type *lh_first; /* first element */ \ } #define LIST_HEAD_INITIALIZER(head) \ { NULL } #define LIST_ENTRY(type) \ struct { \ struct type *le_next; /* next element */ \ struct type **le_prev; /* address of previous next element */ \ } #define LIST_CLASS_ENTRY(type) \ struct { \ class type *le_next; /* next element */ \ class type **le_prev; /* address of previous next element */ \ } /* * List functions. */ #if (defined(_KERNEL) && defined(INVARIANTS)) #define QMD_LIST_CHECK_HEAD(head, field) do { \ if (LIST_FIRST((head)) != NULL && \ LIST_FIRST((head))->field.le_prev != \ &LIST_FIRST((head))) \ panic("Bad list head %p first->prev != head", (head)); \ } while (0) #define QMD_LIST_CHECK_NEXT(elm, field) do { \ if (LIST_NEXT((elm), field) != NULL && \ LIST_NEXT((elm), field)->field.le_prev != \ &((elm)->field.le_next)) \ panic("Bad link elm %p next->prev != elm", (elm)); \ } while (0) #define QMD_LIST_CHECK_PREV(elm, field) do { \ if (*(elm)->field.le_prev != (elm)) \ panic("Bad link elm %p prev->next != elm", (elm)); \ } while (0) #else #define QMD_LIST_CHECK_HEAD(head, field) #define QMD_LIST_CHECK_NEXT(elm, field) #define QMD_LIST_CHECK_PREV(elm, field) #endif /* (_KERNEL && INVARIANTS) */ #define LIST_EMPTY(head) ((head)->lh_first == NULL) #define LIST_FIRST(head) ((head)->lh_first) #define LIST_FOREACH(var, head, field) \ for ((var) = LIST_FIRST((head)); \ (var); \ (var) = LIST_NEXT((var), field)) #define LIST_FOREACH_FROM(var, head, field) \ for ((var) = ((var) ? (var) : LIST_FIRST((head))); \ (var); \ (var) = LIST_NEXT((var), field)) #define LIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = LIST_FIRST((head)); \ (var) && ((tvar) = LIST_NEXT((var), field), 1); \ (var) = (tvar)) #define LIST_FOREACH_FROM_SAFE(var, head, field, tvar) \ for ((var) = ((var) ? (var) : LIST_FIRST((head))); \ (var) && ((tvar) = LIST_NEXT((var), field), 1); \ (var) = (tvar)) #define LIST_INIT(head) do { \ LIST_FIRST((head)) = NULL; \ } while (0) #define LIST_INSERT_AFTER(listelm, elm, field) do { \ QMD_LIST_CHECK_NEXT(listelm, field); \ if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\ LIST_NEXT((listelm), field)->field.le_prev = \ &LIST_NEXT((elm), field); \ LIST_NEXT((listelm), field) = (elm); \ (elm)->field.le_prev = &LIST_NEXT((listelm), field); \ } while (0) #define LIST_INSERT_BEFORE(listelm, elm, field) do { \ QMD_LIST_CHECK_PREV(listelm, field); \ (elm)->field.le_prev = (listelm)->field.le_prev; \ LIST_NEXT((elm), field) = (listelm); \ *(listelm)->field.le_prev = (elm); \ (listelm)->field.le_prev = &LIST_NEXT((elm), field); \ } while (0) #define LIST_INSERT_HEAD(head, elm, field) do { \ QMD_LIST_CHECK_HEAD((head), field); \ if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \ LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\ LIST_FIRST((head)) = (elm); \ (elm)->field.le_prev = &LIST_FIRST((head)); \ } while (0) #define LIST_NEXT(elm, field) ((elm)->field.le_next) #define LIST_PREV(elm, head, type, field) \ ((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \ __containerof((elm)->field.le_prev, \ QUEUE_TYPEOF(type), field.le_next)) #define LIST_REMOVE(elm, field) do { \ QMD_SAVELINK(oldnext, (elm)->field.le_next); \ QMD_SAVELINK(oldprev, (elm)->field.le_prev); \ QMD_LIST_CHECK_NEXT(elm, field); \ QMD_LIST_CHECK_PREV(elm, field); \ if (LIST_NEXT((elm), field) != NULL) \ LIST_NEXT((elm), field)->field.le_prev = \ (elm)->field.le_prev; \ *(elm)->field.le_prev = LIST_NEXT((elm), field); \ TRASHIT(*oldnext); \ TRASHIT(*oldprev); \ } while (0) #define LIST_SWAP(head1, head2, type, field) do { \ QUEUE_TYPEOF(type) *swap_tmp = LIST_FIRST(head1); \ LIST_FIRST((head1)) = LIST_FIRST((head2)); \ LIST_FIRST((head2)) = swap_tmp; \ if ((swap_tmp = LIST_FIRST((head1))) != NULL) \ swap_tmp->field.le_prev = &LIST_FIRST((head1)); \ if ((swap_tmp = LIST_FIRST((head2))) != NULL) \ swap_tmp->field.le_prev = &LIST_FIRST((head2)); \ } while (0) /* * Tail queue declarations. */ #define TAILQ_HEAD(name, type) \ struct name { \ struct type *tqh_first; /* first element */ \ struct type **tqh_last; /* addr of last next element */ \ TRACEBUF \ } #define TAILQ_CLASS_HEAD(name, type) \ struct name { \ class type *tqh_first; /* first element */ \ class type **tqh_last; /* addr of last next element */ \ TRACEBUF \ } #define TAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).tqh_first, TRACEBUF_INITIALIZER } #define TAILQ_ENTRY(type) \ struct { \ struct type *tqe_next; /* next element */ \ struct type **tqe_prev; /* address of previous next element */ \ TRACEBUF \ } #define TAILQ_CLASS_ENTRY(type) \ struct { \ class type *tqe_next; /* next element */ \ class type **tqe_prev; /* address of previous next element */ \ TRACEBUF \ } /* * Tail queue functions. */ #if (defined(_KERNEL) && defined(INVARIANTS)) #define QMD_TAILQ_CHECK_HEAD(head, field) do { \ if (!TAILQ_EMPTY(head) && \ TAILQ_FIRST((head))->field.tqe_prev != \ &TAILQ_FIRST((head))) \ panic("Bad tailq head %p first->prev != head", (head)); \ } while (0) #define QMD_TAILQ_CHECK_TAIL(head, field) do { \ if (*(head)->tqh_last != NULL) \ panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); \ } while (0) #define QMD_TAILQ_CHECK_NEXT(elm, field) do { \ if (TAILQ_NEXT((elm), field) != NULL && \ TAILQ_NEXT((elm), field)->field.tqe_prev != \ &((elm)->field.tqe_next)) \ panic("Bad link elm %p next->prev != elm", (elm)); \ } while (0) #define QMD_TAILQ_CHECK_PREV(elm, field) do { \ if (*(elm)->field.tqe_prev != (elm)) \ panic("Bad link elm %p prev->next != elm", (elm)); \ } while (0) #else #define QMD_TAILQ_CHECK_HEAD(head, field) #define QMD_TAILQ_CHECK_TAIL(head, headname) #define QMD_TAILQ_CHECK_NEXT(elm, field) #define QMD_TAILQ_CHECK_PREV(elm, field) #endif /* (_KERNEL && INVARIANTS) */ #define TAILQ_CONCAT(head1, head2, field) do { \ if (!TAILQ_EMPTY(head2)) { \ *(head1)->tqh_last = (head2)->tqh_first; \ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ (head1)->tqh_last = (head2)->tqh_last; \ TAILQ_INIT((head2)); \ QMD_TRACE_HEAD(head1); \ QMD_TRACE_HEAD(head2); \ } \ } while (0) #define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) #define TAILQ_FIRST(head) ((head)->tqh_first) #define TAILQ_FOREACH(var, head, field) \ for ((var) = TAILQ_FIRST((head)); \ (var); \ (var) = TAILQ_NEXT((var), field)) #define TAILQ_FOREACH_FROM(var, head, field) \ for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \ (var); \ (var) = TAILQ_NEXT((var), field)) #define TAILQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = TAILQ_FIRST((head)); \ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \ for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ for ((var) = TAILQ_LAST((head), headname); \ (var); \ (var) = TAILQ_PREV((var), headname, field)) #define TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field) \ for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \ (var); \ (var) = TAILQ_PREV((var), headname, field)) #define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \ for ((var) = TAILQ_LAST((head), headname); \ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \ (var) = (tvar)) #define TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \ for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \ (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \ (var) = (tvar)) #define TAILQ_INIT(head) do { \ TAILQ_FIRST((head)) = NULL; \ (head)->tqh_last = &TAILQ_FIRST((head)); \ QMD_TRACE_HEAD(head); \ } while (0) #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ QMD_TAILQ_CHECK_NEXT(listelm, field); \ if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\ TAILQ_NEXT((elm), field)->field.tqe_prev = \ &TAILQ_NEXT((elm), field); \ else { \ (head)->tqh_last = &TAILQ_NEXT((elm), field); \ QMD_TRACE_HEAD(head); \ } \ TAILQ_NEXT((listelm), field) = (elm); \ (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \ QMD_TRACE_ELEM(&(elm)->field); \ QMD_TRACE_ELEM(&(listelm)->field); \ } while (0) #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ QMD_TAILQ_CHECK_PREV(listelm, field); \ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ TAILQ_NEXT((elm), field) = (listelm); \ *(listelm)->field.tqe_prev = (elm); \ (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \ QMD_TRACE_ELEM(&(elm)->field); \ QMD_TRACE_ELEM(&(listelm)->field); \ } while (0) #define TAILQ_INSERT_HEAD(head, elm, field) do { \ QMD_TAILQ_CHECK_HEAD(head, field); \ if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \ TAILQ_FIRST((head))->field.tqe_prev = \ &TAILQ_NEXT((elm), field); \ else \ (head)->tqh_last = &TAILQ_NEXT((elm), field); \ TAILQ_FIRST((head)) = (elm); \ (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \ QMD_TRACE_HEAD(head); \ QMD_TRACE_ELEM(&(elm)->field); \ } while (0) #define TAILQ_INSERT_TAIL(head, elm, field) do { \ QMD_TAILQ_CHECK_TAIL(head, field); \ TAILQ_NEXT((elm), field) = NULL; \ (elm)->field.tqe_prev = (head)->tqh_last; \ *(head)->tqh_last = (elm); \ (head)->tqh_last = &TAILQ_NEXT((elm), field); \ QMD_TRACE_HEAD(head); \ QMD_TRACE_ELEM(&(elm)->field); \ } while (0) #define TAILQ_LAST(head, headname) \ (*(((struct headname *)((head)->tqh_last))->tqh_last)) #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) #define TAILQ_PREV(elm, headname, field) \ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) #define TAILQ_REMOVE(head, elm, field) do { \ QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \ QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \ QMD_TAILQ_CHECK_NEXT(elm, field); \ QMD_TAILQ_CHECK_PREV(elm, field); \ if ((TAILQ_NEXT((elm), field)) != NULL) \ TAILQ_NEXT((elm), field)->field.tqe_prev = \ (elm)->field.tqe_prev; \ else { \ (head)->tqh_last = (elm)->field.tqe_prev; \ QMD_TRACE_HEAD(head); \ } \ *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \ TRASHIT(*oldnext); \ TRASHIT(*oldprev); \ QMD_TRACE_ELEM(&(elm)->field); \ } while (0) #define TAILQ_SWAP(head1, head2, type, field) do { \ QUEUE_TYPEOF(type) *swap_first = (head1)->tqh_first; \ QUEUE_TYPEOF(type) **swap_last = (head1)->tqh_last; \ (head1)->tqh_first = (head2)->tqh_first; \ (head1)->tqh_last = (head2)->tqh_last; \ (head2)->tqh_first = swap_first; \ (head2)->tqh_last = swap_last; \ if ((swap_first = (head1)->tqh_first) != NULL) \ swap_first->field.tqe_prev = &(head1)->tqh_first; \ else \ (head1)->tqh_last = &(head1)->tqh_first; \ if ((swap_first = (head2)->tqh_first) != NULL) \ swap_first->field.tqe_prev = &(head2)->tqh_first; \ else \ (head2)->tqh_last = &(head2)->tqh_first; \ } while (0) #endif /* !_SYS_QUEUE_H_ */ mtr-0.92/configure.ac0000664000175000017500000001561513114217001013550 0ustar wolffwolffAC_PREREQ([2.59]) AC_INIT([mtr], [m4_esyscmd([build-aux/git-version-gen .tarball-version])], [R.E.Wolff@BitWizard.nl], [], [http://www.BitWizard.nl/mtr/]) AC_CONFIG_SRCDIR([ui/mtr.c]) AC_CONFIG_AUX_DIR([build-aux]) AC_USE_SYSTEM_EXTENSIONS AM_INIT_AUTOMAKE([ 1.7.9 foreign subdir-objects ]) # --enable-silent-rules m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) AC_CANONICAL_HOST AC_PROG_CC # Check pkg-config availability. m4_ifndef([PKG_PROG_PKG_CONFIG], [m4_fatal( [Could not locate the pkg-config autoconf macros. These are usually located in /usr/share/aclocal/pkg.m4. If your macros are in a different location, try setting the environment variable ACLOCAL_OPTS="-I/other/macro/dir" before running ./bootstrap.sh again.]) ]) PKG_PROG_PKG_CONFIG AM_CONDITIONAL([CYGWIN], [test "$host_os" = cygwin]) # Check bytes in types. AC_CHECK_SIZEOF([unsigned char], [1]) AC_CHECK_SIZEOF([unsigned short], [2]) AC_CHECK_SIZEOF([unsigned int], [4]) AC_CHECK_SIZEOF([unsigned long], [4]) # Check headers. AC_CHECK_HEADERS([ \ arpa/nameser_compat.h \ curses.h \ cursesX.h \ error.h \ fcntl.h \ linux/icmp.h \ ncurses.h \ ncurses/curses.h \ netinet/in.h \ socket.h \ sys/cdefs.h \ sys/limits.h \ sys/socket.h \ stdio_ext.h \ sys/types.h \ sys/xti.h \ values.h \ ]) # Check functions. AC_CHECK_FUNCS([ \ __fpending \ fcntl \ ]) AC_CHECK_FUNC([error], [with_error=no], [AC_CHECK_FUNCS([verr verrx vwarn vwarnx], [with_error=yes], [AC_MSG_ERROR([cannot find working error printing function]) ]) ]) AM_CONDITIONAL([WITH_ERROR], [test "x$with_error" = "xyes"]) AC_CHECK_FUNC([getopt_long], [with_getopt=no], [with_getopt=yes]) AS_IF([test "x$with_getopt" = "xno"], [ AC_DEFINE([HAVE_GETOPT], [1], [Define if libc has getopt_long]) ]) AM_CONDITIONAL([WITH_GETOPT], [test "x$with_getopt" = "xyes"]) AC_CHECK_LIB([m], [floor], [], [AC_MSG_ERROR([No math library found])]) # Find GTK AC_ARG_WITH([gtk], [AS_HELP_STRING([--without-gtk], [Build without the GTK+2.0 interface])], [], [with_gtk=yes]) AS_IF([test "x$with_gtk" = "xyes"], [PKG_CHECK_MODULES([GTK], [gtk+-2.0], [AC_DEFINE([HAVE_GTK], [1], [Define if gtk+-2.0 library available])], [with_gtk=no]) ]) AM_CONDITIONAL([WITH_GTK], [test "x$with_gtk" = xyes]) # Find ncurses AC_ARG_WITH([ncurses], [AS_HELP_STRING([--without-ncurses], [Build without the ncurses interface])], [], [with_ncurses=yes]) AS_IF([test "x$with_ncurses" = "xyes"], # Prefer ncurses over curses, if both are available. # (On Solaris 11.3, ncurses builds and links for us, but curses does not.) [AC_SEARCH_LIBS( [initscr], [ncurses curses], [AC_DEFINE([HAVE_CURSES], [1], [Define if a curses library available])], [with_ncurses=no]) ]) AM_CONDITIONAL([WITH_CURSES], [test "x$with_ncurses" = xyes]) AC_CHECK_LIB([cap], [cap_set_proc], [], AS_IF([test "$host_os" = linux-gnu], AC_MSG_WARN([Capabilities support is strongly recommended for increased security. See SECURITY for more information.]))) # Enable ipinfo AC_ARG_WITH([ipinfo], [AS_HELP_STRING([--without-ipinfo], [Do not try to use ipinfo lookup at all])], [], [with_ipinfo=yes]) AM_CONDITIONAL([WITH_IPINFO], [test "x$with_ipinfo" = "xyes"]) AS_IF([test "x$with_ipinfo" = "xyes"], [ AC_DEFINE([HAVE_IPINFO], [1], [Define when ipinfo lookups are in use]) ]) AC_ARG_ENABLE([ipv6], [AS_HELP_STRING([--disable-ipv6], [Do not enable IPv6])], [WANTS_IPV6=$enableval], [WANTS_IPV6=yes]) AS_IF([test "x$WANTS_IPV6" = "xyes"], [ AC_DEFINE([ENABLE_IPV6], [1], [Define to enable IPv6]) USES_IPV6=yes ]) AC_CHECK_FUNC([socket], [], [AC_CHECK_LIB([socket], [socket], [], [AC_MSG_ERROR([No socket library found])])]) AC_CHECK_FUNC([gethostbyname], [], [AC_CHECK_LIB([nsl], [gethostbyname], [], [AC_MSG_ERROR([No nameservice library found])])]) # Find resolver library. AC_CHECK_FUNC([res_query], [RESOLV_LIBS=""], [ AC_CHECK_LIB([resolv], [__res_query], [RESOLV_LIBS="-lresolv"], [ AC_CHECK_LIB([resolv], [res_query], [RESOLV_LIBS="-lresolv"], [ AC_CHECK_LIB([bind], [res_query], [RESOLV_LIBS="-lbind"], [ AC_MSG_ERROR([No resolver library found]) ]) ]) ]) ]) dnl MacOS has res_query in libc, but needs libresolv for dn_expand(). AS_IF([test "x" = "x$RESOLV_LIBS"], [ AC_CHECK_LIB([resolv], [dn_expand], [RESOLV_LIBS="-lresolv"]) ]) AC_SUBST([RESOLV_LIBS]) # Check errno and socket data types. AC_CHECK_DECLS([errno], [], [], [[ #include #include ]]) AC_CHECK_TYPE([socklen_t], [AC_DEFINE([HAVE_SOCKLEN_T], [], [Define if your system has socklen_t])], [], [[#include #ifdef HAVE_SOCKET_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif]]) AC_CHECK_TYPES([time_t], [], [], [[ #include ]]) # Add C flags to display more warnings AC_MSG_CHECKING([for C flags to get more warnings]) ac_save_CFLAGS="$CFLAGS" AS_IF([test "x$ac_cv_c_compiler_gnu" = "xyes"], [ dnl gcc is the easiest C compiler warning_CFLAGS="-Wall" # Check if compiler supports -Wno-pointer-sign and add it if supports CFLAGS_saved="$CFLAGS" CFLAGS="$CFLAGS -Wno-pointer-sign" AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int foo;]])], [warning_CFLAGS="${warning_CFLAGS} -Wno-pointer-sign"], []) CFLAGS="$CFLAGS_saved" ], [ dnl Vendor supplied C compilers are a bit tricky AS_CASE([$host_os], dnl SGI IRIX with the MipsPRO C compiler [irix*], [ CFLAGS="$CFLAGS -fullwarn" AC_COMPILE_IFELSE([ AC_LANG_PROGRAM( [[#include ]], [[printf("test");]])], [warning_CFLAGS="-fullwarn"], [] ) ], dnl SunOS 4.x with the SparcWorks(?) acc compiler [sunos*], [ AS_IF([test "$CC" = "acc"], [ CFLAGS="$CFLAGS -vc" AC_COMPILE_IFELSE([ AC_LANG_PROGRAM( [[#include ]], [[printf("test");]])], [warning_CFLAGS="-vc"], [] ) ]) ] dnl Unknown, do nothing [*], [ warning_CFLAGS="none" ] ) ]) CFLAGS="$ac_save_CFLAGS" AS_IF([test "$warning_CFLAGS" = "none"], [ AC_MSG_RESULT([none]) ], [ CFLAGS="$CFLAGS $warning_CFLAGS" AC_MSG_RESULT([$warning_CFLAGS]) ]) # bash-completion AC_ARG_WITH([bashcompletiondir], AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]), [], [AS_IF([`$PKG_CONFIG --exists bash-completion`], [ with_bashcompletiondir=`$PKG_CONFIG --variable=completionsdir bash-completion` ], [ with_bashcompletiondir=${datadir}/bash-completion/completions ]) ]) AC_SUBST([bashcompletiondir], [$with_bashcompletiondir]) AC_ARG_ENABLE([bash-completion], AS_HELP_STRING([--disable-bash-completion], [do not install bash completion files]), [], [enable_bash_completion=yes] ) AM_CONDITIONAL([BUILD_BASH_COMPLETION], [test "x$enable_bash_completion" = xyes]) # Prepare config.h, Makefile, and output them. AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT mtr-0.92/mtr-packet.80000664000175000017500000002224413031773102013425 0ustar wolffwolff.TH MTR-PACKET 8 "0.87.203-0e5e" "mtr-packet" "System Administration" .HP 7 .SH NAME mtr-packet - send and receive network probes .SH DESCRIPTION .B mtr-packet is a tool for sending network probes to measure network connectivity and performance. Many network probes can be sent simultaneously by a single process instance of .B mtr-packet and additional probes can be generated by an instance of .B mtr-packet which already has network probes in flight. It is intended to be used by programs which invoke it with Unix pipes attached to its standard input and output streams. .LP .B mtr-packet reads command requests from .IR stdin , each separated by a newline character, and responds with command replies to .IR stdout , also each separated by a newline character. The syntactic structure of requests and replies are the same. The following format is used: .LP .RS .I TOKEN .I COMMAND [\c .I ARGUMENT-NAME .I ARGUMENT-VALUE \&...] .RE .LP .I TOKEN is a unique integer value. The same value will be used as the .I TOKEN for the response. This is necessary for associating replies with requests, as commands may be completed in a different order than they are requested. The invoker of .B mtr-packet should always use the .I TOKEN value to determine which command request has completed. .LP .I COMMAND is a string identifying the command request type. A common command is .BR send-probe , which will transmit one network probe. .LP .I ARGUMENT-NAME strings and .I ARGUMENT-VALUE strings always come in pairs. It is a syntactic error to provide an .I ARGUMENT-NAME without a corresponding .IR ARGUMENT-VALUE . Valid .I ARGUMENT-NAME strings depend on the .I COMMAND being used. .SH REQUESTS .TP .B send-probe Send a network probe to a particular IP address. Either an .B ip-4 or .B ip-6 argument must be provided. A valid .B send-probe command will reply with .BR reply , .BR no-reply , or .BR ttl-expired . .IP The following arguments may be used: .IP .B ip-4 .I IP-ADDRESS .HP 14 .IP The Internet Protocol version 4 address to probe. .HP 7 .IP .B ip-6 .I IP-ADDRESS .HP 14 .IP The Internet Protocol version 6 address to probe. .HP 7 .IP .B protocol .I PROTOCOL .HP 14 .IP The protocol to use for the network probe. .BR icmp , .BR sctp , .BR tcp , and .B udp may be used. The default protocol is .BR icmp. .HP 7 .IP .B port .I PORT-NUMBER .HP 14 .IP The destination port to use for .BR sctp , .BR tcp , or .B udp probes. .HP 7 .IP .B local-ip-4 .I IP-ADDRESS .HP 14 .IP The local Internet Procol version 4 address to use when sending probes. .HP 7 .IP .B local-ip-6 .I IP-ADDRESS .HP 14 .IP The local Internet Protocol version 6 address to use when sending probes. .HP 7 .IP .B local-port .I PORT-NUMBER .HP 14 .IP For .B udp probes, the local port number from which to send probes. .HP 7 .IP .B timeout .I TIMEOUT-SECONDS .HP 14 .IP The number of seconds to wait for a response to the probe before discarding the probe as lost, and generating a .B no-reply command reply. .HP 7 .IP .B ttl .I TIME-TO-LIVE .HP 14 .IP The time-to-live value for the Internet Protocol packet header used in constructing the probe. This value determines the number of network hops through which the probe will travel before a response is generated by an intermediate network host. .HP 7 .IP .B size .I PACKET-SIZE .HP 14 .IP The size of the packet used to send the probe, in bytes, including the Internet Protocol header and transport protocol header. .HP 7 .IP .B bit-pattern .I PATTERN-VALUE .HP 14 .IP The packet payload is filled with bytes of the value specified. Valid pattern values are in the range 0 through 255. .HP 7 .IP .IP .B tos .I TYPE-OF-SERVICE .HP 14 .IP In the case of IPv4, the "type of service" field in the IP header is set to this value. In the case of IPv6, the "traffic class" field is set. .HP 7 .IP .B mark .I ROUTING-MARK .HP 14 .IP The packet mark value to be used by mark-based routing. (Available only on Linux.) .HP 7 .TP .B check-support Check for support for a particular feature in this version of .B mtr-packet and in this particular operating environment. .B check-support will reply with .BR feature-supported . A .B feature argument is required. .HP 7 .IP .B feature .I FEATURE-NAME .HP 14 .IP The name of a feature requested. .HP 7 .IP Some features which can be checked are .BR send-probe , .BR ip-4 , .BR ip-6 , .BR icmp , .BR sctp , .BR tcp , .BR udp , and .BR mark . The feature .B version can be checked to retrieve the version of .BR mtr-packet . .SH REPLIES .TP .B reply The destination host received the .B send-probe probe and replied. Arguments of .B reply are: .HP 7 .IP .B ip-4 .I IP-ADDRESS .HP 14 .IP The Internet Protocol version 4 address of the host which replied to the probe. .HP 7 .IP .B ip-6 .I IP-ADDRESS .HP 14 .IP The Internet Protocol version 6 address of the host which replied to the probe. .HP 7 .IP .B round-trip-time .I TIME .HP 14 .IP The time which passed between the transmission of the probe and its response. The time is provided as a integral number of microseconds elapsed. .HP 7 .TP .B no-reply No response to the probe request was received before the timeout expired. .TP .B ttl-expired The time-to-live value of the transmitted probe expired before the probe arrived at its intended destination. Arguments of .B ttl-expired are: .HP 7 .IP .B ip-4 .I IP-ADDRESS .HP 14 .IP The Internet Protocol version 4 address of the host at which the time-to-live value expired. .HP 7 .IP .B ip-6 .I IP-ADDRESS .HP 14 .IP The Internet Protocol version 6 address of the host at which the time-to-live value expired. .HP 7 .IP .B round-trip-time .I TIME .HP 14 .IP The time which passed between the transmission of the probe and its response. The time is provided as a integral number of microseconds elapsed. .HP 7 .IP .B mpls .I MPLS-LABEL-LIST .HP 14 .IP A list of Multiprotocol Label Switching values returned with the probe response. If the .B mpls argument is present, one or more MPLS labels will be represented by a comma separated list of values. The values are provided in groups of four. The first four values in the list correspond to the first MPLS label, the next four values correspond to the second MPLS label, and so on. The values are provided in this order: .IR label , .IR experimental-use , .IR bottom-of-stack , .IR ttl . .HP 7 .TP .B no-route There was no route to the host used in a .B send-probe request. .TP .B network-down A probe could not be sent because the network is down. .TP .B probes-exhausted A probe could not be sent because there are already too many unresolved probes in flight. .TP .B permission-denied The operating system denied permission to send the probe with the specified options. .TP .B invalid-argument The command request contained arguments which are invalid. .TP .B feature-support A reply to provided to .B check-support indicating the availability of a particular feature. The argument provided is: .HP 7 .IP .B support .I PRESENT .HP 14 .IP In most cases, the .I PRESENT value will be either .BR ok , indicating the feature is supported, or .BR no , indicating no support for the feature. .IP In the case that .B version is the requested .IR FEATURE-NAME , the version of .B mtr-packet is provided as the .I PRESENT value. .HP 7 .IP .SH EXAMPLES A controlling program may start .B mtr-packet as a child process and issue the following command on .IR stdin : .LP .RS 42 send-probe ip-4 127.0.0.1 .RE .LP This will send a network probe to the loopback interface. When the probe completes, .B mtr-packet will provide a response on .I stdout such as the following: .LP .RS 42 reply ip-4 127.0.0.1 round-trip-time 126 .RE .LP This indicates that the loopback address replied to the probe, and the round-trip time of the probe was 126 microseconds. .LP In order to trace the route to a remote host, multiple .B send-probe commands, each with a different .B ttl value, are used. .LP .RS 11 send-probe ip-4 8.8.8.8 ttl 1 .RS 0 12 send-probe ip-4 8.8.8.8 ttl 2 .RS 0 13 send-probe ip-4 8.8.8.8 ttl 3 .RS 0 \&... .RE 0 .LP Each interemediate host would respond with a .B ttl-expired message, and the destination host would respond with a .BR reply : .LP .RS 11 ttl-expired ip-4 192.168.254.254 round-trip-time 1634 .RS 0 12 ttl-expired ip-4 184.19.243.240 round-trip-time 7609 .RS 0 13 ttl-expired ip-4 172.76.20.169 round-trip-time 8643 .RS 0 14 ttl-expired ip-4 74.40.1.101 round-trip-time 9755 .RS 0 15 ttl-expired ip-4 74.40.5.126 round-trip-time 10695 .RS 0 17 ttl-expired ip-4 108.170.245.97 round-trip-time 14077 .RS 0 16 ttl-expired ip-4 74.40.26.131 round-trip-time 15253 .RS 0 18 ttl-expired ip-4 209.85.245.101 round-trip-time 17080 .RS 0 19 reply ip-4 8.8.8.8 round-trip-time 17039 .RE 0 .LP Note that the replies in this example are printed out of order. (The reply to probe 17 arrives prior to the reply to probe 16.) This is the reason that it is important to send commands with unique token values, and to use those token values to match replies with their originating commands. .SH CONTACT INFORMATION .PP For the latest version, see the mtr web page at .UR http://\:www.\:bitwizard.\:nl/\:mtr/ .UE .PP For patches, bug reports, or feature requests, please open an issue on GitHub at: .UR https://\:github\:.com/\:traviscross/\:mtr .UE . .SH "SEE ALSO" .BR mtr (8), .BR icmp (7), .BR tcp (7), .BR udp (7), TCP/IP Illustrated (Stevens, ISBN 0201633469). mtr-0.92/bootstrap.sh0000775000175000017500000000014513031772644013647 0ustar wolffwolff#!/bin/sh aclocal $ACLOCAL_OPTS autoheader automake --add-missing --copy --foreign autoconf --force mtr-0.92/Makefile.am0000664000175000017500000000731313031772644013333 0ustar wolffwolffEXTRA_DIST = \ BSDCOPYING \ SECURITY \ build-aux/mtr.bat \ img/mtr_icon.xpm $(TEST_FILES) sbin_PROGRAMS = mtr mtr-packet TESTS = \ test/cmdparse.py \ test/param.py \ test/probe.py TEST_FILES = \ test/cmdparse.py \ test/mtrpacket.py \ test/param.py \ test/probe.py \ test/lint.sh EXTRA_DIST += $(TEST_FILES) PATHFILES = CLEANFILES = $(PATHFILES) EXTRA_DIST += $(PATHFILES:=.in) # # We would use % pattern matching here, but that is a GNU make # extension and doesn't work on FreeBSD. # mtr-packet.8: $(srcdir)/man/mtr-packet.8.in $(AM_V_GEN) $(srcdir)/build-aux/mangen.sh "$(VERSION)" \ $(srcdir)/man/mtr-packet.8.in $@ mtr.8: $(srcdir)/man/mtr.8.in $(AM_V_GEN) $(srcdir)/build-aux/mangen.sh "$(VERSION)" \ $(srcdir)/man/mtr.8.in $@ $(PATHFILES): Makefile dist_man_MANS = mtr.8 mtr-packet.8 PATHFILES += man/mtr.8 man/mtr-packet.8 install-exec-hook: `setcap cap_net_raw+ep $(DESTDIR)$(sbindir)/mtr-packet` \ || chmod u+s $(DESTDIR)$(sbindir)/mtr-packet mtr_SOURCES = ui/mtr.c ui/mtr.h \ ui/net.c ui/net.h \ ui/cmdpipe.c ui/cmdpipe.h \ ui/dns.c ui/dns.h \ ui/raw.c ui/raw.h \ ui/split.c ui/split.h \ ui/display.c ui/display.h \ ui/report.c ui/report.h \ ui/select.c ui/select.h \ ui/utils.c ui/utils.h \ packet/cmdparse.c packet/cmdparse.h \ ui/mtr-curses.h \ img/mtr_icon.xpm \ ui/mtr-gtk.h if WITH_ERROR mtr_SOURCES += \ portability/error.h \ portability/error.c endif if WITH_GETOPT mtr_SOURCES += \ portability/getopt.h \ portability/getopt.c \ portability/getopt1.c endif if WITH_IPINFO mtr_SOURCES += ui/asn.c ui/asn.h endif if WITH_CURSES mtr_SOURCES += ui/curses.c endif if WITH_GTK mtr_SOURCES += ui/gtk.c endif mtr_INCLUDES = $(GLIB_CFLAGS) -I$(top_builddir) -I$(top_srcdir) mtr_CFLAGS = $(GTK_CFLAGS) $(NCURSES_CFLAGS) mtr_LDADD = $(GTK_LIBS) $(NCURSES_LIBS) $(RESOLV_LIBS) mtr_packet_SOURCES = \ portability/queue.h \ packet/packet.c \ packet/cmdparse.c packet/cmdparse.h \ packet/command.c packet/command.h \ packet/platform.h \ packet/probe.c packet/probe.h \ packet/protocols.h \ packet/timeval.c packet/timeval.h \ packet/wait.h mtr_packet_LDADD = $(CAP_LIBS) if CYGWIN mtr_packet_SOURCES += \ packet/command_cygwin.c packet/command_cygwin.h \ packet/probe_cygwin.c packet/probe_cygwin.h \ packet/wait_cygwin.c mtr_packet_LDADD += -lcygwin -liphlpapi -lws2_32 dist_windows_aux = \ $(srcdir)/build-aux/mtr.bat \ $(srcdir)/AUTHORS \ $(srcdir)/BSDCOPYING \ $(srcdir)/COPYING \ $(srcdir)/README \ $(srcdir)/NEWS distwindir = $(distdir)-win-$(host_cpu) # Bundle necessary files for a Windows binary distribution distdir-win: $(dist_windows_aux) mtr.exe mtr-packet.exe rm -fr $(distwindir) mkdir -p $(distwindir) $(distwindir)/bin $(distwindir)/terminfo cp $(dist_windows_aux) -t $(distwindir) cp mtr.exe mtr-packet.exe -t $(distwindir)/bin ldd mtr.exe | grep -v cygdrive | awk '{ print $$3 }' | xargs cp -t $(distwindir)/bin cp `find /usr/share/terminfo -name cygwin | xargs dirname` -r $(distwindir)/terminfo # Zip up a Windows binary distribution dist-windows-bin: distdir-win rm -f $(distwindir).zip zip -rq $(distwindir).zip $(distwindir) rm -fr $(distwindir) else # if CYGWIN check_PROGRAMS = mtr-packet-listen mtr_packet_SOURCES += \ packet/command_unix.c packet/command_unix.h \ packet/construct_unix.c packet/construct_unix.h \ packet/deconstruct_unix.c packet/deconstruct_unix.h \ packet/probe_unix.c packet/probe_unix.h \ packet/wait_unix.c mtr_packet_listen_SOURCES = \ test/packet_listen.c endif # if CYGWIN if BUILD_BASH_COMPLETION dist_bashcompletion_DATA = bash-completion/mtr endif mtr-0.92/NEWS0000664000175000017500000007673513114223741012003 0ustar wolffwolffWHAT'S NEW? The new release script will do a "git shortlog" to add the commit messages here. #NEW_STUFF_HERE this is a tag my script looks for. V0.92 added a few arguments to calls added by fmazu. Allows it to compile. V0.91 only made the tag point to the proper commit. --REW script now handles that situation (aborted release script) better. V0.90 only fixed the release script. Should now contain fmaxullo's patch. --rew fmazullo (1): Add AS number to json output V0.89 only made the tag point to the proper commit. --REW V0.88 Antonio Querubin (3): Merge remote-tracking branch 'origin/master' into newdns Need to error check getnameinfo(). Merge remote-tracking branch 'origin/master' into newdns David Hill (1): include for fd_set Jakub Wilk (1): Fix typos Joe Bruggeman (2): Replace all tabs tabs in net.c with spaces cleanup the if blocks in net.c to improve readability Jürgen Weigert (1): Mention + and - keys in the man page Kacper Michajłow (2): Relax mtr-packet search rules. Add missing errno.h include. Matt Kimball (20): Added mtr-packet subprocess test: Fix mtr-packet tests for Python 3 cmdline: multiple host names dropped all but one host (issue #168) mtr-packet: IPv6 support mtr-packet: UDP probe support mtr-packet: packet customization options (size, fill, mark, tos) mtr-packet: TCP and SCTP probes mtr-packet: MPLS decoding and local UDP port usage mtr-packet: allow local address binding Merge branch mtr-packet into 'master' mtr-packet: drop capabilities + using BSD's linked lists for probes build: moved front-end source into ui subdir build: use AC_CHECK_LIB for ncurses, rather than pkg-tool mtr-packet: Fall back to IPv4 only support if IPv6 sockets fail to open build: if linking with ncurses fails, try curses (for NetBSD) build: Fix Solaris build issues build: fix compiler warnings when for OpenBSD, NetBSD and Solaris mtr-packet: Report probe status on host unreachable (Cygwin) cleanup: Fix #ifdef structure which confuses 'ident' cleanup: reindented C source with GNU indent Narthorn (2): Initialize dns process before opening display Add displaymode 2 back in R.E. Wolff (19): Merge branch 'newdns' of https://github.com/traviscross/mtr into newdns Merge branch 'newdns' fixed double printout of start time, issue 131 Updated NEWS as in v0.87.1 format sent and rcvd fields correctly for big numbers #66 increased default unknownhosts #92 #132 #130 (I give in). Merge branch 'master' of github.com:traviscross/mtr fixed no-gtk build bug introduced with e2d898cc more cleanup Partial reverse of 6bb5b6b3b. re-initialize ipinfo_no and -max. Fixes #161. Merge branch 'master' of github.com:traviscross/mtr fixed dynamic DNS on/off switch. Fixed #160 header alignment issue found&fixed by meingtsla. Fixes #164 Merge branch 'master' of github.com:traviscross/mtr asn fix from meingtsla, fixes #163. Pong! put ifdefs around IPV6 only part. Fixes #184 More whitespace mangling for consistency in net.c The release script bumped the version number Roger Wolff (22): New DNS works for IPV4.... moved towards IPV6 compatibilty... removed the include mess... merged antonios's bufsize fixes Merge branch 'master' of github.com:traviscross/mtr into newdns AQ: Added include for redhat, and fixed salen for BSD removed last debug output from dns.c One more patch to fix a getnameinfo corruption problem. -- AQ Rogier Wolff (5): removed AC check for features newdns doesn't use Fixed pull #133 another way.... fixed #27 and #35 where the fix was tested a long time ago. fixed #141 compile without SCTP if not available fixed typo. Sami Kerola (122): warnings: remove unnecessary file usage: add short and long options and descriptions to usage() warnings: stop variable shadowing dns: remove unnecessary dns_events() function posix: replace bzero() and index() with modern equivelants warnings: stop reassigning a value before the old one has been used warnings: remove code that cannot be reached warnings: fix printf data types cleanup: remove unnecessary null check build-sys; do not use subdirectory object man: use url macro to urls and fix reference manual notations build-sys: default to ,/configure --enable-silent-rules warnings: do not take abs() when data type is unsigned warnings: mark unused function input variables warnings: fix couple unsigned vs signed variable comparisions warnings: multiply timeval seconds only when the value is small warnings: fix some missed unsigned vs signed variable comparisions comment: add value range note to initialization cast: do not downgrade to float when double should be used warnings: remove dead code build-sys: fix make distcheck build-sys: remove old dist Makefile kludge build-sys: use build version script from gnulib build-sys: improve configure.am build-sys: require automake 1.11.6 or newer warnings: fix unused variable when ./configure --without-gtk is used readability: always use EXIT_* definitions from stdlib.h cleanup: remove unnecessary function warnigns: add void to functions that do not take any arguments build-sys: fix --without-ipinfo regressions build-sys: fix ./configure --disable-ipv6 warnings: fix --disable-ipv6 --without-ipinfo compilation warnings build-sys: check pkg-config availability build-sys: use pkg-config to find gtk+-2.0 build-sys: use pkg-config to find ncurses build-sys: get rid of double negative ipinfo autotools settings cleanup: remove NO_SPLIT preprocessor check build-sys: simplify finding resolver library build-sys: remove unused autoconf check values cleanup: remove obsolete herror() function usage: reflect ./configure choices in available command line options cleanup: remove preprocessor missing functions go-arounds usage: be careful when parsing numeric user input usage: use error(3) error-reporting function cleanup: move max port number to be a define in net.h build-sys: use system getopt_long() when it is available build-sys: tell function locality explicitly portability: fix float max check from values.h portability: MacOS does not have error() function portability: fix MacOS libresolv usage data types: set static strings to be read-only cleanup: remove redundant redeclaration data types: move variable declaration from header to .c file data types: check with smatch everything is in resonable scope warnings: fix use of uninitialized warning data types: get rid of all globals that are easy to remove usability: fix --mark documentation docs: make manual page versioning automatic data types: move global data to control structures data types: make control structure smaller data types: move rest of the global variables to control structures crash fix: make --xml not to dump core warnings: correct function pointer prototype argument warnings: do not use zero as NULL warnings: avoid vla when malloc() is more appropriate usability: print usage() if unknown options are used cleanup: use definition for a magic value appearing twice in code cleanup: remove commented out includes in dns.c cleanup: avoid duplicating stdint.h cleanup: use ICMP definitions from linux/icmp.h when possible cleanup: move generic utility functions to a separate file reliability: ensure string copy results to a null determined string reliability: further removal of unsave string operation reliability: always check malloc() return value reliability: always check strdup() return value reliability: check writing to stdout and stderr was successful usability: use ISO-8601 timestamp posix: do not use time(2) input argument usability: add bash-completion file bug fix: long option --gracetime is correct, --graceperiod is not performance: use fewer printw() calls to center text cleanup: merge two trim functions to one crash fix: add ctl structure to gtk Pause_clicked() handler crash fix: never return const string as address crash fix: ctl->iiwidth_len was not initialized correctly cleanup: make unused and const attributes to look the same performance: make get_iiwidth() to be const function cleanup: remove more/bottom labels header separation from mpls cleanup: set variable only if it is used cleanup: correct display_offset variable usage cleanup: remove message duplicate performance: set few variables read-only docs: add Sami Kerola to authors performance: make reset in net.c more effective portability: fix bsd build warnings: ensure printf will not overflow misc: improve random initialization net: fix net_reopen() initialization warnings: fix warnings when everything possible is turned on curses: simplify format_number() curses: use switch case in mtr_curses_keyaction() cleanup: remove dead code style: convert c++ comment style to c style display: avoid unnecessary switch case clauses curses: convert magic numbers to an enum list data types: move variables from a file to a function scope cleanup: move file scope variables to the beginning of file data types: move names list away from global scope cleanup: move definitions and struct declarations to mtr.h cleanup: clarify preprocessor nesting build-sys: use proper check to find if time_t is defined build-sys: enable all system extensions regression: fix --displaymode=2 argument user interface: do not allow out of range --ipinfo arguments cleanup: use single logic to handle conditional options docs: add very basic --sctp documentation to manual page docs: improve mtr-packet(8) manual page build-sys: update .gitignore file smatch: extern keyword is needed only in header smatch: fix couple warnings build-sys: update .gitignore file docs: FSF moved back in 2005 Vlad Glagolev (1): respect theme foreground color aquerubin (5): Correct psize for IPv6. Merge updates from branch 'master' into newdns Merge branch 'master' into newdns Merge branch 'newdns' of https://github.com/aquerubin/mtr into newdns Fix standard deviation calculation. rewolff (22): V0.87 Antonio Querubin (1): Use setcap instead of setuid when installing the binary. Baptiste Jonglez (4): Allow enabling IP info and ASN lookup from the curses interface Document the -y option in the manpage Cosmetic cleanup of the option-parsing code Fix wrap-around bug when displaying IP info (-y option) Danek Duvall (1): Fix issue #76: rationalize the discovery of a terminal handling library Gareth Randall (6): Corrected the "without gtk" reference to "./configure --without-gtk", Filled in some of the missing man page sections. Remove a warning message at compile time. Fix typos and update mailing list references. Add a section about granting limited security capabilities. State that Github is the preferred way to report bugs. Guo Yixuan (1): Raw output: add x for a ping-packet-sent event. Hajimu UMEMOTO (1): Add aslookup support to gtk interface Jakub Wilk (1): Fix typos. Kris Coward (1): Added --displaymode option Narthorn (1): curses: Fix background transparency in terminal Nikolai R Kristiansen (1): Add support for JSON as report output format R.E. Wolff (9): explanation of the version numbers in NEWS. Merge branch 'master' of github.com:traviscross/mtr removed warning about IPV6 socket when IPV6 is not available at runtime fix for printing space field in XML. modified name of timeout variable to prevent warning on solaris. changed the name of the ping timeout timer from 'tag' to 'ping timeout timer' net.c fix from AQ. issue 128: compile should be in .gitignore The release script bumped the version number added use-default-colors... Theo Baschak (1): Update asn.c - 32bit asn widths Tobias Rittweiler (5): Fix typo in csv_close() that prevented any of the data columns from being printed. --csv: Don't print spaces in columns. --csv: Print a header line as the first line which names all columns. asn.h: Guard against being included twice. Fix setting length field of UDP header to broken value on BSD systems. Vojtech Kurka (1): Fixed behaviour of Pause button aquerubin (3): Correct psize for IPv6. Fix Avg and Best column order to match column headers in GTK display. Update Tony's email address in the GTK credits. penyu (1): add max-unknown option russor (10): allow setting local and remote port for UDP probing fix checksum for odd sized packets set the local address for display if it was bound automatically set udp address if needed fix improper aliasing fix placement of zeros when running alternate udp checksum endian neutral placement of alternate checksum copy odd byte into a 16-bit temp value; used bit-sized types for calrity correct checksum calculation when adding the overflow overflows add option to set graceperiod swordfeng (3): Add SCTP support (same way with tcp) remove comment fix sctp header structure ======= #this is a tag my script looks for. #NEW_STUFF_HERE V0.87 Antonio Querubin (1): Use setcap instead of setuid when installing the binary. Baptiste Jonglez (4): Allow enabling IP info and ASN lookup from the curses interface Document the -y option in the manpage Cosmetic cleanup of the option-parsing code Fix wrap-around bug when displaying IP info (-y option) Danek Duvall (1): Fix issue #76: rationalize the discovery of a terminal handling library Gareth Randall (6): Corrected the "without gtk" reference to "./configure --without-gtk" Filled in some of the missing man page sections. Remove a warning message at compile time. Fix typos and update mailing list references. Add a section about granting limited security capabilities. State that Github is the preferred way to report bugs. Guo Yixuan (1): Raw output: add x for a ping-packet-sent event. Hajimu UMEMOTO (1): Add aslookup support to gtk interface Jakub Wilk (1): Fix typos. Kris Coward (1): Added --displaymode option Narthorn (1): curses: Fix background transparency in terminal Nikolai R Kristiansen (1): Add support for JSON as report output format R.E. Wolff (9): explanation of the version numbers in NEWS. Merge branch 'master' of github.com:traviscross/mtr removed warning about IPV6 socket when IPV6 is not available at runtime fix for printing space field in XML. modified name of timeout variable to prevent warning on solaris. changed the name of the ping timeout timer from 'tag' to 'ping timeout timer' net.c fix from AQ. issue 128: compile should be in .gitignore The release script bumped the version number Rogier Wolff (1): added use-default-colors... Theo Baschak (1): Update asn.c - 32bit asn widths Tobias Rittweiler (5): Fix typo in csv_close() that prevented any of the data columns from being printed. --csv: Don't print spaces in columns. --csv: Print a header line as the first line which names all columns. asn.h: Guard against being included twice. Fix setting length field of UDP header to broken value on BSD systems. Vojtech Kurka (1): Fixed behaviour of Pause button aquerubin (3): Correct psize for IPv6. Fix Avg and Best column order to match column headers in GTK display. Update Tony's email address in the GTK credits. penyu (1): add max-unknown option russor (10): allow setting local and remote port for UDP probing fix checksum for odd sized packets set the local address for display if it was bound automatically set udp address if needed fix improper aliasing fix placement of zeros when running alternate udp checksum endian neutral placement of alternate checksum copy odd byte into a 16-bit temp value; used bit-sized types for calrity correct checksum calculation when adding the overflow overflows add option to set graceperiod swordfeng (3): Add SCTP support (same way with tcp) remove comment fix sctp header structure V0.86 Fixed default hostname logic. Fix for NetBSD: 64bit time_t -- Thomas Klausner Fix unnecessary runtime dependency on glib from VSYakovetsky through Thomas Inverted IPINFO define in the code. Removes double negatives. -- Vladimir Yakovetsky, REW. Fixed failure on IPv4 only systems when IPv6 was available at compile time. -- REW. Fixed (longstanding) bug that mtr used 100% cpu when paused. Cosmetic changes from Richard Hartman. V0.85 Fixed asn support. (better compile time detection of required features) support for multiple hostnames. (fixed in 0.86) support for TCP probes V0.84 Fix some glib things by Thomas. V0.83 Move to github. Mostly done by Travis. Author: Travis Cross Add autotools bootstrap script Update README for building from git repository Cleanup whitespace in the NEWS file Resolve -Wunused-but-set-variable warnings Resolve -Wnull-dereference clang warning Add -z / --show-ip support Author: R.E. Wolff (mostly from patches by others) some running patches Made report wide switch properly to displayreport mode. Bug #780647 fixed gtk field order. Bug #701513 added aslookup patch from bug #701514 added some extra clarifications to the SECURITY file. enable ipv6 resolvers. By Antonio Querubin. Fixes bug #752583 V0.82 Removed old Changelog file appended at the end as oldest changes. 2011-03-28 Mark Kamichoff Enable decoding of ICMP extensions for MPLS for curses and report interfaces. Use the -e flag or press 'e' to enable it. V0.81 Moved to git. Testing git... V0.80 Some compilation fixes for BSD by Jeremy Chadwick V0.78/0.79 some compilation fixes for BSD&others by Thomas Klausner V0.76 display load sharing hosts in --raw output. added about button in gui. v0.75 Feelgood patch to move sprintf to snprintf. People might think that sprintf might cause a buffer overflow. Now it's clean. cut-paste patches: you can now copy an intermediate host to the clipboard. v0.74 Martin Pels' patch to allow UDP probes. KES reported a build problem. Turns out I need to install gtk-1.2 on my development system, otherwise my release script causes the build to break. changed some docs to advertise the new mailing list. added documentation for the Mac OS X compilation problem. added -Wno-pointer-sign to the compiler options. Nico Lichtmaier's cleanup-gtk patch. (now mtr uses a more modern dialect of gtk). v0.73 Some security patches. Although MTR drops privileges as soon as possible after opening the sockets, it still had some sprintf calls, which have now been converted into snprintf. v0.72 Fix signed/unsigned bug in IPV6 part improved random packet size behaviour. --REW v0.71 Some IPV6 fixes, introduce packet size cmdline option. (was already present as a cmdline argument) v0.70 Antinio submitted a cumulative patch containing some nice improvements. He also submitted an automake patch that causes mtr to no longer compile on my system. I refuse to have mtr "in the dark" that I can't test-compile the dist. v0.69 make distclean should now also remove "rej" files. Antonio Querubin: update getopt.h . More cleanups using new infrastructure. rcw: Fixed IPV6 support: When compiled in an IPV6-supporting environment, but when the kernel doesn't support IPV6, mtr would fail to start. v0.68 included some old patches. included patch from Antonio Querubin for better IPV6 support restructured some more whitespace. added mtr.h where "global" things should go. Not finished moving things around, but now that the infrastructure is there, it should be easy. v0.67 Bad keyboarding by REW caused this one out the door. Sorry. No changes. v0.66 Through the Debian bugtracking system a bug report and fix was sent my way, that deals with stupid optimization trying to save some 768 bytes of memory, sacrificing "it works" on a different architecture... (default char signedness) v0.65 Dancer Vesperman noted that mtr no longer traces past a section of non-responding hosts. Apparently I added a line in net.c that didn't make sense in mtr-0.56. I can't find the reason for adding that line, so someone who thinks (s)he needs it, should holler. v0.64 Philippe suggests to do the time_t thingy before socket.h. Apparently, MAC OS X doesn't compile socket.h otherwise. v0.63 Suggestion by RCW: Add -lm at line 70 of Configure.in. On my system no ill effects ensued, so this version released so that he can test if it still works on his system. Let me add that it's stupid that I have to specify that this this program now requires Automake version 1.5 to build, where Automake was intended to make software independent of different versions of build software! For those concerned about the above statement: If you're just trying to compile and use MTR, there is no need for automake. Just when you're messing with the configure and build system of mtr is automake a tool you need. v0.62 Apparently someone changed gethostbyname into gethostbyname2 in mtr.c in an attempt to add IPV6 support. For systems without ipv6 support, the old gethostbyname should be used! Linux has the call even if you don't enable IPV6. Thanks Gary (rsub) v0.61 Attempt to get/print the local IP address. Now shows as 0.0.0.0 :-( Hints and tips appreciated! -- REW Lots of blank space reformatting. moved the interface address setting to net.c (where it belongs). v0.60 John Thacker submitted a surprisingly simple patch to enable linking against GTK2. (up to 2.4.0) v0.59 Josh Martin suggested to add some bounds checking to the dynamic field code. This caused me to delve in, and rewrite some things. Now 50 lines of code less, but cleaner code. :-) v0.58 I don't remember. Forgot to update this. :-( Check the patch. v0.57 Lots of whitespace cleanups. And a DNS fix: Don't do DNS lookups in raw mode with -n specified. v0.56 Fixed compile warnings. Now compiles with -Wall. If your compiler finds things mine didn't feel free to shout. v0.55 Cleanup patch. I'm going to do some maintenance on MTR, but I want to be able to say: Can you see which version fixed/broke things for you, so you're going to see a bunch of new releases soon. v0.54 Added "scrolling" patch from Roland Illig, to allow scrolling in text mode. I've always wanted this...... v0.53 Added fix for raw mode. v0.52 Mostly cleanups from Brett Johnson on MacOS X. It may clean up some compilation problems on MacOS X as well. v0.51 Fixed the bug introduced by the previous select loop fix... Thanks Evgeniy v0.50 Make "interface address" option work. Changes to "select" loop to allow window resizes (select interruption) to work. Thanks Mike! v0.49 Fix compilation problems on several platforms. v0.48 Draw names in red (GTK) or bold (Curses) if host doesn't respond. v0.47 Fixed a (believed-) non-exploitable buffer overflow. Thanks Damian. v0.46 Included patch to be able to specify outgoing interface address. v0.45 People are pressuring me to release new versions with their changes. That's fine. Now this version just adds dynamic switching between numeric / dns names, and some minor stuff I forgot. This release serves as a code-sync-release. new version with even more new stuff in about two weeks! I'm afraid I don't know how to fix the MacOS-X compilation problems in the source. Help wanted... v0.44 David Stone adds the "last" column to the gtk version. v0.43 Compile fixes. v0.41 Added afr's patch to allow disabling of gtk without Robn's hack. Made report mode report the newly added extra resolution. v0.40 Fixed some problems with HPUX and SunOS. Included Olav Kvittem's patch to do packetsize option. Made the timekeeping in micro seconds. v0.39 Forgot the parentheses around the previous fix... :-( v0.38 fixed some dubious code in dns.c (noted by someone's lint) v0.37 Added Bill Bogstad's "show the local host & time" patch. Added R. Sparks' show-last-ping patch, submitted by Philip Kizer. v0.36 Added Craigs change-the-interval-on-the-fly patch. Added Moritz Barsnick's "do something sensible if host not found" patch. Some cleanup of both Craigs and Moritz' patches. v0.35 Added Craig Milo Rogers pause/resume for GTK patch. Added Craig Milo Rogers cleanup of "reset". (restart at the beginning) Net_open used to send a first packet. After that the display-driver got a chance to distort the timing by taking its time to initialize. v0.34 Added Matt's nifty "use the icmp unreachables to do the timing" patch. Added Steve Kann's pause/resume patch. v0.33 Fixed the Linux glibc resolver problems. Fixed the off-by-one problem with -c option. v0.32 Fixed the FreeBSD bug detection stuff. v0.31 Fixed a few documentation issues. -- Matt Changed the autoconf stuff to find the resolver library on Solaris. -- REW Cleaned up the autoconf.in file a bit. -- Matt. v0.30 Fixed a typo in the changelog (NEWS) entry for 0.27. :-) added use of "MTR_OPTIONS" environment variable for defaults. v0.29 Lots of stuff. Neato overview display by David Sward. FreeBSD does wrong in the kernel the same that Solaris/x86 (see note for 0.27 does right. It forces mtr to send bad packets.... Adjusted "not too much at once" algorithm. Now probing continues as long as not more than 5 hosts are unknown. Returning packets usually allow us to do the first sweep in one go. v0.28 DNS lookups are now suppressed if you don't want them. v0.27 Fixed bug that showed up on Solaris/x86. GTK mainloop now runs as it's supposed to. v0.26 Added "-n" flag for numeric output. fixed IP numbers displaying backwards. GTK mainloop now runs at 10 packets per second. - That's too much if there are only 3 hosts - that's too little if there are 20 hosts. -> Someone tell me how to change the "ping-timeout" callback time in gtk. Can't find it in the docs. The default for "hostname" is now "localhost" so that you can start mtr without any arguments and later fill in the host you want to trace to. v0.25 Included two "raw" formats. One for separating GUI from the setuid program, and one suitable for later parsing and displaying. Volunteers wanted to separate the GTK backend. Thanks to Bertrand Leconte for contributing the format that's now called "split". v0.24 Fixed number of probes. Accidentally was counted per packet sent instead of per round of packets. v0.23 Fixed Sparc alignment problem with statmalloc v0.22 Roger has take over maintenance. mtr now uses an "int" to pass options to the kernel. Makes things work on Solaris and *BSD I'm told. mtr doesn't fire off a flurry of packets when a new second comes around. Instead they are spaced evenly around the whole second. This allows people with a relatively slow first link to do meaningful measurements of whatever is behind that. v0.21 mtr now drops root permissions after it acquires the raw sockets it needs. mtr should be a bit happier about building under SCO and Solaris. Fixed the problem with packets arriving after a reset. v0.20 The build process for mtr now uses automake. Fixed a build problem for Irix. Now uses non-blocking DNS code, so mtr can attempt to do reverse lookup on multiple hosts at once. Fewer packets are sent out each cycle, so mtr doesn't hog quite so much bandwidth. v0.19 Fixed a type-o in curses.c v0.18 Fixed the network code to work properly under FreeBSD. Hopefully this will fix some other operating systems too. Also, fixed a build problem and the DNS hanging bug. v0.17 Fixed the configure script to always like with the math library. Added an icon. v0.16 Added one #include to select.c. Some people were unable to build mtr without this line. v0.15 Both the build process and the networking code have been cleaned up and reorganized. mtr now builds cleanly with GTK+ 0.99.8. --- Below is the contents of the old "Changelog file" that annoyed some people as it didn't contain any recent changes/news. 2002-03-06 Cougar + If hop doesn't respond, draw its name in red (GTK) or bold (curses) 2002-02-09 bodq + Added --address option to bind to given IP address 2001-04-15 root + Added this file so that automake won't complain. + Commented out the test for res_init in configure.in; it does not work for GLIBC2 systems (e.g., RedHat 7+). + Fixed the subordinate CHECK_LIBS on the test for res_mkquery, so that they test for res_mkquery, not res_init. mtr-0.92/packet/0000775000175000017500000000000013114174404012532 5ustar wolffwolffmtr-0.92/packet/command.c0000664000175000017500000002601513045551745014332 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "command.h" #include #include #include #include #include #include #include #include "cmdparse.h" #include "platform.h" #include "config.h" /* Find a parameter with a particular name in a command_t structure. If no such parameter exists, return NULL. */ static const char *find_parameter( const struct command_t *command, const char *name_request) { const char *name; const char *value; int i; for (i = 0; i < command->argument_count; i++) { name = command->argument_name[i]; value = command->argument_value[i]; if (!strcmp(name, name_request)) { return value; } } return NULL; } /* Returns a feature support string for a particular probe protocol */ static const char *check_protocol_support( struct net_state_t *net_state, int protocol) { if (is_protocol_supported(net_state, protocol)) { return "ok"; } else { return "no"; } } /* Return a feature support string for an IP protocol version */ static const char *check_ip_version_support( struct net_state_t *net_state, int ip_version) { if (is_ip_version_supported(net_state, ip_version)) { return "ok"; } else { return "no"; } } /* Given a feature name, return a string for the check-support reply */ static const char *check_support( const char *feature, struct net_state_t *net_state) { if (!strcmp(feature, "version")) { return PACKAGE_VERSION; } if (!strcmp(feature, "ip-4")) { return check_ip_version_support(net_state, 4); } if (!strcmp(feature, "ip-6")) { return check_ip_version_support(net_state, 6); } if (!strcmp(feature, "send-probe")) { return "ok"; } if (!strcmp(feature, "icmp")) { return check_protocol_support(net_state, IPPROTO_ICMP); } if (!strcmp(feature, "udp")) { return check_protocol_support(net_state, IPPROTO_UDP); } if (!strcmp(feature, "tcp")) { return check_protocol_support(net_state, IPPROTO_TCP); } #ifdef IPPROTO_SCTP if (!strcmp(feature, "sctp")) { return check_protocol_support(net_state, IPPROTO_SCTP); } #endif #ifdef SO_MARK if (!strcmp(feature, "mark")) { return "ok"; } #endif return "no"; } /* Handle a check-support request by checking for a particular feature */ static void check_support_command( const struct command_t *command, struct net_state_t *net_state) { const char *feature; const char *support; feature = find_parameter(command, "feature"); if (feature == NULL) { printf("%d invalid-argument\n", command->token); return; } support = check_support(feature, net_state); printf("%d feature-support support %s\n", command->token, support); } /* If a named send_probe argument is recognized, fill in the probe paramters structure with the argument value. */ static bool decode_probe_argument( struct probe_param_t *param, const char *name, const char *value) { char *endstr = NULL; /* Pass IPv4 addresses as string values */ if (!strcmp(name, "ip-4")) { param->ip_version = 4; param->remote_address = value; } /* IPv6 address */ if (!strcmp(name, "ip-6")) { param->ip_version = 6; param->remote_address = value; } /* IPv4 address to send from */ if (!strcmp(name, "local-ip-4")) { param->local_address = value; } /* IPv6 address to send from */ if (!strcmp(name, "local-ip-6")) { param->local_address = value; } /* Protocol for the probe */ if (!strcmp(name, "protocol")) { if (!strcmp(value, "icmp")) { param->protocol = IPPROTO_ICMP; } else if (!strcmp(value, "udp")) { param->protocol = IPPROTO_UDP; } else if (!strcmp(value, "tcp")) { param->protocol = IPPROTO_TCP; #ifdef IPPROTO_SCTP } else if (!strcmp(value, "sctp")) { param->protocol = IPPROTO_SCTP; #endif } else { return false; } } /* Destination port for the probe */ if (!strcmp(name, "port")) { param->dest_port = strtol(value, &endstr, 10); if (*endstr != 0) { return false; } } /* The local port to send UDP probes from */ if (!strcmp(name, "local-port")) { param->local_port = strtol(value, &endstr, 10); if (*endstr != 0) { return false; } /* Don't allow using a local port which requires privileged binding. */ if (param->local_port < 1024) { param->local_port = 0; return false; } } /* The "type of service" field for the IP header */ if (!strcmp(name, "tos")) { param->type_of_service = strtol(value, &endstr, 10); if (*endstr != 0) { return false; } } /* The Linux packet mark for mark-based routing */ if (!strcmp(name, "mark")) { param->routing_mark = strtol(value, &endstr, 10); if (*endstr != 0) { return false; } } /* The size of the packet (including headers) */ if (!strcmp(name, "size")) { param->packet_size = strtol(value, &endstr, 10); if (*endstr != 0) { return false; } } /* The packet's bytes will be filled with this value */ if (!strcmp(name, "bit-pattern")) { param->bit_pattern = strtol(value, &endstr, 10); if (*endstr != 0) { return false; } } /* Time-to-live values */ if (!strcmp(name, "ttl")) { param->ttl = strtol(value, &endstr, 10); if (*endstr != 0) { return false; } } /* Number of seconds to wait for a reply */ if (!strcmp(name, "timeout")) { param->timeout = strtol(value, &endstr, 10); if (*endstr != 0) { return false; } } return true; } /* Check the probe parameters against currently supported features and report and error if there is a problem. Return true if everything is okay, false otherwise. */ static bool validate_probe_parameters( struct net_state_t *net_state, struct probe_param_t *param) { if (!is_ip_version_supported(net_state, param->ip_version)) { printf("%d invalid-argument reason ip-version-not-supported\n", param->command_token); return false; } if (!is_protocol_supported(net_state, param->protocol)) { printf("%d invalid-argument reason protocol-not-supported\n", param->command_token); return false; } return true; } /* Handle "send-probe" commands */ static void send_probe_command( const struct command_t *command, struct net_state_t *net_state) { struct probe_param_t param; int i; char *name; char *value; /* We will prepare a probe_param_t for send_probe. */ memset(¶m, 0, sizeof(struct probe_param_t)); param.command_token = command->token; param.protocol = IPPROTO_ICMP; param.ttl = 255; param.packet_size = 64; param.timeout = 10; for (i = 0; i < command->argument_count; i++) { name = command->argument_name[i]; value = command->argument_value[i]; if (!decode_probe_argument(¶m, name, value)) { printf("%d invalid-argument\n", command->token); return; } } if (!validate_probe_parameters(net_state, ¶m)) { return; } /* Send the probe using a platform specific mechanism */ send_probe(net_state, ¶m); } /* Given a parsed command, dispatch to the handler for specific command requests. */ static void dispatch_command( const struct command_t *command, struct net_state_t *net_state) { if (!strcmp(command->command_name, "check-support")) { check_support_command(command, net_state); } else if (!strcmp(command->command_name, "send-probe")) { send_probe_command(command, net_state); } else { /* For unrecognized commands, respond with an error */ printf("%d unknown-command\n", command->token); } } /* With newly read data in our command buffer, dispatch all completed command requests. */ void dispatch_buffer_commands( struct command_buffer_t *buffer, struct net_state_t *net_state) { struct command_t command; char *end_of_command; char full_command[COMMAND_BUFFER_SIZE]; int command_length; int remaining_count; while (true) { assert(buffer->incoming_read_position < COMMAND_BUFFER_SIZE); /* Terminate the buffer string */ buffer->incoming_buffer[buffer->incoming_read_position] = 0; /* Find the next newline, which terminates command requests */ end_of_command = index(buffer->incoming_buffer, '\n'); if (end_of_command == NULL) { /* No newlines found, so any data we've read so far is not yet complete. */ break; } command_length = end_of_command - buffer->incoming_buffer; remaining_count = buffer->incoming_read_position - command_length - 1; /* Copy the completed command */ memmove(full_command, buffer->incoming_buffer, command_length); full_command[command_length] = 0; /* Free the space used by the completed command by advancing the remaining requests within the buffer. */ memmove(buffer->incoming_buffer, end_of_command + 1, remaining_count); buffer->incoming_read_position -= command_length + 1; if (parse_command(&command, full_command)) { /* If the command fails to parse, respond with an error */ printf("0 command-parse-error\n"); } else { dispatch_command(&command, net_state); } } if (buffer->incoming_read_position >= COMMAND_BUFFER_SIZE - 1) { /* If we've filled the buffer without a complete command, the only thing we can do is discard what we've read and hope that new data is better formatted. */ printf("0 command-buffer-overflow\n"); buffer->incoming_read_position = 0; } } mtr-0.92/packet/timeval.h0000664000175000017500000000161713031772644014361 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef TIMEVAL_H #define TIMEVAL_H #include void normalize_timeval( struct timeval *timeval); int compare_timeval( struct timeval a, struct timeval b); #endif mtr-0.92/packet/probe.h0000664000175000017500000001200013045551745014015 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef PROBE_H #define PROBE_H #include "platform.h" #include #include #include #include #include "portability/queue.h" #ifdef PLATFORM_CYGWIN #include "probe_cygwin.h" #else #include "probe_unix.h" #endif #define MAX_PROBES 1024 /* Use the "jumbo" frame size as the max packet size */ #define PACKET_BUFFER_SIZE 9000 /* Parameters for sending a new probe */ struct probe_param_t { /* The version of the Internet Protocol to use. (4 or 6) */ int ip_version; /* The command token used to identify a probe when it is completed */ int command_token; /* The IP address to probe */ const char *remote_address; /* The local address from which to send probes */ const char *local_address; /* Protocol for the probe, using the IPPROTO_* defines */ int protocol; /* The destination port for non-ICMP probes */ int dest_port; /* The local port number to use when sending probes */ int local_port; /* The "type of service" field in the IP header */ int type_of_service; /* The packet "mark" used for mark-based routing on Linux */ int routing_mark; /* Time to live for the transmited probe */ int ttl; /* The packet size (in bytes) including protocol headers */ int packet_size; /* The value with which to fill the bytes of the packet. */ int bit_pattern; /* The number of seconds to wait before assuming the probe was lost */ int timeout; }; /* Tracking information for an outstanding probe */ struct probe_t { /* Our entry in the probe list */ LIST_ENTRY( probe_t) probe_list_entry; /* Also the ICMP sequence ID used to identify the probe. Also used as the port number to use when binding stream protocol sockets for this probe. (i.e. TCP or SCTP) */ int sequence; /* Command token of the probe request */ int token; /* The address being probed */ struct sockaddr_storage remote_addr; /* Platform specific probe tracking */ struct probe_platform_t platform; }; /* Global state for interacting with the network */ struct net_state_t { /* The number of entries in the outstanding_probes list */ int outstanding_probe_count; /* Tracking information for in-flight probes */ LIST_HEAD( probe_list_head_t, probe_t) outstanding_probes; /* Platform specific tracking information */ struct net_state_platform_t platform; }; /* Multiprotocol Label Switching information */ struct mpls_label_t { uint32_t label; uint8_t experimental_use; uint8_t bottom_of_stack; uint8_t ttl; }; void init_net_state_privileged( struct net_state_t *net_state); void init_net_state( struct net_state_t *net_state); bool is_ip_version_supported( struct net_state_t *net_state, int ip_version); bool is_protocol_supported( struct net_state_t *net_state, int protocol); bool get_next_probe_timeout( const struct net_state_t *net_state, struct timeval *timeout); void send_probe( struct net_state_t *net_state, const struct probe_param_t *param); void receive_replies( struct net_state_t *net_state); void check_probe_timeouts( struct net_state_t *net_state); void respond_to_probe( struct net_state_t *net_state, struct probe_t *probe, int icmp_type, const struct sockaddr_storage *remote_addr, unsigned int round_trip_us, int mpls_count, const struct mpls_label_t *mpls); int decode_address_string( int ip_version, const char *address_string, struct sockaddr_storage *address); int resolve_probe_addresses( const struct probe_param_t *param, struct sockaddr_storage *dest_sockaddr, struct sockaddr_storage *src_sockaddr); struct probe_t *alloc_probe( struct net_state_t *net_state, int token); void free_probe( struct net_state_t *net_state, struct probe_t *probe); void platform_alloc_probe( struct net_state_t *net_state, struct probe_t *probe); void platform_free_probe( struct probe_t *probe); struct probe_t *find_probe( struct net_state_t *net_state, int protocol, int icmp_id, int icmp_sequence); int find_source_addr( struct sockaddr_storage *srcaddr, const struct sockaddr_storage *destaddr); #endif mtr-0.92/packet/wait_cygwin.c0000664000175000017500000000352313045551745015237 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "wait.h" #include #include #include #include "command.h" /* Sleep until we receive a new probe response, a new command on the command stream, or a probe timeout. On Windows, this means that we will sleep with an alertable wait, as all of these conditions use I/O completion routines as notifications of these events. */ void wait_for_activity( struct command_buffer_t *command_buffer, struct net_state_t *net_state) { DWORD wait_result; /* Start the command read overlapped I/O just prior to sleeping. During development of the Cygwin port, there was a bug where the overlapped I/O was started earlier in the mtr-packet loop, and an intermediate alertable wait could leave us in this Sleep without an active command read. So now we do this here, instead. */ start_read_command(command_buffer); /* Sleep until an I/O completion routine runs */ wait_result = SleepEx(INFINITE, TRUE); if (wait_result == WAIT_FAILED) { fprintf(stderr, "SleepEx failure %d\n", GetLastError()); exit(EXIT_FAILURE); } } mtr-0.92/packet/packet.c0000664000175000017500000000661413045551745014166 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include #include #include #include #include #ifdef HAVE_LIBCAP #include #endif #include "wait.h" /* Drop SUID privileges. To be used after accquiring raw sockets. */ static int drop_elevated_permissions( void) { #ifdef HAVE_LIBCAP cap_t cap; #endif /* Drop any suid permissions granted */ if (setgid(getgid()) || setuid(getuid())) { return -1; } if (geteuid() != getuid() || getegid() != getgid()) { return -1; } /* Drop all process capabilities. This will revoke anything granted by a commandline 'setcap' */ #ifdef HAVE_LIBCAP cap = cap_get_proc(); if (cap == NULL) { return -1; } if (cap_clear(cap)) { return -1; } if (cap_set_proc(cap)) { return -1; } #endif return 0; } int main( int argc, char **argv) { bool command_pipe_open; struct command_buffer_t command_buffer; struct net_state_t net_state; /* To minimize security risk, the only thing done prior to dropping SUID should be opening the network state for raw sockets. */ init_net_state_privileged(&net_state); if (drop_elevated_permissions()) { perror("Unable to drop elevated permissions"); exit(EXIT_FAILURE); } init_net_state(&net_state); init_command_buffer(&command_buffer, fileno(stdin)); command_pipe_open = true; /* Dispatch commands and respond to probe replies until the command stream is closed. */ while (true) { /* Ensure any responses are written before waiting */ fflush(stdout); wait_for_activity(&command_buffer, &net_state); /* Receive replies first so that the timestamps are as close to the response arrival time as possible. */ receive_replies(&net_state); if (command_pipe_open) { if (read_commands(&command_buffer)) { if (errno == EPIPE) { command_pipe_open = false; } } } check_probe_timeouts(&net_state); /* Dispatch commands late so that the window between probe departure and arriving replies is as small as possible. */ dispatch_buffer_commands(&command_buffer, &net_state); /* If the command pipe has been closed, exit after all in-flight probes have reported their status. */ if (!command_pipe_open) { if (net_state.outstanding_probe_count == 0) { break; } } } return 0; } mtr-0.92/packet/wait.h0000664000175000017500000000161313031772644013660 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef WAIT_H #define WAIT_H #include "command.h" #include "probe.h" void wait_for_activity( struct command_buffer_t *command_buffer, struct net_state_t *net_state); #endif mtr-0.92/packet/cmdparse.h0000664000175000017500000000274413045551745014522 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef CMDPARSE_H #define CMDPARSE_H enum { MAX_COMMAND_ARGUMENTS = 16, MAX_COMMAND_TOKENS = MAX_COMMAND_ARGUMENTS * 2 + 2 }; /* Parsed commands, or command replies, ready for semantic interpretation */ struct command_t { /* A unique value for matching command requests with replies */ int token; /* Text indiciating the command type, or reply type */ char *command_name; /* The number of key, value argument pairs used */ int argument_count; /* Names for each argument */ char *argument_name[MAX_COMMAND_ARGUMENTS]; /* Values for each argument, parallel to the argument_name array */ char *argument_value[MAX_COMMAND_ARGUMENTS]; }; int parse_command( struct command_t *command, char *command_string); #endif mtr-0.92/packet/probe_unix.h0000664000175000017500000000513013045551745015066 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef PROBE_UNIX_H #define PROBE_UNIX_H /* The range of local port numbers to use for probes */ #define MIN_PORT 33000 #define MAX_PORT 65535 /* We need to track the transmission and timeouts on Unix systems */ struct probe_platform_t { /* The socket for the outgoing connection (used by TCP probes) */ int socket; /* The time at which the probe is considered lost */ struct timeval timeout_time; /* The time at which the probe was sent */ struct timeval departure_time; }; /* We'll use rack sockets to send and recieve probes on Unix systems */ struct net_state_platform_t { /* true if we were successful at opening IPv4 sockets */ bool ip4_present; /* true if we were successful at opening IPv6 sockets */ bool ip6_present; /* Socket used to send raw IPv4 packets */ int ip4_send_socket; /* Socket used to receive IPv4 ICMP replies */ int ip4_recv_socket; /* Send socket for ICMPv6 packets */ int icmp6_send_socket; /* Send socket for UDPv6 packets */ int udp6_send_socket; /* Receive socket for IPv6 packets */ int ip6_recv_socket; /* true if we should encode the IP header length in host order. (as opposed to network order) */ bool ip_length_host_order; /* true if the operating system supports SCTP sockets */ bool sctp_support; /* The next port number to use when creating a new probe */ int next_sequence; }; struct net_state_t; struct probe_t; struct mpls_label_t; void set_socket_nonblocking( int socket); void receive_probe( struct net_state_t *net_state, struct probe_t *probe, int icmp_type, const struct sockaddr_storage *remote_addr, struct timeval *timestamp, int mpls_count, struct mpls_label_t *mpls); int gather_probe_sockets( const struct net_state_t *net_state, fd_set * write_set); #endif mtr-0.92/packet/platform.h0000664000175000017500000000223313031772644014537 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef PLATFORM_H #define PLATFORM_H /* Determine the most appropriate PLATFORM_* define for our current target. */ #if defined(__CYGWIN__) #define PLATFORM_CYGWIN #elif defined(__APPLE__) && defined(__MACH__) #define PLATFORM_OS_X #elif defined(__gnu_linux__) #define PLATFORM_LINUX #elif defined (__FreeBSD__) #define PLATFORM_FREEBSD #elif defined(__unix__) #define PLATFORM_UNIX_UNKNOWN #else #error Unsupported platform #endif #endif mtr-0.92/packet/deconstruct_unix.c0000664000175000017500000003643413045551745016322 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "deconstruct_unix.h" #include #include #include #include "protocols.h" #define MAX_MPLS_LABELS 8 /* Given an ICMP id + ICMP sequence, find the match probe we've transmitted and if found, respond to the command which sent it */ static void find_and_receive_probe( struct net_state_t *net_state, const struct sockaddr_storage *remote_addr, struct timeval *timestamp, int icmp_type, int protocol, int icmp_id, int icmp_sequence, int mpls_count, struct mpls_label_t *mpls) { struct probe_t *probe; probe = find_probe(net_state, protocol, icmp_id, icmp_sequence); if (probe == NULL) { return; } receive_probe(net_state, probe, icmp_type, remote_addr, timestamp, mpls_count, mpls); } /* Handle a UDP packet received embedded in an ICMP reply. The sequence number identifying the probe might be in the source port number, the destination port number, or the checksum. We'll check all three. */ static void handle_inner_udp_packet( struct net_state_t *net_state, const struct sockaddr_storage *remote_addr, int icmp_result, const struct UDPHeader *udp, int udp_length, struct timeval *timestamp, int mpls_count, struct mpls_label_t *mpls) { struct probe_t *probe; probe = find_probe(net_state, IPPROTO_UDP, 0, udp->dstport); if (probe == NULL) { probe = find_probe(net_state, IPPROTO_UDP, 0, udp->srcport); } if (probe == NULL) { probe = find_probe(net_state, IPPROTO_UDP, 0, udp->checksum); } if (probe != NULL) { receive_probe(net_state, probe, icmp_result, remote_addr, timestamp, mpls_count, mpls); } } /* We've received an ICMP message with an embedded IP packet. We will try to determine which of our outgoing probes corresponds to the embedded IP packet and record the response. */ static void handle_inner_ip4_packet( struct net_state_t *net_state, const struct sockaddr_storage *remote_addr, int icmp_result, const struct IPHeader *ip, int packet_length, struct timeval *timestamp, int mpls_count, struct mpls_label_t *mpls) { const int ip_icmp_size = sizeof(struct IPHeader) + sizeof(struct ICMPHeader); const int ip_udp_size = sizeof(struct IPHeader) + sizeof(struct UDPHeader); const int ip_tcp_size = sizeof(struct IPHeader) + sizeof(struct TCPHeader); const struct ICMPHeader *icmp; const struct UDPHeader *udp; const struct TCPHeader *tcp; int udp_length; #ifdef IPPROTO_SCTP const int ip_sctp_size = sizeof(struct IPHeader) + sizeof(struct SCTPHeader); const struct SCTPHeader *sctp; #endif if (ip->protocol == IPPROTO_ICMP) { if (packet_length < ip_icmp_size) { return; } icmp = (struct ICMPHeader *) (ip + 1); find_and_receive_probe(net_state, remote_addr, timestamp, icmp_result, IPPROTO_ICMP, icmp->id, icmp->sequence, mpls_count, mpls); } else if (ip->protocol == IPPROTO_UDP) { if (packet_length < ip_udp_size) { return; } udp = (struct UDPHeader *) (ip + 1); udp_length = packet_length - sizeof(struct IPHeader); handle_inner_udp_packet(net_state, remote_addr, icmp_result, udp, udp_length, timestamp, mpls_count, mpls); } else if (ip->protocol == IPPROTO_TCP) { if (packet_length < ip_tcp_size) { return; } tcp = (struct TCPHeader *) (ip + 1); find_and_receive_probe(net_state, remote_addr, timestamp, icmp_result, IPPROTO_TCP, 0, tcp->srcport, mpls_count, mpls); #ifdef IPPROTO_SCTP } else if (ip->protocol == IPPROTO_SCTP) { if (packet_length < ip_sctp_size) { return; } sctp = (struct SCTPHeader *) (ip + 1); find_and_receive_probe(net_state, remote_addr, timestamp, icmp_result, IPPROTO_SCTP, 0, sctp->srcport, mpls_count, mpls); #endif } } /* Examine the IPv6 header embedded in a returned ICMPv6 packet in order to match it with a probe which we previously sent. */ static void handle_inner_ip6_packet( struct net_state_t *net_state, const struct sockaddr_storage *remote_addr, int icmp_result, const struct IP6Header *ip, int packet_length, struct timeval *timestamp, int mpls_count, struct mpls_label_t *mpls) { const int ip_icmp_size = sizeof(struct IP6Header) + sizeof(struct ICMPHeader); const int ip_udp_size = sizeof(struct IP6Header) + sizeof(struct UDPHeader); const int ip_tcp_size = sizeof(struct IP6Header) + sizeof(struct TCPHeader); const struct ICMPHeader *icmp; const struct UDPHeader *udp; const struct TCPHeader *tcp; int udp_length; #ifdef IPPROTO_SCTP const int ip_sctp_size = sizeof(struct IPHeader) + sizeof(struct SCTPHeader); const struct SCTPHeader *sctp; #endif if (ip->protocol == IPPROTO_ICMPV6) { if (packet_length < ip_icmp_size) { return; } icmp = (struct ICMPHeader *) (ip + 1); find_and_receive_probe(net_state, remote_addr, timestamp, icmp_result, IPPROTO_ICMP, icmp->id, icmp->sequence, mpls_count, mpls); } else if (ip->protocol == IPPROTO_UDP) { if (packet_length < ip_udp_size) { return; } udp = (struct UDPHeader *) (ip + 1); udp_length = packet_length - sizeof(struct IP6Header); handle_inner_udp_packet(net_state, remote_addr, icmp_result, udp, udp_length, timestamp, mpls_count, mpls); } else if (ip->protocol == IPPROTO_TCP) { if (packet_length < ip_tcp_size) { return; } tcp = (struct TCPHeader *) (ip + 1); find_and_receive_probe(net_state, remote_addr, timestamp, icmp_result, IPPROTO_TCP, 0, tcp->srcport, mpls_count, mpls); #ifdef IPPROTO_SCTP } else if (ip->protocol == IPPROTO_SCTP) { if (packet_length < ip_sctp_size) { return; } sctp = (struct SCTPHeader *) (ip + 1); find_and_receive_probe(net_state, remote_addr, timestamp, icmp_result, IPPROTO_SCTP, 0, sctp->srcport, mpls_count, mpls); #endif } } /* Convert an ICMP MPLS extension object into an mpls_label_t structure */ static int decode_mpls_object( struct ICMPExtensionObject *icmp_obj, int obj_len, struct mpls_label_t *mpls, int mpls_count) { int label_bytes; int labels_present; int i; struct ICMPExtMPLSLabel *ext_mpls; struct ICMPExtMPLSLabel *ext_label; struct mpls_label_t *label; label_bytes = obj_len - sizeof(struct ICMPExtensionObject); labels_present = label_bytes / sizeof(struct ICMPExtMPLSLabel); ext_mpls = (struct ICMPExtMPLSLabel *) (icmp_obj + 1); for (i = 0; i < mpls_count && i < labels_present; i++) { ext_label = &ext_mpls[i]; label = &mpls[i]; memset(label, 0, sizeof(struct mpls_label_t)); label->label = ext_label->label[0] << 12 | ext_label->label[1] << 4 | ext_label->label[2] >> 4; label->experimental_use = (ext_label->label[2] & 0x0E) >> 1; label->bottom_of_stack = ext_label->label[2] & 0x01; label->ttl = ext_label->ttl; } return i; } /* Extract MPLS labels from the ICMP extension header, if present */ static int decode_mpls_labels( const struct ICMPHeader *icmp, int packet_length, struct mpls_label_t *mpls, int mpls_count) { const int icmp_orig_icmp_ext_size = sizeof(struct ICMPHeader) + ICMP_ORIGINAL_DATAGRAM_MIN_SIZE + sizeof(struct ICMPExtensionHeader); char *inner_packet; char *icmp_object_bytes; struct ICMPExtensionHeader *icmp_ext; struct ICMPExtensionObject *icmp_obj; int remaining_size; int obj_len; if (packet_length < icmp_orig_icmp_ext_size) { return 0; } inner_packet = (char *) (icmp + 1); icmp_ext = (struct ICMPExtensionHeader *) (inner_packet + ICMP_ORIGINAL_DATAGRAM_MIN_SIZE); if ((icmp_ext->version & 0xF0) != 0x20) { return 0; } remaining_size = packet_length - icmp_orig_icmp_ext_size; icmp_object_bytes = (char *) (icmp_ext + 1); /* Iterate through the chain of extension objects, looking for an MPLS label extension. */ while (remaining_size >= sizeof(struct ICMPExtensionObject)) { icmp_obj = (struct ICMPExtensionObject *) icmp_object_bytes; obj_len = ntohs(icmp_obj->len); if (obj_len > remaining_size) { return 0; } if (obj_len < sizeof(struct ICMPExtensionObject)) { return 0; } if (icmp_obj->classnum == ICMP_EXT_MPLS_CLASSNUM && icmp_obj->ctype == ICMP_EXT_MPLS_CTYPE) { return decode_mpls_object(icmp_obj, obj_len, mpls, mpls_count); } remaining_size -= obj_len; icmp_object_bytes += obj_len; } return 0; } /* Decode the ICMP header received and try to find a probe which it is in response to. */ static void handle_received_icmp4_packet( struct net_state_t *net_state, const struct sockaddr_storage *remote_addr, const struct ICMPHeader *icmp, int packet_length, struct timeval *timestamp) { const int icmp_ip_size = sizeof(struct ICMPHeader) + sizeof(struct IPHeader); const struct IPHeader *inner_ip; int inner_size = packet_length - sizeof(struct ICMPHeader); int mpls_count; struct mpls_label_t mpls[MAX_MPLS_LABELS]; mpls_count = decode_mpls_labels(icmp, packet_length, mpls, MAX_MPLS_LABELS); /* If we get an echo reply, our probe reached the destination host */ if (icmp->type == ICMP_ECHOREPLY) { find_and_receive_probe(net_state, remote_addr, timestamp, ICMP_ECHOREPLY, IPPROTO_ICMP, icmp->id, icmp->sequence, mpls_count, mpls); } if (packet_length < icmp_ip_size) { return; } inner_ip = (struct IPHeader *) (icmp + 1); /* If we get a time exceeded, we got a response from an intermediate host along the path to our destination. */ if (icmp->type == ICMP_TIME_EXCEEDED) { /* The IP packet inside the ICMP response contains our original IP header. That's where we can get our original ID and sequence number. */ handle_inner_ip4_packet(net_state, remote_addr, ICMP_TIME_EXCEEDED, inner_ip, inner_size, timestamp, mpls_count, mpls); } if (icmp->type == ICMP_DEST_UNREACH) { /* We'll get a ICMP_PORT_UNREACH when a non-ICMP probe reaches its final destination. (Assuming that port isn't open on the destination host.) */ if (icmp->code == ICMP_PORT_UNREACH) { handle_inner_ip4_packet(net_state, remote_addr, ICMP_ECHOREPLY, inner_ip, inner_size, timestamp, mpls_count, mpls); } } } /* Decode the ICMPv6 header. The code duplication with ICMPv4 is unfortunate, but small details in structure size and ICMP constants differ. */ static void handle_received_icmp6_packet( struct net_state_t *net_state, const struct sockaddr_storage *remote_addr, const struct ICMPHeader *icmp, int packet_length, struct timeval *timestamp) { const int icmp_ip_size = sizeof(struct ICMPHeader) + sizeof(struct IP6Header); const struct IP6Header *inner_ip; int inner_size = packet_length - sizeof(struct ICMPHeader); int mpls_count; struct mpls_label_t mpls[MAX_MPLS_LABELS]; mpls_count = decode_mpls_labels(icmp, packet_length, mpls, MAX_MPLS_LABELS); if (icmp->type == ICMP6_ECHOREPLY) { find_and_receive_probe(net_state, remote_addr, timestamp, ICMP_ECHOREPLY, IPPROTO_ICMP, icmp->id, icmp->sequence, mpls_count, mpls); } if (packet_length < icmp_ip_size) { return; } inner_ip = (struct IP6Header *) (icmp + 1); if (icmp->type == ICMP6_TIME_EXCEEDED) { handle_inner_ip6_packet(net_state, remote_addr, ICMP_TIME_EXCEEDED, inner_ip, inner_size, timestamp, mpls_count, mpls); } if (icmp->type == ICMP6_DEST_UNREACH) { if (icmp->code == ICMP6_PORT_UNREACH) { handle_inner_ip6_packet(net_state, remote_addr, ICMP_ECHOREPLY, inner_ip, inner_size, timestamp, mpls_count, mpls); } } } /* We've received a new IPv4 ICMP packet. We'll check to see that it is a response to one of our probes, and if so, report the result of the probe to our command stream. */ void handle_received_ip4_packet( struct net_state_t *net_state, const struct sockaddr_storage *remote_addr, const void *packet, int packet_length, struct timeval *timestamp) { const int ip_icmp_size = sizeof(struct IPHeader) + sizeof(struct ICMPHeader); const struct IPHeader *ip; const struct ICMPHeader *icmp; int icmp_length; /* Ensure that we don't access memory beyond the bounds of the packet */ if (packet_length < ip_icmp_size) { return; } ip = (struct IPHeader *) packet; if (ip->protocol != IPPROTO_ICMP) { return; } icmp = (struct ICMPHeader *) (ip + 1); icmp_length = packet_length - sizeof(struct IPHeader); handle_received_icmp4_packet(net_state, remote_addr, icmp, icmp_length, timestamp); } /* Unlike ICMPv6 raw sockets, unlike ICMPv4, don't include the IP header in received packets, so we can assume the packet we got starts with the ICMP packet. */ void handle_received_ip6_packet( struct net_state_t *net_state, const struct sockaddr_storage *remote_addr, const void *packet, int packet_length, struct timeval *timestamp) { const struct ICMPHeader *icmp; icmp = (struct ICMPHeader *) packet; handle_received_icmp6_packet(net_state, remote_addr, icmp, packet_length, timestamp); } mtr-0.92/packet/deconstruct_unix.h0000664000175000017500000000256613045551745016326 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef DECONSTRUCT_H #define DECONSTRUCT_H #include "probe.h" typedef void ( *received_packet_func_t) ( struct net_state_t * net_state, const struct sockaddr_storage * remote_addr, const void *packet, int packet_length, struct timeval * timestamp); void handle_received_ip4_packet( struct net_state_t *net_state, const struct sockaddr_storage *remote_addr, const void *packet, int packet_length, struct timeval *timestamp); void handle_received_ip6_packet( struct net_state_t *net_state, const struct sockaddr_storage *remote_addr, const void *packet, int packet_length, struct timeval *timestamp); #endif mtr-0.92/packet/probe.c0000664000175000017500000002251613045551745014025 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "probe.h" #include #include #include #include #include #include #include #include #include "command.h" #include "platform.h" #include "protocols.h" #include "timeval.h" #define IP_TEXT_LENGTH 64 /* Convert the destination address from text to sockaddr */ int decode_address_string( int ip_version, const char *address_string, struct sockaddr_storage *address) { struct in_addr addr4; struct in6_addr addr6; struct sockaddr_in *sockaddr4; struct sockaddr_in6 *sockaddr6; if (address == NULL) { errno = EINVAL; return -1; } if (ip_version == 6) { sockaddr6 = (struct sockaddr_in6 *) address; if (inet_pton(AF_INET6, address_string, &addr6) != 1) { errno = EINVAL; return -1; } sockaddr6->sin6_family = AF_INET6; sockaddr6->sin6_port = 0; sockaddr6->sin6_flowinfo = 0; sockaddr6->sin6_addr = addr6; sockaddr6->sin6_scope_id = 0; } else if (ip_version == 4) { sockaddr4 = (struct sockaddr_in *) address; if (inet_pton(AF_INET, address_string, &addr4) != 1) { errno = EINVAL; return -1; } sockaddr4->sin_family = AF_INET; sockaddr4->sin_port = 0; sockaddr4->sin_addr = addr4; } else { errno = EINVAL; return -1; } return 0; } /* Resolve the probe parameters into a remote and local address for the probe. */ int resolve_probe_addresses( const struct probe_param_t *param, struct sockaddr_storage *dest_sockaddr, struct sockaddr_storage *src_sockaddr) { if (decode_address_string (param->ip_version, param->remote_address, dest_sockaddr)) { return -1; } if (param->local_address) { if (decode_address_string (param->ip_version, param->local_address, src_sockaddr)) { return -1; } } else { if (find_source_addr(src_sockaddr, dest_sockaddr)) { return -1; } } return 0; } /* Allocate a structure for tracking a new probe */ struct probe_t *alloc_probe( struct net_state_t *net_state, int token) { struct probe_t *probe; if (net_state->outstanding_probe_count >= MAX_PROBES) { return NULL; } probe = malloc(sizeof(struct probe_t)); if (probe == NULL) { return NULL; } memset(probe, 0, sizeof(struct probe_t)); probe->token = token; platform_alloc_probe(net_state, probe); net_state->outstanding_probe_count++; LIST_INSERT_HEAD(&net_state->outstanding_probes, probe, probe_list_entry); return probe; } /* Mark a probe tracking structure as unused */ void free_probe( struct net_state_t *net_state, struct probe_t *probe) { LIST_REMOVE(probe, probe_list_entry); net_state->outstanding_probe_count--; platform_free_probe(probe); free(probe); } /* Find an existing probe structure by ICMP id and sequence number. Returns NULL if non is found. */ struct probe_t *find_probe( struct net_state_t *net_state, int protocol, int id, int sequence) { struct probe_t *probe; /* ICMP has room for an id to check against our process, but UDP doesn't. */ if (protocol == IPPROTO_ICMP) { /* If the ICMP id doesn't match our process ID, it wasn't a probe generated by this process, so ignore it. */ if (id != htons(getpid())) { return NULL; } } LIST_FOREACH(probe, &net_state->outstanding_probes, probe_list_entry) { if (htons(probe->sequence) == sequence) { return probe; } } return NULL; } /* Format a list of MPLS labels into a string appropriate for including as an argument to a probe reply. */ static void format_mpls_string( char *str, int buffer_size, int mpls_count, const struct mpls_label_t *mpls_list) { int i; char *append_pos = str; const struct mpls_label_t *mpls; /* Start with an empty string */ str[0] = 0; for (i = 0; i < mpls_count; i++) { mpls = &mpls_list[i]; if (i > 0) { strncat(append_pos, ",", buffer_size - 1); buffer_size -= strlen(append_pos); append_pos += strlen(append_pos); } snprintf(append_pos, buffer_size, "%d,%d,%d,%d", mpls->label, mpls->experimental_use, mpls->bottom_of_stack, mpls->ttl); buffer_size -= strlen(append_pos); append_pos += strlen(append_pos); } } /* After a probe reply has arrived, respond to the command request which sent the probe. */ void respond_to_probe( struct net_state_t *net_state, struct probe_t *probe, int icmp_type, const struct sockaddr_storage *remote_addr, unsigned int round_trip_us, int mpls_count, const struct mpls_label_t *mpls) { char ip_text[IP_TEXT_LENGTH]; char response[COMMAND_BUFFER_SIZE]; char mpls_str[COMMAND_BUFFER_SIZE]; int remaining_size; const char *result; const char *ip_argument; struct sockaddr_in *sockaddr4; struct sockaddr_in6 *sockaddr6; void *addr; if (icmp_type == ICMP_TIME_EXCEEDED) { result = "ttl-expired"; } else { assert(icmp_type == ICMP_ECHOREPLY); result = "reply"; } if (remote_addr->ss_family == AF_INET6) { ip_argument = "ip-6"; sockaddr6 = (struct sockaddr_in6 *) remote_addr; addr = &sockaddr6->sin6_addr; } else { ip_argument = "ip-4"; sockaddr4 = (struct sockaddr_in *) remote_addr; addr = &sockaddr4->sin_addr; } if (inet_ntop(remote_addr->ss_family, addr, ip_text, IP_TEXT_LENGTH) == NULL) { perror("inet_ntop failure"); exit(EXIT_FAILURE); } snprintf(response, COMMAND_BUFFER_SIZE, "%d %s %s %s round-trip-time %d", probe->token, result, ip_argument, ip_text, round_trip_us); if (mpls_count) { format_mpls_string(mpls_str, COMMAND_BUFFER_SIZE, mpls_count, mpls); remaining_size = COMMAND_BUFFER_SIZE - strlen(response) - 1; strncat(response, " mpls ", remaining_size); remaining_size = COMMAND_BUFFER_SIZE - strlen(response) - 1; strncat(response, mpls_str, remaining_size); } puts(response); free_probe(net_state, probe); } /* Find the source address for transmitting to a particular destination address. Remember that hosts can have multiple addresses, for example a unique address for each network interface. So we will bind a UDP socket to our destination and check the socket address after binding to get the source for that destination, which will allow the kernel to do the routing table work for us. (connecting UDP sockets, unlike TCP sockets, doesn't transmit any packets. It's just an association.) */ int find_source_addr( struct sockaddr_storage *srcaddr, const struct sockaddr_storage *destaddr) { int sock; int len; struct sockaddr_in *destaddr4; struct sockaddr_in6 *destaddr6; struct sockaddr_storage dest_with_port; struct sockaddr_in *srcaddr4; struct sockaddr_in6 *srcaddr6; dest_with_port = *destaddr; /* MacOS requires a non-zero sin_port when used as an address for a UDP connect. If we provide a zero port, the connect will fail. We aren't actually sending anything to the port. */ if (destaddr->ss_family == AF_INET6) { destaddr6 = (struct sockaddr_in6 *) &dest_with_port; destaddr6->sin6_port = htons(1); len = sizeof(struct sockaddr_in6); } else { destaddr4 = (struct sockaddr_in *) &dest_with_port; destaddr4->sin_port = htons(1); len = sizeof(struct sockaddr_in); } sock = socket(destaddr->ss_family, SOCK_DGRAM, IPPROTO_UDP); if (sock == -1) { return -1; } if (connect(sock, (struct sockaddr *) &dest_with_port, len)) { close(sock); return -1; } if (getsockname(sock, (struct sockaddr *) srcaddr, &len)) { close(sock); return -1; } close(sock); /* Zero the port, as we may later use this address to finding, and we don't want to use the port from the socket we just created. */ if (destaddr->ss_family == AF_INET6) { srcaddr6 = (struct sockaddr_in6 *) srcaddr; srcaddr6->sin6_port = 0; } else { srcaddr4 = (struct sockaddr_in *) srcaddr; srcaddr4->sin_port = 0; } return 0; } mtr-0.92/packet/construct_unix.c0000664000175000017500000004473513045551745016014 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "construct_unix.h" #include #include #include #include #include #include "protocols.h" /* A source of data for computing a checksum */ struct checksum_source_t { const void *data; size_t size; }; /* Compute the IP checksum (or ICMP checksum) of a packet. */ static uint16_t compute_checksum( const void *packet, int size) { const uint8_t *packet_bytes = (uint8_t *) packet; uint32_t sum = 0; int i; for (i = 0; i < size; i++) { if ((i & 1) == 0) { sum += packet_bytes[i] << 8; } else { sum += packet_bytes[i]; } } /* Sums which overflow a 16-bit value have the high bits added back into the low 16 bits. */ while (sum >> 16) { sum = (sum >> 16) + (sum & 0xffff); } /* The value stored is the one's complement of the mathematical sum. */ return (~sum & 0xffff); } /* Encode the IP header length field in the order required by the OS. */ static uint16_t length_byte_swap( const struct net_state_t *net_state, uint16_t length) { if (net_state->platform.ip_length_host_order) { return length; } else { return htons(length); } } /* Construct a combined sockaddr from a source address and source port */ static void construct_addr_port( struct sockaddr_storage *addr_with_port, const struct sockaddr_storage *addr, int port) { struct sockaddr_in *addr4; struct sockaddr_in6 *addr6; memcpy(addr_with_port, addr, sizeof(struct sockaddr_storage)); if (addr->ss_family == AF_INET6) { addr6 = (struct sockaddr_in6 *) addr_with_port; addr6->sin6_port = htons(port); } else { addr4 = (struct sockaddr_in *) addr_with_port; addr4->sin_port = htons(port); } } /* Construct a header for IP version 4 */ static void construct_ip4_header( const struct net_state_t *net_state, char *packet_buffer, int packet_size, const struct sockaddr_storage *srcaddr, const struct sockaddr_storage *destaddr, const struct probe_param_t *param) { struct IPHeader *ip; struct sockaddr_in *srcaddr4 = (struct sockaddr_in *) srcaddr; struct sockaddr_in *destaddr4 = (struct sockaddr_in *) destaddr; ip = (struct IPHeader *) &packet_buffer[0]; memset(ip, 0, sizeof(struct IPHeader)); ip->version = 0x45; ip->tos = param->type_of_service; ip->len = length_byte_swap(net_state, packet_size); ip->ttl = param->ttl; ip->protocol = param->protocol; memcpy(&ip->saddr, &srcaddr4->sin_addr, sizeof(uint32_t)); memcpy(&ip->daddr, &destaddr4->sin_addr, sizeof(uint32_t)); } /* Construct an ICMP header for IPv4 */ static void construct_icmp4_header( const struct net_state_t *net_state, int sequence, char *packet_buffer, int packet_size, const struct probe_param_t *param) { struct ICMPHeader *icmp; int icmp_size; icmp = (struct ICMPHeader *) &packet_buffer[sizeof(struct IPHeader)]; icmp_size = packet_size - sizeof(struct IPHeader); memset(icmp, 0, sizeof(struct ICMPHeader)); icmp->type = ICMP_ECHO; icmp->id = htons(getpid()); icmp->sequence = htons(sequence); icmp->checksum = htons(compute_checksum(icmp, icmp_size)); } /* Construct an ICMP header for IPv6 */ static int construct_icmp6_packet( const struct net_state_t *net_state, int sequence, char *packet_buffer, int packet_size, const struct probe_param_t *param) { struct ICMPHeader *icmp; icmp = (struct ICMPHeader *) packet_buffer; memset(icmp, 0, sizeof(struct ICMPHeader)); icmp->type = ICMP6_ECHO; icmp->id = htons(getpid()); icmp->sequence = htons(sequence); return 0; } /* Set the port numbers for an outgoing UDP probe. There is limited space in the header for a sequence number to identify the probe upon return. We store the sequence number in the destination port, the local port, or the checksum. The location chosen depends upon which probe parameters have been requested. */ static void set_udp_ports( struct UDPHeader *udp, int sequence, const struct probe_param_t *param) { if (param->dest_port) { udp->dstport = htons(param->dest_port); if (param->local_port) { udp->srcport = htons(param->local_port); udp->checksum = htons(sequence); } else { udp->srcport = htons(sequence); udp->checksum = 0; } } else { udp->dstport = htons(sequence); if (param->local_port) { udp->srcport = htons(param->local_port); } else { udp->srcport = htons(getpid()); } udp->checksum = 0; } } /* Construct a header for UDP probes, using the port number associated with the probe. */ static void construct_udp4_header( const struct net_state_t *net_state, int sequence, char *packet_buffer, int packet_size, const struct probe_param_t *param) { struct UDPHeader *udp; int udp_size; udp = (struct UDPHeader *) &packet_buffer[sizeof(struct IPHeader)]; udp_size = packet_size - sizeof(struct IPHeader); memset(udp, 0, sizeof(struct UDPHeader)); set_udp_ports(udp, sequence, param); udp->length = htons(udp_size); } /* Construct a header for UDPv6 probes */ static int construct_udp6_packet( const struct net_state_t *net_state, int sequence, char *packet_buffer, int packet_size, const struct probe_param_t *param) { int udp_socket = net_state->platform.udp6_send_socket; struct UDPHeader *udp; int udp_size; udp = (struct UDPHeader *) packet_buffer; udp_size = packet_size; memset(udp, 0, sizeof(struct UDPHeader)); set_udp_ports(udp, sequence, param); udp->length = htons(udp_size); /* Instruct the kernel to put the pseudoheader checksum into the UDP header. */ int chksum_offset = (char *) &udp->checksum - (char *) udp; if (setsockopt(udp_socket, IPPROTO_IPV6, IPV6_CHECKSUM, &chksum_offset, sizeof(int))) { return -1; } return 0; } /* Set the socket options for an outgoing stream protocol socket based on the packet parameters. */ static int set_stream_socket_options( int stream_socket, const struct probe_param_t *param) { int level; int opt; int reuse = 1; /* Allow binding to a local port previously in use */ #ifdef SO_REUSEPORT /* FreeBSD wants SO_REUSEPORT in addition to SO_REUSEADDR to bind to the same port */ if (setsockopt(stream_socket, SOL_SOCKET, SO_REUSEPORT, &reuse, sizeof(int)) == -1) { return -1; } #endif if (setsockopt(stream_socket, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(int)) == -1) { return -1; } /* Set the number of hops the probe will transit across */ if (param->ip_version == 6) { level = IPPROTO_IPV6; opt = IPV6_UNICAST_HOPS; } else { level = IPPROTO_IP; opt = IP_TTL; } if (setsockopt(stream_socket, level, opt, ¶m->ttl, sizeof(int)) == -1) { return -1; } /* Set the "type of service" field of the IP header */ if (param->ip_version == 6) { level = IPPROTO_IPV6; opt = IPV6_TCLASS; } else { level = IPPROTO_IP; opt = IP_TOS; } if (setsockopt(stream_socket, level, opt, ¶m->type_of_service, sizeof(int)) == -1) { return -1; } #ifdef SO_MARK if (param->routing_mark) { if (setsockopt(stream_socket, SOL_SOCKET, SO_MARK, ¶m->routing_mark, sizeof(int))) { return -1; } } #endif return 0; } /* Open a TCP or SCTP socket, respecting the probe paramters as much as we can, and use it as an outgoing probe. */ static int open_stream_socket( const struct net_state_t *net_state, int protocol, int port, const struct sockaddr_storage *src_sockaddr, const struct sockaddr_storage *dest_sockaddr, const struct probe_param_t *param) { int stream_socket; int addr_len; int dest_port; struct sockaddr_storage dest_port_addr; struct sockaddr_storage src_port_addr; if (param->ip_version == 6) { stream_socket = socket(AF_INET6, SOCK_STREAM, protocol); addr_len = sizeof(struct sockaddr_in6); } else if (param->ip_version == 4) { stream_socket = socket(AF_INET, SOCK_STREAM, protocol); addr_len = sizeof(struct sockaddr_in); } else { errno = EINVAL; return -1; } if (stream_socket == -1) { return -1; } set_socket_nonblocking(stream_socket); if (set_stream_socket_options(stream_socket, param)) { close(stream_socket); return -1; } /* Bind to a known local port so we can identify which probe causes a TTL expiration. */ construct_addr_port(&src_port_addr, src_sockaddr, port); if (bind(stream_socket, (struct sockaddr *) &src_port_addr, addr_len)) { close(stream_socket); return -1; } if (param->dest_port) { dest_port = param->dest_port; } else { /* Use http if no port is specified */ dest_port = HTTP_PORT; } /* Attempt a connection */ construct_addr_port(&dest_port_addr, dest_sockaddr, dest_port); if (connect (stream_socket, (struct sockaddr *) &dest_port_addr, addr_len)) { /* EINPROGRESS simply means the connection is in progress */ if (errno != EINPROGRESS) { close(stream_socket); return -1; } } return stream_socket; } /* Determine the size of the constructed packet based on the packet parameters. This is the amount of space the packet *we* construct uses, and doesn't include any headers the operating system tacks onto the packet. (Such as the IPv6 header on non-Linux operating systems.) */ static int compute_packet_size( const struct net_state_t *net_state, const struct probe_param_t *param) { int packet_size; if (param->protocol == IPPROTO_TCP) { return 0; } #ifdef IPPROTO_SCTP if (param->protocol == IPPROTO_SCTP) { return 0; } #endif /* Start by determining the full size, including omitted headers */ if (param->ip_version == 6) { packet_size = sizeof(struct IP6Header); } else if (param->ip_version == 4) { packet_size = sizeof(struct IPHeader); } else { errno = EINVAL; return -1; } if (param->protocol == IPPROTO_ICMP) { packet_size += sizeof(struct ICMPHeader); } else if (param->protocol == IPPROTO_UDP) { packet_size += sizeof(struct UDPHeader); /* We may need to put the sequence number in the payload */ packet_size += sizeof(int); } else { errno = EINVAL; return -1; } /* If the requested size from send-probe is greater, extend the packet size. */ if (param->packet_size > packet_size) { packet_size = param->packet_size; } /* Since we don't explicitly construct the IPv6 header, we need to account for it in our transmitted size. */ if (param->ip_version == 6) { packet_size -= sizeof(struct IP6Header); } return packet_size; } /* Construct a packet for an IPv4 probe */ static int construct_ip4_packet( const struct net_state_t *net_state, int *packet_socket, int sequence, char *packet_buffer, int packet_size, const struct sockaddr_storage *src_sockaddr, const struct sockaddr_storage *dest_sockaddr, const struct probe_param_t *param) { int send_socket = net_state->platform.ip4_send_socket; bool is_stream_protocol = false; if (param->protocol == IPPROTO_TCP) { is_stream_protocol = true; #ifdef IPPROTO_SCTP } else if (param->protocol == IPPROTO_SCTP) { is_stream_protocol = true; #endif } else { construct_ip4_header(net_state, packet_buffer, packet_size, src_sockaddr, dest_sockaddr, param); if (param->protocol == IPPROTO_ICMP) { construct_icmp4_header(net_state, sequence, packet_buffer, packet_size, param); } else if (param->protocol == IPPROTO_UDP) { construct_udp4_header(net_state, sequence, packet_buffer, packet_size, param); } else { errno = EINVAL; return -1; } } if (is_stream_protocol) { send_socket = open_stream_socket(net_state, param->protocol, sequence, src_sockaddr, dest_sockaddr, param); if (send_socket == -1) { return -1; } *packet_socket = send_socket; return 0; } /* The routing mark requires CAP_NET_ADMIN, as opposed to the CAP_NET_RAW which we are sometimes explicitly given. If we don't have CAP_NET_ADMIN, this will fail, so we'll only set the mark if the user has explicitly requested it. Unfortunately, this means that once the mark is set, it won't be set on the socket again until a new mark is explicitly specified. */ #ifdef SO_MARK if (param->routing_mark) { if (setsockopt(send_socket, SOL_SOCKET, SO_MARK, ¶m->routing_mark, sizeof(int))) { return -1; } } #endif return 0; } /* Construct a packet for an IPv6 probe */ static int construct_ip6_packet( const struct net_state_t *net_state, int *packet_socket, int sequence, char *packet_buffer, int packet_size, const struct sockaddr_storage *src_sockaddr, const struct sockaddr_storage *dest_sockaddr, const struct probe_param_t *param) { int send_socket; bool is_stream_protocol = false; bool bind_send_socket = true; struct sockaddr_storage current_sockaddr; int current_sockaddr_len; if (param->protocol == IPPROTO_TCP) { is_stream_protocol = true; #ifdef IPPROTO_SCTP } else if (param->protocol == IPPROTO_SCTP) { is_stream_protocol = true; #endif } else if (param->protocol == IPPROTO_ICMP) { send_socket = net_state->platform.icmp6_send_socket; if (construct_icmp6_packet (net_state, sequence, packet_buffer, packet_size, param)) { return -1; } } else if (param->protocol == IPPROTO_UDP) { send_socket = net_state->platform.udp6_send_socket; if (construct_udp6_packet (net_state, sequence, packet_buffer, packet_size, param)) { return -1; } } else { errno = EINVAL; return -1; } if (is_stream_protocol) { send_socket = open_stream_socket(net_state, param->protocol, sequence, src_sockaddr, dest_sockaddr, param); if (send_socket == -1) { return -1; } *packet_socket = send_socket; return 0; } /* Check the current socket address, and if it is the same as the source address we intend, we will skip the bind. This is to accomodate Solaris, which, as of Solaris 11.3, will return an EINVAL error on bind if the socket is already bound, even if the same address is used. */ current_sockaddr_len = sizeof(struct sockaddr_in6); if (getsockname(send_socket, (struct sockaddr *) ¤t_sockaddr, ¤t_sockaddr_len) == 0) { if (memcmp(¤t_sockaddr, src_sockaddr, sizeof(struct sockaddr_in6)) == 0) { bind_send_socket = false; } } /* Bind to our local address */ if (bind_send_socket) { if (bind(send_socket, (struct sockaddr *) src_sockaddr, sizeof(struct sockaddr_in6))) { return -1; } } /* The traffic class in IPv6 is analagous to ToS in IPv4 */ if (setsockopt(send_socket, IPPROTO_IPV6, IPV6_TCLASS, ¶m->type_of_service, sizeof(int))) { return -1; } /* Set the time-to-live */ if (setsockopt(send_socket, IPPROTO_IPV6, IPV6_UNICAST_HOPS, ¶m->ttl, sizeof(int))) { return -1; } #ifdef SO_MARK if (param->routing_mark) { if (setsockopt(send_socket, SOL_SOCKET, SO_MARK, ¶m->routing_mark, sizeof(int))) { return -1; } } #endif return 0; } /* Construct a probe packet based on the probe parameters */ int construct_packet( const struct net_state_t *net_state, int *packet_socket, int sequence, char *packet_buffer, int packet_buffer_size, const struct sockaddr_storage *dest_sockaddr, const struct sockaddr_storage *src_sockaddr, const struct probe_param_t *param) { int packet_size; packet_size = compute_packet_size(net_state, param); if (packet_size < 0) { return -1; } if (packet_buffer_size < packet_size) { errno = EINVAL; return -1; } memset(packet_buffer, param->bit_pattern, packet_size); if (param->ip_version == 6) { if (construct_ip6_packet(net_state, packet_socket, sequence, packet_buffer, packet_size, src_sockaddr, dest_sockaddr, param)) { return -1; } } else if (param->ip_version == 4) { if (construct_ip4_packet(net_state, packet_socket, sequence, packet_buffer, packet_size, src_sockaddr, dest_sockaddr, param)) { return -1; } } else { errno = EINVAL; return -1; } return packet_size; } mtr-0.92/packet/probe_unix.c0000664000175000017500000005074213045551745015072 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "probe.h" #include #include #include #include #include #include #include #include #include "platform.h" #include "protocols.h" #include "construct_unix.h" #include "deconstruct_unix.h" #include "timeval.h" /* A wrapper around sendto for mixed IPv4 and IPv6 sending */ static int send_packet( const struct net_state_t *net_state, const struct probe_param_t *param, const char *packet, int packet_size, const struct sockaddr_storage *sockaddr) { int send_socket = 0; int sockaddr_length; if (sockaddr->ss_family == AF_INET6) { sockaddr_length = sizeof(struct sockaddr_in6); if (param->protocol == IPPROTO_ICMP) { send_socket = net_state->platform.icmp6_send_socket; } else if (param->protocol == IPPROTO_UDP) { send_socket = net_state->platform.udp6_send_socket; } } else if (sockaddr->ss_family == AF_INET) { sockaddr_length = sizeof(struct sockaddr_in); send_socket = net_state->platform.ip4_send_socket; } if (send_socket == 0) { errno = EINVAL; return -1; } return sendto(send_socket, packet, packet_size, 0, (struct sockaddr *) sockaddr, sockaddr_length); } /* Nearly all fields in the IP header should be encoded in network byte order prior to passing to send(). However, the required byte order of the length field of the IP header is inconsistent between operating systems and operating system versions. FreeBSD 11 requires the length field in network byte order, but some older versions of FreeBSD require host byte order. OS X requires the length field in host byte order. Linux will accept either byte order. Test for a byte order which works by sending a ping to localhost. */ static void check_length_order( struct net_state_t *net_state) { char packet[PACKET_BUFFER_SIZE]; struct probe_param_t param; struct sockaddr_storage dest_sockaddr; struct sockaddr_storage src_sockaddr; ssize_t bytes_sent; int packet_size; memset(¶m, 0, sizeof(struct probe_param_t)); param.ip_version = 4; param.protocol = IPPROTO_ICMP; param.ttl = 255; param.remote_address = "127.0.0.1"; if (resolve_probe_addresses(¶m, &dest_sockaddr, &src_sockaddr)) { fprintf(stderr, "Error decoding localhost address\n"); exit(EXIT_FAILURE); } /* First attempt to ping the localhost with network byte order */ net_state->platform.ip_length_host_order = false; packet_size = construct_packet(net_state, NULL, MIN_PORT, packet, PACKET_BUFFER_SIZE, &dest_sockaddr, &src_sockaddr, ¶m); if (packet_size < 0) { perror("Unable to send to localhost"); exit(EXIT_FAILURE); } bytes_sent = send_packet(net_state, ¶m, packet, packet_size, &dest_sockaddr); if (bytes_sent > 0) { return; } /* Since network byte order failed, try host byte order */ net_state->platform.ip_length_host_order = true; packet_size = construct_packet(net_state, NULL, MIN_PORT, packet, PACKET_BUFFER_SIZE, &dest_sockaddr, &src_sockaddr, ¶m); if (packet_size < 0) { perror("Unable to send to localhost"); exit(EXIT_FAILURE); } bytes_sent = send_packet(net_state, ¶m, packet, packet_size, &dest_sockaddr); if (bytes_sent < 0) { perror("Unable to send with swapped length"); exit(EXIT_FAILURE); } } /* Check to see if SCTP is support. We can't just rely on checking if IPPROTO_SCTP is defined, because while that is necessary, MacOS as of "Sierra" defines IPPROTO_SCTP, but creating an SCTP socket results in an error. */ static void check_sctp_support( struct net_state_t *net_state) { #ifdef IPPROTO_SCTP int sctp_socket; sctp_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP); if (sctp_socket != -1) { close(sctp_socket); net_state->platform.sctp_support = true; } #endif } /* Set a socket to non-blocking mode */ void set_socket_nonblocking( int socket) { int flags; flags = fcntl(socket, F_GETFL, 0); if (flags == -1) { perror("Unexpected socket F_GETFL error"); exit(EXIT_FAILURE); } if (fcntl(socket, F_SETFL, flags | O_NONBLOCK)) { perror("Unexpected socket F_SETFL O_NONBLOCK error"); exit(EXIT_FAILURE); } } /* Open the raw sockets for sending/receiving IPv4 packets */ static int open_ip4_sockets( struct net_state_t *net_state) { int send_socket; int recv_socket; int trueopt = 1; send_socket = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); if (send_socket == -1) { return -1; } /* We will be including the IP header in transmitted packets. Linux doesn't require this, but BSD derived network stacks do. */ if (setsockopt (send_socket, IPPROTO_IP, IP_HDRINCL, &trueopt, sizeof(int))) { close(send_socket); return -1; } /* Open a second socket with IPPROTO_ICMP because we are only interested in receiving ICMP packets, not all packets. */ recv_socket = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); if (recv_socket == -1) { close(send_socket); return -1; } net_state->platform.ip4_present = true; net_state->platform.ip4_send_socket = send_socket; net_state->platform.ip4_recv_socket = recv_socket; return 0; } /* Open the raw sockets for sending/receiving IPv6 packets */ static int open_ip6_sockets( struct net_state_t *net_state) { int send_socket_icmp; int send_socket_udp; int recv_socket; send_socket_icmp = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); if (send_socket_icmp == -1) { return -1; } send_socket_udp = socket(AF_INET6, SOCK_RAW, IPPROTO_UDP); if (send_socket_udp == -1) { close(send_socket_icmp); return -1; } recv_socket = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); if (recv_socket == -1) { close(send_socket_icmp); close(send_socket_udp); return -1; } net_state->platform.ip6_present = true; net_state->platform.icmp6_send_socket = send_socket_icmp; net_state->platform.udp6_send_socket = send_socket_udp; net_state->platform.ip6_recv_socket = recv_socket; return 0; } /* The first half of the net state initialization. Since this happens with elevated privileges, this is kept as minimal as possible to minimize security risk. */ void init_net_state_privileged( struct net_state_t *net_state) { int ip4_err = 0; int ip6_err = 0; memset(net_state, 0, sizeof(struct net_state_t)); net_state->platform.next_sequence = MIN_PORT; if (open_ip4_sockets(net_state)) { ip4_err = errno; } if (open_ip6_sockets(net_state)) { ip6_err = errno; } /* If we couldn't open either IPv4 or IPv6 sockets, we can't do much, so print errors and exit. */ if (!net_state->platform.ip4_present && !net_state->platform.ip6_present) { errno = ip4_err; perror("Failure to open IPv4 sockets"); errno = ip6_err; perror("Failure to open IPv6 sockets"); exit(EXIT_FAILURE); } } /* The second half of net state initialization, which is run at normal privilege levels. */ void init_net_state( struct net_state_t *net_state) { set_socket_nonblocking(net_state->platform.ip4_recv_socket); set_socket_nonblocking(net_state->platform.ip6_recv_socket); if (net_state->platform.ip4_present) { check_length_order(net_state); } check_sctp_support(net_state); } /* Returns true if we were able to open sockets for a particular IP protocol version. */ bool is_ip_version_supported( struct net_state_t *net_state, int ip_version) { if (ip_version == 4) { return net_state->platform.ip4_present; } else if (ip_version == 6) { return net_state->platform.ip6_present; } else { return false; } } /* Returns true if we can transmit probes using the specified protocol */ bool is_protocol_supported( struct net_state_t * net_state, int protocol) { if (protocol == IPPROTO_ICMP) { return true; } if (protocol == IPPROTO_UDP) { return true; } if (protocol == IPPROTO_TCP) { return true; } #ifdef IPPROTO_SCTP if (protocol == IPPROTO_SCTP) { return net_state->platform.sctp_support; } #endif return false; } /* Report an error during send_probe based on the errno value */ static void report_packet_error( int command_token) { if (errno == EINVAL) { printf("%d invalid-argument\n", command_token); } else if (errno == ENETDOWN) { printf("%d network-down\n", command_token); } else if (errno == ENETUNREACH) { printf("%d no-route\n", command_token); } else if (errno == EHOSTUNREACH) { printf("%d no-route\n", command_token); } else if (errno == EPERM) { printf("%d permission-denied\n", command_token); } else if (errno == EADDRINUSE) { printf("%d address-in-use\n", command_token); } else if (errno == EADDRNOTAVAIL) { printf("%d address-not-available\n", command_token); } else { printf("%d unexpected-error errno %d\n", command_token, errno); } } /* Craft a custom ICMP packet for a network probe. */ void send_probe( struct net_state_t *net_state, const struct probe_param_t *param) { char packet[PACKET_BUFFER_SIZE]; struct probe_t *probe; int packet_size; struct sockaddr_storage src_sockaddr; probe = alloc_probe(net_state, param->command_token); if (probe == NULL) { printf("%d probes-exhausted\n", param->command_token); return; } if (resolve_probe_addresses(param, &probe->remote_addr, &src_sockaddr)) { printf("%d invalid-argument\n", param->command_token); free_probe(net_state, probe); return; } if (gettimeofday(&probe->platform.departure_time, NULL)) { perror("gettimeofday failure"); exit(EXIT_FAILURE); } packet_size = construct_packet(net_state, &probe->platform.socket, probe->sequence, packet, PACKET_BUFFER_SIZE, &probe->remote_addr, &src_sockaddr, param); if (packet_size < 0) { /* When using a stream protocol, FreeBSD will return ECONNREFUSED when connecting to localhost if the port doesn't exist, even if the socket is non-blocking, so we should be prepared for that. */ if (errno == ECONNREFUSED) { receive_probe(net_state, probe, ICMP_ECHOREPLY, &probe->remote_addr, NULL, 0, NULL); } else { report_packet_error(param->command_token); free_probe(net_state, probe); } return; } if (packet_size > 0) { if (send_packet(net_state, param, packet, packet_size, &probe->remote_addr) == -1) { report_packet_error(param->command_token); free_probe(net_state, probe); return; } } probe->platform.timeout_time = probe->platform.departure_time; probe->platform.timeout_time.tv_sec += param->timeout; } /* When allocating a probe, assign it a unique port number */ void platform_alloc_probe( struct net_state_t *net_state, struct probe_t *probe) { probe->sequence = net_state->platform.next_sequence++; if (net_state->platform.next_sequence > MAX_PORT) { net_state->platform.next_sequence = MIN_PORT; } } /* When freeing the probe, close the socket for the probe, if one has been opened */ void platform_free_probe( struct probe_t *probe) { if (probe->platform.socket) { close(probe->platform.socket); probe->platform.socket = 0; } } /* Compute the round trip time of a just-received probe and pass it to the platform agnostic response handling. */ void receive_probe( struct net_state_t *net_state, struct probe_t *probe, int icmp_type, const struct sockaddr_storage *remote_addr, struct timeval *timestamp, int mpls_count, struct mpls_label_t *mpls) { unsigned int round_trip_us; struct timeval *departure_time = &probe->platform.departure_time; struct timeval now; if (timestamp == NULL) { if (gettimeofday(&now, NULL)) { perror("gettimeofday failure"); exit(EXIT_FAILURE); } timestamp = &now; } round_trip_us = (timestamp->tv_sec - departure_time->tv_sec) * 1000000 + timestamp->tv_usec - departure_time->tv_usec; respond_to_probe(net_state, probe, icmp_type, remote_addr, round_trip_us, mpls_count, mpls); } /* Read all available packets through our receiving raw socket, and handle any responses to probes we have preivously sent. */ static void receive_replies_from_icmp_socket( struct net_state_t *net_state, int socket, received_packet_func_t handle_received_packet) { char packet[PACKET_BUFFER_SIZE]; int packet_length; struct sockaddr_storage remote_addr; socklen_t sockaddr_length; struct timeval timestamp; /* Read until no more packets are available */ while (true) { sockaddr_length = sizeof(struct sockaddr_storage); packet_length = recvfrom(socket, packet, PACKET_BUFFER_SIZE, 0, (struct sockaddr *) &remote_addr, &sockaddr_length); /* Get the time immediately after reading the packet to keep the timing as precise as we can. */ if (gettimeofday(×tamp, NULL)) { perror("gettimeofday failure"); exit(EXIT_FAILURE); } if (packet_length == -1) { /* EAGAIN will be returned if there is no current packet available. */ if (errno == EAGAIN) { return; } /* EINTER will be returned if we received a signal during receive. */ if (errno == EINTR) { continue; } perror("Failure receiving replies"); exit(EXIT_FAILURE); } handle_received_packet(net_state, &remote_addr, packet, packet_length, ×tamp); } } /* Attempt to send using the probe's socket, in order to check whether the connection has completed, for stream oriented protocols such as TCP. */ static void receive_replies_from_probe_socket( struct net_state_t *net_state, struct probe_t *probe) { int probe_socket; struct timeval zero_time; int err; int err_length = sizeof(int); fd_set write_set; probe_socket = probe->platform.socket; if (!probe_socket) { return; } FD_ZERO(&write_set); FD_SET(probe_socket, &write_set); zero_time.tv_sec = 0; zero_time.tv_usec = 0; if (select(probe_socket + 1, NULL, &write_set, NULL, &zero_time) == -1) { if (errno == EAGAIN) { return; } else { perror("probe socket select error"); exit(EXIT_FAILURE); } } /* If the socket is writable, the connection attempt has completed. */ if (!FD_ISSET(probe_socket, &write_set)) { return; } if (getsockopt(probe_socket, SOL_SOCKET, SO_ERROR, &err, &err_length)) { perror("probe socket SO_ERROR"); exit(EXIT_FAILURE); } /* If the connection complete successfully, or was refused, we can assume our probe arrived at the destination. */ if (!err || err == ECONNREFUSED) { receive_probe(net_state, probe, ICMP_ECHOREPLY, &probe->remote_addr, NULL, 0, NULL); } else { errno = err; report_packet_error(probe->token); free_probe(net_state, probe); } } /* Check both the IPv4 and IPv6 sockets for incoming packets */ void receive_replies( struct net_state_t *net_state) { struct probe_t *probe; struct probe_t *probe_safe_iter; if (net_state->platform.ip4_present) { receive_replies_from_icmp_socket(net_state, net_state->platform. ip4_recv_socket, handle_received_ip4_packet); } if (net_state->platform.ip6_present) { receive_replies_from_icmp_socket(net_state, net_state->platform. ip6_recv_socket, handle_received_ip6_packet); } LIST_FOREACH_SAFE(probe, &net_state->outstanding_probes, probe_list_entry, probe_safe_iter) { receive_replies_from_probe_socket(net_state, probe); } } /* Put all of our probe sockets in the read set used for an upcoming select so we can wake when any of them become readable. */ int gather_probe_sockets( const struct net_state_t *net_state, fd_set * write_set) { int probe_socket; int nfds; const struct probe_t *probe; nfds = 0; LIST_FOREACH(probe, &net_state->outstanding_probes, probe_list_entry) { probe_socket = probe->platform.socket; if (probe_socket) { FD_SET(probe_socket, write_set); if (probe_socket >= nfds) { nfds = probe_socket + 1; } } } return nfds; } /* Check for any probes for which we have not received a response for some time, and report a time-out, assuming that we won't receive a future reply. */ void check_probe_timeouts( struct net_state_t *net_state) { struct timeval now; struct probe_t *probe; struct probe_t *probe_safe_iter; if (gettimeofday(&now, NULL)) { perror("gettimeofday failure"); exit(EXIT_FAILURE); } LIST_FOREACH_SAFE(probe, &net_state->outstanding_probes, probe_list_entry, probe_safe_iter) { if (compare_timeval(probe->platform.timeout_time, now) < 0) { /* Report timeout to the command stream */ printf("%d no-reply\n", probe->token); free_probe(net_state, probe); } } } /* Find the remaining time until the next probe times out. This may be a negative value if the next probe timeout has already elapsed. Returns false if no probes are currently outstanding, and true if a timeout value for the next probe exists. */ bool get_next_probe_timeout( const struct net_state_t *net_state, struct timeval *timeout) { bool have_timeout; const struct probe_t *probe; struct timeval now; struct timeval probe_timeout; if (gettimeofday(&now, NULL)) { perror("gettimeofday failure"); exit(EXIT_FAILURE); } have_timeout = false; LIST_FOREACH(probe, &net_state->outstanding_probes, probe_list_entry) { probe_timeout.tv_sec = probe->platform.timeout_time.tv_sec - now.tv_sec; probe_timeout.tv_usec = probe->platform.timeout_time.tv_usec - now.tv_usec; normalize_timeval(&probe_timeout); if (have_timeout) { if (compare_timeval(probe_timeout, *timeout) < 0) { /* If this probe has a sooner timeout, store it instead */ *timeout = probe_timeout; } } else { *timeout = probe_timeout; have_timeout = true; } } return have_timeout; } mtr-0.92/packet/construct_unix.h0000664000175000017500000000210013031772644015773 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef CONSTRUCT_H #define CONSTRUCT_H #include "probe.h" int construct_packet( const struct net_state_t *net_state, int *packet_socket, int sequence, char *packet_buffer, int packet_buffer_size, const struct sockaddr_storage *dest_sockaddr, const struct sockaddr_storage *src_sockaddr, const struct probe_param_t *param); #endif mtr-0.92/packet/probe_cygwin.c0000664000175000017500000002635213045551745015407 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "probe.h" #include #include #include #include "protocols.h" /* Windows doesn't require any initialization at a privileged level */ void init_net_state_privileged( struct net_state_t *net_state) { } /* Open the ICMP.DLL interface */ void init_net_state( struct net_state_t *net_state) { memset(net_state, 0, sizeof(struct net_state_t)); net_state->platform.icmp4 = IcmpCreateFile(); net_state->platform.icmp6 = Icmp6CreateFile(); if (net_state->platform.icmp4 == INVALID_HANDLE_VALUE && net_state->platform.icmp6 == INVALID_HANDLE_VALUE) { fprintf(stderr, "Failure opening ICMP %d\n", GetLastError()); exit(EXIT_FAILURE); } } /* If we succeeded at opening the ICMP file handle, we can assume that IP protocol version is supported. */ bool is_ip_version_supported( struct net_state_t *net_state, int ip_version) { if (ip_version == 4) { return (net_state->platform.icmp4 != INVALID_HANDLE_VALUE); } else if (ip_version == 6) { return (net_state->platform.icmp6 != INVALID_HANDLE_VALUE); } return false; } /* On Windows, we only support ICMP probes */ bool is_protocol_supported( struct net_state_t * net_state, int protocol) { if (protocol == IPPROTO_ICMP) { return true; } return false; } /* Set the back pointer to the net_state when a probe is allocated */ void platform_alloc_probe( struct net_state_t *net_state, struct probe_t *probe) { probe->platform.net_state = net_state; } /* Free the reply buffer when the probe is freed */ void platform_free_probe( struct probe_t *probe) { if (probe->platform.reply4) { free(probe->platform.reply4); probe->platform.reply4 = NULL; } } /* Report a windows error code using a platform-independent error string */ static void report_win_error( int command_token, int err) { /* It could be that we got no reply because of timeout */ if (err == IP_REQ_TIMED_OUT || err == IP_SOURCE_QUENCH) { printf("%d no-reply\n", command_token); } else if (err == IP_DEST_HOST_UNREACHABLE || err == IP_DEST_PORT_UNREACHABLE || err == IP_DEST_PROT_UNREACHABLE || err == IP_DEST_NET_UNREACHABLE || err == IP_DEST_UNREACHABLE || err == IP_DEST_NO_ROUTE || err == IP_BAD_ROUTE || err == IP_BAD_DESTINATION) { printf("%d no-route\n", command_token); } else if (err == ERROR_INVALID_NETNAME) { printf("%d address-not-available\n", command_token); } else if (err == ERROR_INVALID_PARAMETER) { printf("%d invalid-argument\n", command_token); } else { printf("%d unexpected-error winerror %d\n", command_token, err); } } /* The overlapped I/O style completion routine to be called by Windows during an altertable wait when an ICMP probe has completed, either by reply, or by ICMP.DLL timeout. */ static void WINAPI on_icmp_reply( PVOID context, PIO_STATUS_BLOCK status, ULONG reserved) { struct probe_t *probe = (struct probe_t *) context; struct net_state_t *net_state = probe->platform.net_state; int icmp_type; int round_trip_us = 0; int reply_count; int reply_status = 0; struct sockaddr_storage remote_addr; struct sockaddr_in *remote_addr4; struct sockaddr_in6 *remote_addr6; ICMP_ECHO_REPLY32 *reply4; ICMPV6_ECHO_REPLY *reply6; if (probe->platform.ip_version == 6) { reply6 = probe->platform.reply6; reply_count = Icmp6ParseReplies(reply6, sizeof(ICMPV6_ECHO_REPLY)); if (reply_count > 0) { reply_status = reply6->Status; /* Unfortunately, ICMP.DLL only has millisecond precision */ round_trip_us = reply6->RoundTripTime * 1000; remote_addr6 = (struct sockaddr_in6 *) &remote_addr; remote_addr6->sin6_family = AF_INET6; remote_addr6->sin6_port = 0; remote_addr6->sin6_flowinfo = 0; memcpy(&remote_addr6->sin6_addr, reply6->AddressBits, sizeof(struct in6_addr)); remote_addr6->sin6_scope_id = 0; } } else { reply4 = probe->platform.reply4; reply_count = IcmpParseReplies(reply4, sizeof(ICMP_ECHO_REPLY)); if (reply_count > 0) { reply_status = reply4->Status; /* Unfortunately, ICMP.DLL only has millisecond precision */ round_trip_us = reply4->RoundTripTime * 1000; remote_addr4 = (struct sockaddr_in *) &remote_addr; remote_addr4->sin_family = AF_INET; remote_addr4->sin_port = 0; remote_addr4->sin_addr.s_addr = reply4->Address; } } if (reply_count == 0) { reply_status = GetLastError(); } icmp_type = -1; if (reply_status == IP_SUCCESS) { icmp_type = ICMP_ECHOREPLY; } else if (reply_status == IP_TTL_EXPIRED_TRANSIT || reply_status == IP_TTL_EXPIRED_REASSEM) { icmp_type = ICMP_TIME_EXCEEDED; } if (icmp_type != -1) { /* Record probe result */ respond_to_probe(net_state, probe, icmp_type, &remote_addr, round_trip_us, 0, NULL); } else { report_win_error(probe->token, reply_status); free_probe(net_state, probe); } } /* Use ICMP.DLL's send echo support to send a probe */ static void icmp_send_probe( struct net_state_t *net_state, struct probe_t *probe, const struct probe_param_t *param, struct sockaddr_storage *src_sockaddr, struct sockaddr_storage *dest_sockaddr, char *payload, int payload_size) { IP_OPTION_INFORMATION option; DWORD timeout; DWORD send_result; int reply_size; int err; struct sockaddr_in *dest_sockaddr4; struct sockaddr_in6 *src_sockaddr6; struct sockaddr_in6 *dest_sockaddr6; if (param->timeout > 0) { timeout = 1000 * param->timeout; } else { /* IcmpSendEcho2 will return invalid argument on a timeout of zero. Our Unix implementation allows it. Bump up the timeout to 1 millisecond. */ timeout = 1; } memset(&option, 0, sizeof(IP_OPTION_INFORMATION32)); option.Ttl = param->ttl; if (param->ip_version == 6) { reply_size = sizeof(ICMPV6_ECHO_REPLY) + payload_size; } else { reply_size = sizeof(ICMP_ECHO_REPLY32) + payload_size; } probe->platform.reply4 = malloc(reply_size); if (probe->platform.reply4 == NULL) { perror("failure to allocate reply buffer"); exit(EXIT_FAILURE); } if (param->ip_version == 6) { src_sockaddr6 = (struct sockaddr_in6 *) src_sockaddr; dest_sockaddr6 = (struct sockaddr_in6 *) dest_sockaddr; send_result = Icmp6SendEcho2(net_state->platform.icmp6, NULL, (FARPROC) on_icmp_reply, probe, src_sockaddr6, dest_sockaddr6, payload, payload_size, &option, probe->platform.reply6, reply_size, timeout); } else { dest_sockaddr4 = (struct sockaddr_in *) dest_sockaddr; send_result = IcmpSendEcho2(net_state->platform.icmp4, NULL, (FARPROC) on_icmp_reply, probe, dest_sockaddr4->sin_addr.s_addr, payload, payload_size, &option, probe->platform.reply4, reply_size, timeout); } if (send_result == 0) { err = GetLastError(); /* ERROR_IO_PENDING is expected for asynchronous probes, but any other error is unexpected. */ if (err != ERROR_IO_PENDING) { report_win_error(probe->token, err); free_probe(net_state, probe); } } } /* Fill the payload of the packet as specified by the probe parameters */ static int fill_payload( const struct probe_param_t *param, char *payload, int payload_buffer_size) { int ip_icmp_size; int payload_size; if (param->ip_version == 6) { ip_icmp_size = sizeof(struct IP6Header) + sizeof(struct ICMPHeader); } else if (param->ip_version == 4) { ip_icmp_size = sizeof(struct IPHeader) + sizeof(struct ICMPHeader); } else { errno = EINVAL; return -1; } payload_size = param->packet_size - ip_icmp_size; if (payload_size < 0) { payload_size = 0; } if (payload_size > payload_buffer_size) { errno = EINVAL; return -1; } memset(payload, param->bit_pattern, payload_size); return payload_size; } /* Decode the probe parameters and send a probe */ void send_probe( struct net_state_t *net_state, const struct probe_param_t *param) { struct probe_t *probe; struct sockaddr_storage dest_sockaddr; struct sockaddr_storage src_sockaddr; char payload[PACKET_BUFFER_SIZE]; int payload_size; if (resolve_probe_addresses(param, &dest_sockaddr, &src_sockaddr)) { printf("%d invalid-argument\n", param->command_token); return; } probe = alloc_probe(net_state, param->command_token); if (probe == NULL) { printf("%d probes-exhausted\n", param->command_token); return; } probe->platform.ip_version = param->ip_version; payload_size = fill_payload(param, payload, PACKET_BUFFER_SIZE); if (payload_size < 0) { perror("Error construction packet"); exit(EXIT_FAILURE); } icmp_send_probe(net_state, probe, param, &src_sockaddr, &dest_sockaddr, payload, payload_size); } /* On Windows, an implementation of receive_replies is unnecessary, because, unlike Unix, replies are completed using Overlapped I/O during an alertable wait, and don't require explicit reads. */ void receive_replies( struct net_state_t *net_state) { } /* On Windows, an implementation of check_probe_timeout is unnecesary because timeouts are managed by ICMP.DLL, including a call to the I/O completion routine when the time fully expires. */ void check_probe_timeouts( struct net_state_t *net_state) { } /* As in the case of check_probe_timeout, getting the next probe timeout is unnecessary under Windows, as ICMP.DLL manages timeouts for us. */ bool get_next_probe_timeout( const struct net_state_t *net_state, struct timeval *timeout) { return false; } mtr-0.92/packet/command_unix.c0000664000175000017500000000512313045551745015372 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "command.h" #include #include #include #include #include #include /* Initialize the command buffer and put the command stream in non-blocking mode. */ void init_command_buffer( struct command_buffer_t *command_buffer, int command_stream) { int flags; memset(command_buffer, 0, sizeof(struct command_buffer_t)); command_buffer->command_stream = command_stream; /* Get the current command stream flags */ flags = fcntl(command_stream, F_GETFL, 0); if (flags == -1) { perror("Unexpected command stream error"); exit(EXIT_FAILURE); } /* Set the O_NONBLOCK bit */ if (fcntl(command_stream, F_SETFL, flags | O_NONBLOCK)) { perror("Unexpected command stream error"); exit(EXIT_FAILURE); } } /* Read currently available data from the command stream */ int read_commands( struct command_buffer_t *buffer) { int space_remaining = COMMAND_BUFFER_SIZE - buffer->incoming_read_position - 1; char *read_position = &buffer->incoming_buffer[buffer->incoming_read_position]; int read_count; int command_stream = buffer->command_stream; read_count = read(command_stream, read_position, space_remaining); /* If the command stream has been closed, read will return zero. */ if (read_count == 0) { errno = EPIPE; return -1; } if (read_count > 0) { /* Account for the newly read data */ buffer->incoming_read_position += read_count; } if (read_count < 0) { /* EAGAIN simply means there is no available data to read */ /* EINTR indicates we received a signal during read */ if (errno != EINTR && errno != EAGAIN) { perror("Unexpected command buffer read error"); exit(EXIT_FAILURE); } } return 0; } mtr-0.92/packet/command_unix.h0000664000175000017500000000156613045551745015406 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef COMMAND_UNIX_H #define COMMAND_UNIX_H /* No platform specific data is required for Unix command streams */ struct command_buffer_platform_t { }; #endif mtr-0.92/packet/wait_unix.c0000664000175000017500000000703613045551745014725 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "wait.h" #include #include #include #include #include #include #include /* Gather all the file descriptors which should wake our select call when they become readable. */ static int gather_read_fds( const struct command_buffer_t *command_buffer, const struct net_state_t *net_state, fd_set * read_set, fd_set * write_set) { int nfds; int probe_nfds; int ip4_socket = net_state->platform.ip4_recv_socket; int ip6_socket = net_state->platform.ip6_recv_socket; int command_stream = command_buffer->command_stream; FD_ZERO(read_set); FD_ZERO(write_set); FD_SET(command_stream, read_set); nfds = command_stream + 1; FD_SET(ip4_socket, read_set); if (ip4_socket >= nfds) { nfds = ip4_socket + 1; } FD_SET(ip6_socket, read_set); if (ip6_socket >= nfds) { nfds = ip6_socket + 1; } probe_nfds = gather_probe_sockets(net_state, write_set); if (probe_nfds > nfds) { nfds = probe_nfds; } return nfds; } /* Sleep until we receive a new probe response, a new command on the command stream, or a probe timeout. On Unix systems, this means we use select to wait on file descriptors for the command stream and the raw recieve socket. */ void wait_for_activity( struct command_buffer_t *command_buffer, struct net_state_t *net_state) { int nfds; fd_set read_set; fd_set write_set; struct timeval probe_timeout; struct timeval *select_timeout; int ready_count; nfds = gather_read_fds(command_buffer, net_state, &read_set, &write_set); while (true) { select_timeout = NULL; /* Use the soonest probe timeout time as our maximum wait time */ if (get_next_probe_timeout(net_state, &probe_timeout)) { assert(probe_timeout.tv_sec >= 0); select_timeout = &probe_timeout; } ready_count = select(nfds, &read_set, &write_set, NULL, select_timeout); /* If we didn't have an error, either one of our descriptors is readable, or we timed out. So we can now return. */ if (ready_count != -1) { break; } /* We will get EINTR if we received a signal during the select, so retry in that case. We may get EAGAIN if "the kernel was (perhaps temporarily) unable to allocate the requested number of file descriptors." I haven't seen this in practice, but selecting again seems like the right thing to do. */ if (errno != EINTR && errno != EAGAIN) { /* We don't expect other errors, so report them */ perror("unexpected select error"); exit(EXIT_FAILURE); } } } mtr-0.92/packet/timeval.c0000664000175000017500000000363113045551745014354 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "timeval.h" /* Ensure that a timevalue has a microsecond value in the range [0.0, 1.0e6) microseconds by converting microseconds to full seconds. */ void normalize_timeval( struct timeval *timeval) { int full_sec; /* If tv_usec has overflowed a full second, convert the overflow to tv_sec. */ full_sec = timeval->tv_usec / 1000000; timeval->tv_sec += full_sec; timeval->tv_usec -= 1000000 * full_sec; /* If tv_usec is negative, make it positive by rolling tv_sec back */ if (timeval->tv_usec < 0) { timeval->tv_sec--; timeval->tv_usec += 1000000; } /* If the entire time value is negative, clamp to zero */ if (timeval->tv_sec < 0) { timeval->tv_sec = 0; timeval->tv_usec = 0; } } /* Compare two time values. Return: -1 if a < b 0 if a == b 1 if a > b */ int compare_timeval( struct timeval a, struct timeval b) { if (a.tv_sec > b.tv_sec) { return 1; } if (a.tv_sec < b.tv_sec) { return -1; } if (a.tv_usec > b.tv_usec) { return 1; } if (a.tv_usec < b.tv_usec) { return -1; } return 0; } mtr-0.92/packet/probe_cygwin.h0000664000175000017500000000375013045551745015411 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef PROBE_CYGWIN_H #define PROBE_CYGWIN_H #include #include #include #include /* This should be in the Windows headers, but is missing from Cygwin's Windows headers. */ typedef struct icmpv6_echo_reply_lh { /* Although Windows uses an IPV6_ADDRESS_EX here, we are using uint8_t fields to avoid structure padding differences between gcc and Visual C++. (gcc wants to align the flow info to a 4 byte boundary, and Windows uses it unaligned.) */ uint8_t PortBits[2]; uint8_t FlowInfoBits[4]; uint8_t AddressBits[16]; uint8_t ScopeIdBits[4]; ULONG Status; unsigned int RoundTripTime; } ICMPV6_ECHO_REPLY, *PICMPV6_ECHO_REPLY; /* Windows requires an echo reply structure for each in-flight ICMP probe. */ struct probe_platform_t { /* We need a backpointer to the net_state because of the way IcmpSendEcho2 passes our context. */ struct net_state_t *net_state; /* IP version (4 or 6) used for the probe */ int ip_version; union { ICMP_ECHO_REPLY32 *reply4; ICMPV6_ECHO_REPLY *reply6; }; }; /* A Windows HANDLE for the ICMP session */ struct net_state_platform_t { HANDLE icmp4; HANDLE icmp6; }; #endif mtr-0.92/packet/protocols.h0000664000175000017500000000664213045551745014751 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef PROTOCOLS_H #define PROTOCOLS_H /* ICMPv4 type codes */ #define ICMP_ECHOREPLY 0 #define ICMP_DEST_UNREACH 3 #define ICMP_ECHO 8 #define ICMP_TIME_EXCEEDED 11 /* ICMP_DEST_UNREACH codes */ #define ICMP_PORT_UNREACH 3 /* ICMPv6 type codes */ #define ICMP6_DEST_UNREACH 1 #define ICMP6_TIME_EXCEEDED 3 #define ICMP6_ECHO 128 #define ICMP6_ECHOREPLY 129 /* ICMP6_DEST_UNREACH codes */ #define ICMP6_PORT_UNREACH 4 /* The minimum size of the ICMP "original datagram" when using ICMP extensions */ #define ICMP_ORIGINAL_DATAGRAM_MIN_SIZE 128 /* The classnum and type of MPLS labels in an ICMP extension object */ #define ICMP_EXT_MPLS_CLASSNUM 1 #define ICMP_EXT_MPLS_CTYPE 1 #define HTTP_PORT 80 /* We can't rely on header files to provide this information, because the fields have different names between, for instance, Linux and Solaris */ struct ICMPHeader { uint8_t type; uint8_t code; uint16_t checksum; uint16_t id; uint16_t sequence; }; /* ICMP extension header, which might contain MPLS labels */ /* See RFC 4884 */ struct ICMPExtensionHeader { uint8_t version; uint8_t reserved; uint16_t checksum; }; /* An object in an extended ICMP object */ struct ICMPExtensionObject { uint16_t len; uint8_t classnum; uint8_t ctype; }; /* An MPLS label included in an ICMP extension */ /* See RFC 4950 */ struct ICMPExtMPLSLabel { uint8_t label[3]; // Low 4 bits are Experimental Use, Stack uint8_t ttl; }; /* Structure of an UDP header. */ struct UDPHeader { uint16_t srcport; uint16_t dstport; uint16_t length; uint16_t checksum; }; /* Structure of an TCP header, as far as we need it. */ struct TCPHeader { uint16_t srcport; uint16_t dstport; uint32_t seq; }; /* Structure of an SCTP header */ struct SCTPHeader { uint16_t srcport; uint16_t dstport; uint32_t veri_tag; }; /* Structure of an IPv4 UDP pseudoheader. */ struct UDPPseudoHeader { uint32_t saddr; uint32_t daddr; uint8_t zero; uint8_t protocol; uint16_t len; }; /* Structure of an IP header. */ struct IPHeader { uint8_t version; uint8_t tos; uint16_t len; uint16_t id; uint16_t frag; uint8_t ttl; uint8_t protocol; uint16_t check; uint32_t saddr; uint32_t daddr; }; /* IP version 6 header */ struct IP6Header { uint8_t version; uint8_t flow[3]; uint16_t len; uint8_t protocol; uint8_t ttl; uint8_t saddr[16]; uint8_t daddr[16]; }; /* The pseudo-header used for checksum computation for ICMPv6 and UDPv6 */ struct IP6PseudoHeader { uint8_t saddr[16]; uint8_t daddr[16]; uint32_t len; uint8_t zero[3]; uint8_t protocol; }; #endif mtr-0.92/packet/command.h0000664000175000017500000000314613045551745014337 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef COMMAND_H #define COMMAND_H #include "platform.h" #include "probe.h" #define COMMAND_BUFFER_SIZE 4096 #ifdef PLATFORM_CYGWIN #include "command_cygwin.h" #else #include "command_unix.h" #endif /* Storage for incoming commands, prior to command parsing */ struct command_buffer_t { /* The file descriptor of the incoming command stream */ int command_stream; /* Storage to read commands into */ char incoming_buffer[COMMAND_BUFFER_SIZE]; /* The number of bytes read so far in incoming_buffer */ int incoming_read_position; /* Platform specific */ struct command_buffer_platform_t platform; }; void init_command_buffer( struct command_buffer_t *command_buffer, int command_stream); int read_commands( struct command_buffer_t *buffer); void dispatch_buffer_commands( struct command_buffer_t *buffer, struct net_state_t *net_state); #endif mtr-0.92/packet/command_cygwin.h0000664000175000017500000000330213045551745015711 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef COMMAND_CYGWIN_H #define COMMAND_CYGWIN_H /* Though Cygwin supports the usual Unix non-blocking reads on the command stream, we've got to use Overlapped I/O instead because ICMP.DLL's support for sending probes requires Overlapped I/O and alertable waits for notification of replies. Since we need alertable waits, we can't use Cygwin's select to determine when command stream data is available, but Overlapped I/O completion will work. */ /* Overlapped I/O manament for Windows command buffer reads */ struct command_buffer_platform_t { /* true if an overlapped I/O read is active */ bool read_active; /* true if the command pipe is still open */ bool pipe_open; /* Windows OVERLAPPED I/O data */ OVERLAPPED overlapped; /* The buffer which active OVERLAPPED reads read into */ char overlapped_buffer[COMMAND_BUFFER_SIZE]; }; struct command_buffer_t; void start_read_command( struct command_buffer_t *buffer); #endif mtr-0.92/packet/command_cygwin.c0000664000175000017500000001064413045551745015713 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "command.h" #include #include #include /* A completion routine to be called by Windows when a read from the command stream has completed. */ static void CALLBACK finish_read_command( DWORD status, DWORD size_read, OVERLAPPED * overlapped) { struct command_buffer_t *buffer; char *read_position; /* hEvent is unusuaed by ReadFileEx, so we use it to pass our command_buffer structure. */ buffer = (struct command_buffer_t *) overlapped->hEvent; if (status) { /* When the stream is closed ERROR_BROKEN_PIPE will be the result */ if (status == ERROR_BROKEN_PIPE) { buffer->platform.pipe_open = false; return; } fprintf(stderr, "ReadFileEx completion failure %d\n", status); exit(EXIT_FAILURE); } /* Copy from the overlapped I/O buffer to the incoming command buffer */ read_position = &buffer->incoming_buffer[buffer->incoming_read_position]; memcpy(read_position, buffer->platform.overlapped_buffer, size_read); /* Account for the newly read data */ buffer->incoming_read_position += size_read; buffer->platform.read_active = false; } /* An APC which does nothing, to be used only to wake from the current alertable wait. */ static void CALLBACK empty_apc( ULONG * param) { } /* Wake from the next alertable wait without waiting for newly read data */ static void queue_empty_apc( void) { if (QueueUserAPC((PAPCFUNC) empty_apc, GetCurrentThread(), 0) == 0) { fprintf(stderr, "Unexpected QueueUserAPC failure %d\n", GetLastError()); exit(EXIT_FAILURE); } } /* Start a new overlapped I/O read from the command stream */ void start_read_command( struct command_buffer_t *buffer) { HANDLE command_stream = (HANDLE) get_osfhandle(buffer->command_stream); int space_remaining = COMMAND_BUFFER_SIZE - buffer->incoming_read_position - 1; int err; /* If a read is already active, or the pipe is closed, do nothing */ if (!buffer->platform.pipe_open || buffer->platform.read_active) { return; } memset(&buffer->platform.overlapped, 0, sizeof(OVERLAPPED)); buffer->platform.overlapped.hEvent = (HANDLE) buffer; if (!ReadFileEx (command_stream, buffer->platform.overlapped_buffer, space_remaining, &buffer->platform.overlapped, finish_read_command)) { err = GetLastError(); if (err == ERROR_BROKEN_PIPE) { /* If the command stream has been closed, we need to wake from the next altertable wait to exit the main loop */ buffer->platform.pipe_open = false; queue_empty_apc(); return; } else if (err != WAIT_IO_COMPLETION) { fprintf(stderr, "Unexpected ReadFileEx failure %d\n", GetLastError()); exit(EXIT_FAILURE); } } /* Remember that we have started an overlapped read already */ buffer->platform.read_active = true; } /* Initialize the command buffer, and start the first overlapped read */ void init_command_buffer( struct command_buffer_t *command_buffer, int command_stream) { memset(command_buffer, 0, sizeof(struct command_buffer_t)); command_buffer->command_stream = command_stream; command_buffer->platform.pipe_open = true; } /* Return with errno EPIPE if the command stream has been closed. Otherwise, not much to do for Cygwin, since we are using Overlapped I/O to read commands. */ int read_commands( struct command_buffer_t *buffer) { if (!buffer->platform.pipe_open) { errno = EPIPE; return -1; } return 0; } mtr-0.92/packet/cmdparse.c0000664000175000017500000000725613045551745014520 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "cmdparse.h" #include #include #include #include /* NUL terminate the whitespace separated tokens in the command string. This modifies command_string in-place with NUL characters. Fill the tokens array with pointers to the tokens, and return the number of tokens found. */ static int tokenize_command( char **tokens, int max_tokens, char *command_string) { int token_count = 0; int on_space = 1; int i; for (i = 0; command_string[i]; i++) { if (on_space) { if (!isspace((unsigned char) command_string[i])) { /* Take care not to exceed the token array length */ if (token_count >= max_tokens) { return -1; } tokens[token_count++] = &command_string[i]; on_space = 0; } } else { if (isspace((unsigned char) command_string[i])) { command_string[i] = 0; on_space = 1; } } } return token_count; } /* Parse a command string (or command reply string) into a command_t structure for later semantic interpretation. Returns EINVAL if the command string is unparseable or zero for success. comamnd_string will be modified in-place with NUL characters terminating tokens, and the command_t will use pointers to the conents of command_string without copying, so any interpretation of the command_t structure requires that the command_string memory has not yet been freed or otherwise reused. */ int parse_command( struct command_t *command, char *command_string) { char *tokens[MAX_COMMAND_TOKENS]; int token_count; int i; memset(command, 0, sizeof(struct command_t)); /* Tokenize the string using whitespace */ token_count = tokenize_command(tokens, MAX_COMMAND_TOKENS, command_string); if (token_count < 2) { errno = EINVAL; return -1; } /* Expect the command token to be a numerical value */ errno = 0; command->token = strtol(tokens[0], NULL, 10); if (errno) { errno = EINVAL; return -1; } command->command_name = tokens[1]; /* The tokens beyond the command name are expected to be in name, value pairs. */ i = 2; command->argument_count = 0; while (i < token_count) { /* It's an error if we get a name without a key */ if (i + 1 >= token_count) { errno = EINVAL; return -1; } /* It's an error if we get more arguments than we have space for */ if (command->argument_count >= MAX_COMMAND_ARGUMENTS) { errno = EINVAL; return -1; } command->argument_name[command->argument_count] = tokens[i]; command->argument_value[command->argument_count] = tokens[i + 1]; command->argument_count++; i += 2; } return 0; } mtr-0.92/bash-completion/0000775000175000017500000000000012776730076014367 5ustar wolffwolffmtr-0.92/bash-completion/mtr0000664000175000017500000000360412776730076015117 0ustar wolffwolff_mtr_module() { local cur prev OPTS COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-F'|'--filename') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-a'|'--address') COMPREPLY=( $(compgen -W "ADDRESS" -- $cur) ) return 0 ;; '-f'|'--first-ttl'|'-m'|'--max-ttl'|'-m'|'--max-unknown'|'-B'|'--bitpattern'|'-Q'|'--tos'|'-c'|'--report-cycles') COMPREPLY=( $(compgen -W "NUMBER" -- $cur) ) return 0 ;; '-P'|'--port'|'-L'|'--localport') COMPREPLY=( $(compgen -W "PORT" -- $cur) ) return 0 ;; '-s'|'--psize') COMPREPLY=( $(compgen -W "SIZE" -- $cur) ) return 0 ;; '-i'|'--interval'|'-G'|'--gracetime'|'-Z'|'--timeout') COMPREPLY=( $(compgen -W "SECONDS" -- $cur) ) return 0 ;; '-M'|'--mark') COMPREPLY=( $(compgen -W "MARK" -- $cur) ) return 0 ;; '--displaymode') COMPREPLY=( $(compgen -W "{0..2}" -- $cur) ) return 0 ;; '-y'|'--ipinfo') COMPREPLY=( $(compgen -W "{0..4}" -- $cur) ) return 0 ;; '-o'|'--order') COMPREPLY=( $(compgen -W "LDRSNBAWVGJMXI" -- $cur) ) return 0 ;; esac case $cur in -*) OPTS=' --filename --inet --inet6 --udp --tcp --address --first-ttl --max-ttl --max-unknown --port --localport --psize --bitpattern --interval --gracetime --tos --mpls --timeout --mark --report --report-wide --report-cycles --json --xml --csv --raw --split --curses --displaymode --gtk --no-dns --show-ips --order --ipinfo --aslookup --help --version ' COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) return 0 ;; esac COMPREPLY=( $(compgen -W "ip_address hostname" -- $cur) ) return 0 } complete -F _mtr_module mtr mtr-0.92/report.c.orig0000664000175000017500000003055313004050334013700 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include #include #include #include #include #include #include #include #include "mtr.h" #include "report.h" #include "net.h" #include "dns.h" #include "asn.h" #include "utils.h" #define MAXLOADBAL 5 #define MAX_FORMAT_STR 81 extern void report_open(void) { const time_t now = time(NULL); const char *t = iso_time (&now); printf ("Start: %s\n", t); } static size_t snprint_addr(struct mtr_ctl *ctl, char *dst, size_t dst_len, ip_t *addr) { if(addrcmp((void *) addr, (void *) &ctl->unspec_addr, ctl->af)) { struct hostent *host = ctl->dns ? addr2host((void *) addr, ctl->af) : NULL; if (!host) return snprintf(dst, dst_len, "%s", strlongip(ctl, addr)); else if (ctl->dns && ctl->show_ips) return snprintf(dst, dst_len, "%s (%s)", host->h_name, strlongip(ctl, addr)); else return snprintf(dst, dst_len, "%s", host->h_name); } else return snprintf(dst, dst_len, "%s", "???"); } #ifdef HAVE_IPINFO static void print_mpls(struct mplslen *mpls) { int k; for (k=0; k < mpls->labels; k++) printf(" [MPLS: Lbl %lu Exp %u S %cu TTL %u]\n", mpls->label[k], mpls->exp[k], mpls->s[k], mpls->ttl[k]); } #endif extern void report_close(struct mtr_ctl *ctl) { int i, j, at, max, z, w; struct mplslen *mpls, *mplss; ip_t *addr; ip_t *addr2 = NULL; char name[MAX_FORMAT_STR]; char buf[1024]; char fmt[16]; size_t len=0; size_t len_hosts = 33; #ifdef HAVE_IPINFO int len_tmp = len_hosts; const size_t iiwidth_len = get_iiwidth_len(); #endif if (ctl->reportwide) { /* get the longest hostname */ len_hosts = strlen(ctl->LocalHostname); max = net_max(ctl); at = net_min(ctl); for (; at < max; at++) { size_t nlen; addr = net_addr(at); if ((nlen = snprint_addr(ctl, name, sizeof(name), addr))) if (len_hosts < nlen) len_hosts = nlen; } } #ifdef HAVE_IPINFO if (ctl->ipinfo_no >= 0 && iiwidth_len) { ctl->ipinfo_no %= iiwidth_len; if (ctl->reportwide) { len_hosts++; /* space */ len_tmp += get_iiwidth(ctl->ipinfo_no); if (!ctl->ipinfo_no) len_tmp += 2; /* align header: AS */ } } snprintf( fmt, sizeof(fmt), "HOST: %%-%ds", len_tmp); #else snprintf( fmt, sizeof(fmt), "HOST: %%-%zus", len_hosts); #endif snprintf(buf, sizeof(buf), fmt, ctl->LocalHostname); len = ctl->reportwide ? strlen(buf) : len_hosts; for( i=0; ifld_index[ctl->fld_active[i]]; if (j < 0) continue; snprintf( fmt, sizeof(fmt), "%%%ds", data_fields[j].length ); snprintf( buf + len, sizeof(buf), fmt, data_fields[j].title ); len += data_fields[j].length; } printf("%s\n",buf); max = net_max(ctl); at = net_min(ctl); for(; at < max; at++) { addr = net_addr(at); mpls = net_mpls(at); snprint_addr(ctl, name, sizeof(name), addr); #ifdef HAVE_IPINFO if (is_printii(ctl)) { snprintf(fmt, sizeof(fmt), " %%2d. %%s%%-%zus", len_hosts); snprintf(buf, sizeof(buf), fmt, at+1, fmt_ipinfo(ctl, addr), name); } else { #endif snprintf( fmt, sizeof(fmt), " %%2d.|-- %%-%zus", len_hosts); snprintf(buf, sizeof(buf), fmt, at+1, name); #ifdef HAVE_IPINFO } #endif len = ctl->reportwide ? strlen(buf) : len_hosts; for( i=0; ifld_index[ctl->fld_active [i]]; if (j < 0) continue; /* 1000.0 is a temporay hack for stats usec to ms, impacted net_loss. */ if( strchr( data_fields[j].format, 'f' ) ) { snprintf( buf + len, sizeof(buf), data_fields[j].format, data_fields[j].net_xxx(at) /1000.0 ); } else { snprintf( buf + len, sizeof(buf), data_fields[j].format, data_fields[j].net_xxx(at) ); } len += data_fields[j].length; } printf("%s\n",buf); /* This feature shows 'loadbalances' on routes */ /* z is starting at 1 because addrs[0] is the same that addr */ for (z = 1; z < MAXPATH ; z++) { int found = 0; addr2 = net_addrs(at, z); mplss = net_mplss(at, z); if ((addrcmp ((void *) &ctl->unspec_addr, (void *) addr2, ctl->af)) == 0) break; for (w = 0; w < z; w++) /* Ok... checking if there are ips repeated on same hop */ if ((addrcmp ((void *) addr2, (void *) net_addrs (at,w), ctl->af)) == 0) { found = 1; break; } if (!found) { #ifdef HAVE_IPINFO if (is_printii(ctl)) { if (mpls->labels && z == 1 && ctl->enablempls) print_mpls(mpls); snprint_addr(ctl, name, sizeof(name), addr2); printf(" %s%s\n", fmt_ipinfo(ctl, addr2), name); if (ctl->enablempls) print_mpls(mplss); } else { #else int k; if (mpls->labels && z == 1 && ctl->enablempls) { for (k=0; k < mpls->labels; k++) { printf(" | |+-- [MPLS: Lbl %lu Exp %u S %u TTL %u]\n", mpls->label[k], mpls->exp[k], mpls->s[k], mpls->ttl[k]); } } if (z == 1) { printf (" | `|-- %s\n", strlongip(ctl, addr2)); for (k=0; k < mplss->labels && ctl->enablempls; k++) { printf(" | +-- [MPLS: Lbl %lu Exp %u S %u TTL %u]\n", mplss->label[k], mplss->exp[k], mplss->s[k], mplss->ttl[k]); } } else { printf (" | |-- %s\n", strlongip(ctl, addr2)); for (k=0; k < mplss->labels && ctl->enablempls; k++) { printf(" | +-- [MPLS: Lbl %lu Exp %u S %u TTL %u]\n", mplss->label[k], mplss->exp[k], mplss->s[k], mplss->ttl[k]); } } #endif #ifdef HAVE_IPINFO } #endif } } /* No multipath */ #ifdef HAVE_IPINFO if (is_printii(ctl)) { if (mpls->labels && z == 1 && ctl->enablempls) print_mpls(mpls); } else { #else if(mpls->labels && z == 1 && ctl->enablempls) { int k; for (k=0; k < mpls->labels; k++) { printf(" | +-- [MPLS: Lbl %lu Exp %u S %u TTL %u]\n", mpls->label[k], mpls->exp[k], mpls->s[k], mpls->ttl[k]); } } #endif #ifdef HAVE_IPINFO } #endif } } extern void txt_open(void) { } extern void txt_close(struct mtr_ctl *ctl) { report_close(ctl); } extern void json_open(void) { } extern void json_close(struct mtr_ctl *ctl) { int i, j, at, first, max; ip_t *addr; char name[MAX_FORMAT_STR]; printf("{\n"); printf(" \"report\": {\n"); printf(" \"mtr\": {\n"); printf(" \"src\": \"%s\",\n", ctl->LocalHostname); printf(" \"dst\": \"%s\",\n", ctl->Hostname); printf(" \"tos\": \"0x%X\",\n", ctl->tos); if(ctl->cpacketsize >= 0) { printf(" \"psize\": \"%d\",\n", ctl->cpacketsize); } else { printf(" \"psize\": \"rand(%d-%d)\",\n", MINPACKET, -ctl->cpacketsize); } if (ctl->bitpattern >= 0) { printf(" \"bitpattern\": \"0x%02X\",\n", (unsigned char)(ctl->bitpattern)); } else { printf(" \"bitpattern\": \"rand(0x00-FF)\",\n"); } printf(" \"tests\": \"%d\"\n", ctl->MaxPing); printf(" },\n"); printf(" \"hubs\": ["); max = net_max(ctl); at = first = net_min(ctl); for(; at < max; at++) { addr = net_addr(at); snprint_addr(ctl, name, sizeof(name), addr); if(at == first) { printf("{\n"); } else { printf(" {\n"); } printf(" \"count\": \"%d\",\n", at+1); printf(" \"host\": \"%s\",\n", name); for( i=0; ifld_index[ctl->fld_active[i]]; /* Commas */ if(i + 1 == MAXFLD) { printf("\n"); } else if (j > 0 && i != 0) { printf(",\n"); } if (j <= 0) continue; /* Field nr 0, " " shouldn't be printed in this method. */ /* Format value */ format = data_fields[j].format; if( strchr(format, 'f') ) { format = "%.2f"; } else { format = "%d"; } /* Format json line */ snprintf(name, sizeof(name), "%s%s", " \"%s\": ", format); /* Output json line */ if(strchr(data_fields[j].format, 'f')) { /* 1000.0 is a temporay hack for stats usec to ms, impacted net_loss. */ printf(name, data_fields[j].title, data_fields[j].net_xxx(at) / 1000.0); } else { printf(name, data_fields[j].title, data_fields[j].net_xxx(at)); } } if(at+1 == max) { printf(" }]\n"); } else { printf(" },\n"); } } printf(" }\n"); printf("}\n"); } extern void xml_open(void) { } extern void xml_close(struct mtr_ctl *ctl) { int i, j, at, max; ip_t *addr; char name[MAX_FORMAT_STR]; printf("\n"); printf("LocalHostname, ctl->Hostname); printf(" TOS=\"0x%X\"", ctl->tos); if(ctl->cpacketsize >= 0) { printf(" PSIZE=\"%d\"", ctl->cpacketsize); } else { printf(" PSIZE=\"rand(%d-%d)\"",MINPACKET, -ctl->cpacketsize); } if (ctl->bitpattern >= 0) { printf(" BITPATTERN=\"0x%02X\"", (unsigned char)(ctl->bitpattern)); } else { printf(" BITPATTERN=\"rand(0x00-FF)\""); } printf(" TESTS=\"%d\">\n", ctl->MaxPing); max = net_max(ctl); at = net_min(ctl); for(; at < max; at++) { addr = net_addr(at); snprint_addr(ctl, name, sizeof(name), addr); printf(" \n", at+1, name); for( i=0; ifld_index[ctl->fld_active[i]]; if (j <= 0) continue; /* Field nr 0, " " shouldn't be printed in this method. */ snprintf(name, sizeof(name), "%s%s%s", " <%s>", data_fields[j].format, "\n"); /* XML doesn't allow "%" in tag names, rename Loss% to just Loss */ title = data_fields[j].title; if( strcmp(data_fields[j].title, "Loss%") == 0 ) { title = "Loss"; } /* 1000.0 is a temporay hack for stats usec to ms, impacted net_loss. */ if( strchr( data_fields[j].format, 'f' ) ) { printf( name, title, data_fields[j].net_xxx(at) /1000.0, title ); } else { printf( name, title, data_fields[j].net_xxx(at), title ); } } printf(" \n"); } printf("\n"); } extern void csv_open(void) { } extern void csv_close(struct mtr_ctl *ctl, time_t now) { int i, j, at, max; ip_t *addr; char name[MAX_FORMAT_STR]; for( i=0; ifld_index[ctl->fld_active[i]]; if (j < 0) continue; } max = net_max(ctl); at = net_min(ctl); for(; at < max; at++) { addr = net_addr(at); snprint_addr(ctl, name, sizeof(name), addr); if (at == net_min(ctl)) { printf("Mtr_Version,Start_Time,Status,Host,Hop,Ip,"); #ifdef HAVE_IPINFO if(!ctl->ipinfo_no) { printf("Asn,"); } #endif for( i=0; ifld_index[ctl->fld_active[i]]; if (j < 0) continue; printf("%s,", data_fields[j].title); } printf("\n"); } #ifdef HAVE_IPINFO if(!ctl->ipinfo_no) { char* fmtinfo = fmt_ipinfo(ctl, addr); fmtinfo = trim(fmtinfo, '\0'); printf("MTR.%s,%lld,%s,%s,%d,%s,%s", PACKAGE_VERSION, (long long)now, "OK", ctl->Hostname, at+1, name, fmtinfo); } else #endif printf("MTR.%s,%lld,%s,%s,%d,%s", PACKAGE_VERSION, (long long)now, "OK", ctl->Hostname, at+1, name); for( i=0; ifld_index[ctl->fld_active[i]]; if (j < 0) continue; /* 1000.0 is a temporay hack for stats usec to ms, impacted net_loss. */ if( strchr( data_fields[j].format, 'f' ) ) { printf( ",%.2f", (double) (data_fields[j].net_xxx(at) / 1000.0)); } else { printf( ",%d", data_fields[j].net_xxx(at) ); } } printf("\n"); } } mtr-0.92/pp0000664000175000017500000000072212501341676011634 0ustar wolffwolffdiff --git a/report.c b/report.c index badb765..d6752eb 100644 --- a/report.c +++ b/report.c @@ -294,7 +294,7 @@ void xml_close(void) printf(" \n", at+1, name); for( i=0; i"); strcat(name, data_fields[j].format); mtr-0.92/config.h.in~0000664000175000017500000001201713031773261013511 0ustar wolffwolff/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to enable IPv6 */ #undef ENABLE_IPV6 /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_NAMESER_COMPAT_H /* Define if a curses library available */ #undef HAVE_CURSES /* Define to 1 if you have the header file. */ #undef HAVE_CURSESX_H /* Define to 1 if you have the header file. */ #undef HAVE_CURSES_H /* Define to 1 if you have the declaration of `errno', and to 0 if you don't. */ #undef HAVE_DECL_ERRNO /* Define to 1 if you have the header file. */ #undef HAVE_ERROR_H /* Define to 1 if you have the `fcntl' function. */ #undef HAVE_FCNTL /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define if libc has getopt_long */ #undef HAVE_GETOPT /* Define if gtk+-2.0 library available */ #undef HAVE_GTK /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define when ipinfo lookups are in use */ #undef HAVE_IPINFO /* Define to 1 if you have the `cap' library (-lcap). */ #undef HAVE_LIBCAP /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM /* Define to 1 if you have the `nsl' library (-lnsl). */ #undef HAVE_LIBNSL /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_ICMP_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_NCURSES_CURSES_H /* Define to 1 if you have the header file. */ #undef HAVE_NCURSES_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_SOCKET_H /* Define if your system has socklen_t */ #undef HAVE_SOCKLEN_T /* 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_EXT_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_SYS_CDEFS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_LIMITS_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_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_XTI_H /* Define to 1 if the system has the type `time_t'. */ #undef HAVE_TIME_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_VALUES_H /* Define to 1 if you have the `verr' function. */ #undef HAVE_VERR /* Define to 1 if you have the `verrx' function. */ #undef HAVE_VERRX /* Define to 1 if you have the `vwarn' function. */ #undef HAVE_VWARN /* Define to 1 if you have the `vwarnx' function. */ #undef HAVE_VWARNX /* Define to 1 if you have the `__fpending' function. */ #undef HAVE___FPENDING /* 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 version of this package. */ #undef PACKAGE_VERSION /* The size of `unsigned char', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_CHAR /* The size of `unsigned int', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_INT /* The size of `unsigned long', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_LONG /* The size of `unsigned short', as computed by sizeof. */ #undef SIZEOF_UNSIGNED_SHORT /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define to 1 if on AIX 3. System headers sometimes define this. We just want to avoid a redefinition error message. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Enable extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif mtr-0.92/FORMATS0000664000175000017500000000633112750315446012334 0ustar wolffwolff The "split" format is for a separating the gui from the main program. The main program can be installed setuid, and you don't want to link a gui-library with a setuid program. The split format is: The "raw" format is: hostline|xmitline|pingline|dnsline|timestampline hostline: h xmitline: x pingline: p dnsline: d timestampline: t Timestampline is not yet implemented. Need to find out how to do ICMP timestamping first. :-) Someone suggested to put the following text here. As to context: Some people are wondering why mtr sometimes reports hosts beyond the destination host. The FINAL host will occasionally be mentioned at position n, n+1, n+2 etc. You know traceroute, right? It sends a packet, waits for the reply to come back and when it comes back, it sends the next packet. If say hosts 5-8 do not send "time exceeded" packets, you'll wait a 4*3 = twelve seconds extra before you get any results on hosts 9 and further. MTR doesn't work like that. In theory we could send out a probe for host 1-40 all at once. But this would pose an unnecessary burden on the network. So what we do, is we send out probes for a max of 5 hosts beyond where we've seen a reply. So in the example above, we'd see a reply from router at position 4, then we'd send out 5-9 (and because the max-host is now at 9, we'll send them out at 1s/9 = 111ms intervals). When the reply from host 9 comes back, we'll start probing for host 10-15 (at about 60ms intervals). But suppose the network delay up to host 9 is already 200ms and suppose our destination host is at position 11. Then by the time the packet from host 11 comes back, we'll already have sent probe packets for position 12, 13, and 14! Those will come back as "destination reached" and be reported by the "raw" mode. Curses mode will stop showing hosts with position numbers beyond the first reply of the destination host. It could gather the information about replies to packets sent as probes FURTHER than it actually is into the line displayed at its true position, but it doesn't (yet). In fact the above example is almost completely true: % mtr -r -n -c 2 152.179.99.218 | tail -5 13.|-- 144.232.18.238 0.0% 2 94.8 95.4 94.8 96.0 0.8 14.|-- 152.63.16.182 0.0% 2 95.1 95.5 95.1 95.8 0.5 15.|-- 152.63.64.106 0.0% 2 163.9 163.9 163.9 164.0 0.1 16.|-- 152.63.50.89 50.0% 2 163.7 163.7 163.7 163.7 0.0 17.|-- 152.179.99.218 50.0% 2 168.2 168.2 168.2 168.2 0.0 % mtr -l -c 2 152.179.99.218 | grep -v "^[dp]" |tail -7 h 10 144.232.1.41 h 11 144.232.4.96 h 16 152.179.99.218 h 17 152.179.99.218 h 18 152.179.99.218 h 12 144.232.18.238 h 13 152.63.16.182 As you can see we get the reply from the destination host at position 16 AFTER we've sent probes for position 17 and 18. When those come back, they are reported. That's what raw mode does. It reports the raw information. If you write a backend for the raw mode, it's up to you to filter/display the results. h 10 144.232.1.41 h 11 144.232.4.96 h 12 144.232.18.238 h 13 152.63.16.182 h 14 152.63.64.106 h 15 152.63.50.89 h 16 152.179.99.218 h 17 152.179.99.218 h 18 152.179.99.218 mtr-0.92/README0000664000175000017500000000704713031772644012163 0ustar wolffwolffWHAT IS MTR? mtr combines the functionality of the 'traceroute' and 'ping' programs in a single network diagnostic tool. As mtr starts, it investigates the network connection between the host mtr runs on and a user-specified destination host. After it determines the address of each network hop between the machines, it sends a sequence of ICMP ECHO requests to each one to determine the quality of the link to each machine. As it does this, it prints running statistics about each machine. mtr is distributed under the GNU General Public License version 2. See the COPYING file for details. INSTALLING If you're building this from a tarball, compiling mtr should be as simple as: make It should first call the "configure" script and then run "make" again with the makefile that "configure" just generated. If you're building from the git repository, you'll need to run: ./bootstrap.sh && ./configure && make After compiling, install: make install Note that mtr-packet must be suid-root because it requires access to raw IP sockets. See SECURITY for security information. Older versions used to require a non-existent path to GTK for a correct build of a non-gtk version while GTK was installed. This is no longer necessary. ./configure --without-gtk should now work. If it doesn't, try "make WITHOUT_X11=YES" as the make step. On Solaris, you'll need to use GNU make to build. (Use 'gmake' rather than 'make'.) On Solaris (and possibly other systems) the "gtk" library may be installed in a directory where the dynamic linker refuses to look when a binary is setuid. Roman Shterenzon reports that adding -Wl,-rpath=/usr/lib to the commandline will work if you are using gnu LD. He tells me that you're out of luck when you use the sun LD. That's not quite true, as you can move the gtk libraries to /usr/lib instead of leaving them in /usr/local/lib. (when the ld tells you that /usr/local/lib is untrusted and /usr/lib is trusted, and you trust the gtk libs enough to want them in a setuid program, then there is something to say for moving them to the "trusted" directory.) Building on MacOS should not require any special steps. BUILDING FOR WINDOWS Building for Windows requires Cygwin. To obtain Cygwin, see https://cygwin.com/install.html. When installing Cygwin, select the 'lynx' package for installation. lynx is required by apt-cyg. Next, install apt-cyg for easy installation of the remaining components. See https://github.com/transcode-open/apt-cyg. Install the packages required for building: apt-cyg install automake pkg-config make gcc-core libncurses-devel Build as under Unix: ./bootstrap.sh && ./configure && make Finally, install the built binaries: make install WHERE CAN I GET THE LATEST VERSION OR MORE INFORMATION? mtr is now hosted on github. https://github.com/traviscross/mtr See the mtr web page at http://www.BitWizard.nl/mtr/ Bug reports and feature requests should be submitted to the Github bug tracking system. Patches can be submitted by cloning the Github repository and issuing a pull request, or by email to me. Please use unified diffs. Usually the diff is sort of messy, so please check that the diff is clean and doesn't contain too much of your local stuff (for example, I don't want/need the "configure" script that /your/ automake made for you). (There used to be a mailinglist, but all it got was spam. So when the server was upgraded, the mailing list died.) -- REW mtr-0.92/man/0000775000175000017500000000000013031772644012046 5ustar wolffwolffmtr-0.92/man/mtr.8.in0000664000175000017500000002603513031772644013354 0ustar wolffwolff.TH MTR 8 "@VERSION@" "mtr" "System Administration" .SH NAME mtr \- a network diagnostic tool .SH SYNOPSIS .B mtr [\c .BR \-4 |\c .B \-6\c ] [\c .BI \-F \ FILENAME\c ] [\c .B \-\-report\c ] [\c .B \-\-report-wide\c ] [\c .B \-\-xml\c ] [\c .B \-\-gtk\c ] [\c .B \-\-curses\c ] [\c .BI \--displaymode \ MODE\c ] [\c .B \-\-raw\c ] [\c .B \-\-csv\c ] [\c .B \-\-json\c ] [\c .B \-\-split\c ] [\c .B \-\-no-dns\c ] [\c .B \-\-show-ips\c ] [\c .BI \-o \ FIELDS\c ] [\c .BI \-y \ IPINFO\c ] [\c .B \-\-aslookup\c ] [\c .BI \-i \ INTERVAL\c ] [\c .BI \-c \ COUNT\c ] [\c .BI \-s \ PACKETSIZE\c ] [\c .BI \-B \ BITPATTERN\c ] [\c .BI \-G \ GRACEPERIOD\c ] [\c .BI \-Q \ TOS\c ] [\c .B \-\-mpls\c ] [\c .BI \-a \ ADDRESS\c ] [\c .BI \-f \ FIRST\-TTL\c ] [\c .BI \-m \ MAX\-TTL\c ] [\c .BI \-U \ MAX\-UNKNOWN\c ] [\c .B \-\-udp\c ] [\c .B \-\-tcp\c ] [\c .BI \-\-sctp\c ] [\c .BI \-P \ PORT\c ] [\c .BI \-L \ LOCALPORT\c ] [\c .BI \-Z \ TIMEOUT\c ] [\c .BI \-M \ MARK\c ] .I HOSTNAME .SH DESCRIPTION .B mtr combines the functionality of the .B traceroute and .B ping programs in a single network diagnostic tool. .PP As .B mtr starts, it investigates the network connection between the host .B mtr runs on and .BR HOSTNAME by sending packets with purposely low TTLs. It continues to send packets with low TTL, noting the response time of the intervening routers. This allows .B mtr to print the response percentage and response times of the internet route to .BR HOSTNAME . A sudden increase in packet loss or response time is often an indication of a bad (or simply overloaded) link. .PP The results are usually reported as round-trip-response times in milliseconds and the percentage of packetloss. .SH OPTIONS .TP .B \-h\fR, \fB\-\-help Print the summary of command line argument options. .TP .B \-v\fR, \fB\-\-version Print the installed version of mtr. .TP .B \-4 Use IPv4 only. .TP .B \-6 Use IPv6 only. (IPV4 may be used for DNS lookups.) .TP .B \-F \fIFILENAME\fR, \fB\-\-filename \fIFILENAME Reads the list of hostnames from the specified file. .TP .B \-r\fR, \fB\-\-report This option puts .B mtr into .B report mode. When in this mode, .B mtr will run for the number of cycles specified by the .B \-c option, and then print statistics and exit. .TP \c This mode is useful for generating statistics about network quality. Note that each running instance of .B mtr generates a significant amount of network traffic. Using .B mtr to measure the quality of your network may result in decreased network performance. .TP .B \-w\fR, \fB\-\-report\-wide This option puts .B mtr into .B wide report mode. When in this mode, .B mtr will not cut hostnames in the report. .TP .B \-x\fR, \fB\-\-xml Use this option to tell .B mtr to use the xml output format. This format is better suited for automated processing of the measurement results. .TP .B \-t\fR, \fB\-\-curses Use this option to force .B mtr to use the curses based terminal interface (if available). In case the list of hops exceeds the height of your terminal, you can use the .B + and .B - keys to scroll up and down half a page. .B Ctrl\fR-\fPL clears spurious error messages that may overwrite other parts of the display. .TP .B -\-displaymode \fIMODE Use this option to select the initial display mode: 0 (default) selects statistics, 1 selects the stripchart without latency information, and 2 selects the stripchart with latency information. .TP .B \-g\fR, \fB\-\-gtk Use this option to force .B mtr to use the GTK+ based X11 window interface (if available). GTK+ must have been available on the system when .B mtr was built for this to work. See the GTK+ web page at .UR http://\:www.\:gtk.\:org/ .UE for more information about GTK+. .TP .B \-l\fR, \fB\-\-raw Use the raw output format. This format is better suited for archival of the measurement results. It could be parsed to be presented into any of the other display methods. .IP Example of the raw output format: .nf h 0 10.1.1.1 p 0 339 h 1 46.149.16.4 p 1 530 h 2 172.31.1.16 p 2 531 h 3 82.221.168.236 p 3 1523 h 5 195.130.211.8 p 5 1603 h 6 193.4.58.17 p 6 1127 h 7 193.4.58.17 d 7 www.isnic.is .fi .TP .B \-C\fR, \fB\-\-csv Use the Comma-Separated-Value (CSV) output format. (Note: The separator is actually a semi-colon ';'.) .IP Example of the CSV output format: .nf MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;1;r-76520-PROD.greenqloud.internal;288 MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;2;46.149.16.4;2086 MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;3;172.31.1.16;600 MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;4;82.221.168.236;1163 MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;5;???;0 MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;6;rix-k2-gw.isnic.is;1654 MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;7;www.isnic.is;1036 .fi .TP .B \-j\fR, \fB\-\-json Use this option to tell .B mtr to use the JSON output format. This format is better suited for automated processing of the measurement results. .TP .B \-p\fR, \fB\-\-split Use this option to set .B mtr to spit out a format that is suitable for a split-user interface. .TP .B \-n\fR, \fB\-\-no\-dns Use this option to force .B mtr to display numeric IP numbers and not try to resolve the host names. .TP .B \-b\fR, \fB\-\-show\-ips Use this option to tell .B mtr to display both the host names and numeric IP numbers. In split mode this adds an extra field to the output. In report mode, there is usually too little space to add the IPs, and they will be truncated. Use the wide report (-w) mode to see the IPs in report mode. .TP .B \-o \fIFIELDS\fR, \fB\-\-order \fIFIELDS Use this option to specify which fields to display and in which order. You may use one or more space characters to separate fields. .br Available fields: .TS center allbox tab(%); ll. L%Loss ratio D%Dropped packets R%Received packets S%Sent Packets N%Newest RTT(ms) B%Min/Best RTT(ms) A%Average RTT(ms) W%Max/Worst RTT(ms) V%Standard Deviation G%Geometric Mean J%Current Jitter M%Jitter Mean/Avg. X%Worst Jitter I%Interarrival Jitter .TE .br Example: -o "LSD NBAW X" .TP .B \-y \fIn\fR, \fB\-\-ipinfo \fIn Displays information about each IP hop. Valid values for \fIn\fR are: .TS tab(%); ll. 0%Display AS number (equivalent to \fB-z\fR) 1%Display IP prefix 2%Display country code of the origin AS 3%Display RIR (ripencc, arin, ...) 4%Display the allocation date of the IP prefix .TE .br It is possible to cycle between these fields at runtime (using the \fBy\fR key). .TP .B \-z\fR, \fB\-\-aslookup Displays the Autonomous System (AS) number alongside each hop. Equivalent to \fB\-\-ipinfo 0\fR. .IP Example (columns to the right not shown for clarity): .nf 1. AS??? r-76520-PROD.greenqloud.internal 2. AS51969 46.149.16.4 3. AS??? 172.31.1.16 4. AS30818 82.221.168.236 5. ??? 6. AS??? rix-k2-gw.isnic.is 7. AS1850 www.isnic.is .fi .TP .B \-i \fISECONDS\fR, \fB\-\-interval \fISECONDS Use this option to specify the positive number of seconds between ICMP ECHO requests. The default value for this parameter is one second. The root user may choose values between zero and one. .TP .B \-c \fICOUNT\fR, \fB\-\-report\-cycles \fICOUNT Use this option to set the number of pings sent to determine both the machines on the network and the reliability of those machines. Each cycle lasts one second. .TP .B \-s \fIPACKETSIZE\fR, \fB\-\-psize \fIPACKETSIZE This option sets the packet size used for probing. It is in bytes, inclusive IP and ICMP headers. If set to a negative number, every iteration will use a different, random packet size up to that number. .TP .B \-B \fINUM\fR, \fB\-\-bitpattern \fINUM Specifies bit pattern to use in payload. Should be within range 0 - 255. If .I NUM is greater than 255, a random pattern is used. .TP .B \-G \fISECONDS\fR, \fB\-\-gracetime \fISECONDS Use this option to specify the positive number of seconds to wait for responses after the final request. The default value is five seconds. .TP .B \-Q \fINUM\fR, \fB\-\-tos \fINUM Specifies value for type of service field in IP header. Should be within range 0 - 255. .TP .B \-e\fR, \fB\-\-mpls Use this option to tell .B mtr to display information from ICMP extensions for MPLS (RFC 4950) that are encoded in the response packets. .TP .B \-a \fIADDRESS\fR, \fB\-\-address \fIADDRESS Use this option to bind the outgoing socket to .IR ADDRESS , so that all packets will be sent with .I ADDRESS as source address. NOTE that this option doesn't apply to DNS requests (which could be and could not be what you want). .TP .B \-f \fINUM\fR, \fB\-\-first-ttl \fINUM Specifies with what TTL to start. Defaults to 1. .TP .B \-m \fINUM\fR, \fB\-\-max-ttl \fINUM Specifies the maximum number of hops (max time-to-live value) traceroute will probe. Default is 30. .TP .B \-U \fINUM\fR, \fB\-\-max-unknown \fINUM Specifies the maximum unknown host. Default is 5. .TP .B \-u\fR, \fB\-\-udp Use UDP datagrams instead of ICMP ECHO. .TP .B \-T\fR, \fB\-\-tcp Use TCP SYN packets instead of ICMP ECHO. .I PACKETSIZE is ignored, since SYN packets can not contain data. .TP .B \-S\fR, \fB\-\-sctp Use Stream Control Transmission Protocol packets instead of ICMP ECHO. .TP .B \-P \fIPORT\fR, \fB\-\-port \fIPORT The target port number for TCP/SCTP/UDP traces. .TP .B \-L \fILOCALPORT\fR, \fB\-\-localport \fILOCALPORT The source port number for UDP traces. .TP .B \-Z \fISECONDS\fR, \fB\-\-timeout \fISECONDS The number of seconds to keep probe sockets open before giving up on the connection. Using large values for this, especially combined with a short interval, will use up a lot of file descriptors. .TP .B \-M \fIMARK\fR, \fB\-\-mark \fIMARK Set the mark for each packet sent through this socket similar to the netfilter MARK target but socket-based. .I MARK is 32 unsigned integer. See .BR socket (7) for full description of this socket option. .SH ENVIRONMENT .B mtr recognizes a few environment variables. .TP .B MTR_OPTIONS This environment variable allows to specify options, as if they were passed on the command line. It is parsed before reading the actual command line options, so that options specified in .B MTR_OPTIONS are overridden by command-line options. Example: .BI MTR_OPTIONS ="-4\ -c\ 1" .B mtr .I \-6\ localhost would send one probe (because of .I -c\ 1\c ) towards .B ::1 (because of .IR -6 , which overrides the .I -4 passed in .B MTR_OPTIONS\c ). .TP .B MTR_PACKET A path to the .I mtr-packet executable, to be used for sending and receiving network probes. If .B MTR_PACKET is unset, the .B PATH will be used to search for an .I mtr-packet executable. .TP .B DISPLAY Specifies an X11 server for the GTK+ frontend. .SH BUGS Some modern routers give a lower priority to ICMP ECHO packets than to other network traffic. Consequently, the reliability of these routers reported by .B mtr will be significantly lower than the actual reliability of these routers. .SH CONTACT INFORMATION .PP For the latest version, see the mtr web page at .UR http://\:www.\:bitwizard.\:nl/\:mtr/ .UE .PP For patches, bug reports, or feature requests, please open an issue on GitHub at: .UR https://\:github\:.com/\:traviscross/\:mtr .UE . .SH "SEE ALSO" .BR mtr-packet (8), .BR traceroute (8), .BR ping (8), .BR socket (7), TCP/IP Illustrated (Stevens, ISBN 0201633469). mtr-0.92/man/mtr-packet.8.in0000664000175000017500000002224013031772644014613 0ustar wolffwolff.TH MTR-PACKET 8 "@VERSION@" "mtr-packet" "System Administration" .HP 7 .SH NAME mtr-packet - send and receive network probes .SH DESCRIPTION .B mtr-packet is a tool for sending network probes to measure network connectivity and performance. Many network probes can be sent simultaneously by a single process instance of .B mtr-packet and additional probes can be generated by an instance of .B mtr-packet which already has network probes in flight. It is intended to be used by programs which invoke it with Unix pipes attached to its standard input and output streams. .LP .B mtr-packet reads command requests from .IR stdin , each separated by a newline character, and responds with command replies to .IR stdout , also each separated by a newline character. The syntactic structure of requests and replies are the same. The following format is used: .LP .RS .I TOKEN .I COMMAND [\c .I ARGUMENT-NAME .I ARGUMENT-VALUE \&...] .RE .LP .I TOKEN is a unique integer value. The same value will be used as the .I TOKEN for the response. This is necessary for associating replies with requests, as commands may be completed in a different order than they are requested. The invoker of .B mtr-packet should always use the .I TOKEN value to determine which command request has completed. .LP .I COMMAND is a string identifying the command request type. A common command is .BR send-probe , which will transmit one network probe. .LP .I ARGUMENT-NAME strings and .I ARGUMENT-VALUE strings always come in pairs. It is a syntactic error to provide an .I ARGUMENT-NAME without a corresponding .IR ARGUMENT-VALUE . Valid .I ARGUMENT-NAME strings depend on the .I COMMAND being used. .SH REQUESTS .TP .B send-probe Send a network probe to a particular IP address. Either an .B ip-4 or .B ip-6 argument must be provided. A valid .B send-probe command will reply with .BR reply , .BR no-reply , or .BR ttl-expired . .IP The following arguments may be used: .IP .B ip-4 .I IP-ADDRESS .HP 14 .IP The Internet Protocol version 4 address to probe. .HP 7 .IP .B ip-6 .I IP-ADDRESS .HP 14 .IP The Internet Protocol version 6 address to probe. .HP 7 .IP .B protocol .I PROTOCOL .HP 14 .IP The protocol to use for the network probe. .BR icmp , .BR sctp , .BR tcp , and .B udp may be used. The default protocol is .BR icmp. .HP 7 .IP .B port .I PORT-NUMBER .HP 14 .IP The destination port to use for .BR sctp , .BR tcp , or .B udp probes. .HP 7 .IP .B local-ip-4 .I IP-ADDRESS .HP 14 .IP The local Internet Procol version 4 address to use when sending probes. .HP 7 .IP .B local-ip-6 .I IP-ADDRESS .HP 14 .IP The local Internet Protocol version 6 address to use when sending probes. .HP 7 .IP .B local-port .I PORT-NUMBER .HP 14 .IP For .B udp probes, the local port number from which to send probes. .HP 7 .IP .B timeout .I TIMEOUT-SECONDS .HP 14 .IP The number of seconds to wait for a response to the probe before discarding the probe as lost, and generating a .B no-reply command reply. .HP 7 .IP .B ttl .I TIME-TO-LIVE .HP 14 .IP The time-to-live value for the Internet Protocol packet header used in constructing the probe. This value determines the number of network hops through which the probe will travel before a response is generated by an intermediate network host. .HP 7 .IP .B size .I PACKET-SIZE .HP 14 .IP The size of the packet used to send the probe, in bytes, including the Internet Protocol header and transport protocol header. .HP 7 .IP .B bit-pattern .I PATTERN-VALUE .HP 14 .IP The packet payload is filled with bytes of the value specified. Valid pattern values are in the range 0 through 255. .HP 7 .IP .IP .B tos .I TYPE-OF-SERVICE .HP 14 .IP In the case of IPv4, the "type of service" field in the IP header is set to this value. In the case of IPv6, the "traffic class" field is set. .HP 7 .IP .B mark .I ROUTING-MARK .HP 14 .IP The packet mark value to be used by mark-based routing. (Available only on Linux.) .HP 7 .TP .B check-support Check for support for a particular feature in this version of .B mtr-packet and in this particular operating environment. .B check-support will reply with .BR feature-supported . A .B feature argument is required. .HP 7 .IP .B feature .I FEATURE-NAME .HP 14 .IP The name of a feature requested. .HP 7 .IP Some features which can be checked are .BR send-probe , .BR ip-4 , .BR ip-6 , .BR icmp , .BR sctp , .BR tcp , .BR udp , and .BR mark . The feature .B version can be checked to retrieve the version of .BR mtr-packet . .SH REPLIES .TP .B reply The destination host received the .B send-probe probe and replied. Arguments of .B reply are: .HP 7 .IP .B ip-4 .I IP-ADDRESS .HP 14 .IP The Internet Protocol version 4 address of the host which replied to the probe. .HP 7 .IP .B ip-6 .I IP-ADDRESS .HP 14 .IP The Internet Protocol version 6 address of the host which replied to the probe. .HP 7 .IP .B round-trip-time .I TIME .HP 14 .IP The time which passed between the transmission of the probe and its response. The time is provided as a integral number of microseconds elapsed. .HP 7 .TP .B no-reply No response to the probe request was received before the timeout expired. .TP .B ttl-expired The time-to-live value of the transmitted probe expired before the probe arrived at its intended destination. Arguments of .B ttl-expired are: .HP 7 .IP .B ip-4 .I IP-ADDRESS .HP 14 .IP The Internet Protocol version 4 address of the host at which the time-to-live value expired. .HP 7 .IP .B ip-6 .I IP-ADDRESS .HP 14 .IP The Internet Protocol version 6 address of the host at which the time-to-live value expired. .HP 7 .IP .B round-trip-time .I TIME .HP 14 .IP The time which passed between the transmission of the probe and its response. The time is provided as a integral number of microseconds elapsed. .HP 7 .IP .B mpls .I MPLS-LABEL-LIST .HP 14 .IP A list of Multiprotocol Label Switching values returned with the probe response. If the .B mpls argument is present, one or more MPLS labels will be represented by a comma separated list of values. The values are provided in groups of four. The first four values in the list correspond to the first MPLS label, the next four values correspond to the second MPLS label, and so on. The values are provided in this order: .IR label , .IR experimental-use , .IR bottom-of-stack , .IR ttl . .HP 7 .TP .B no-route There was no route to the host used in a .B send-probe request. .TP .B network-down A probe could not be sent because the network is down. .TP .B probes-exhausted A probe could not be sent because there are already too many unresolved probes in flight. .TP .B permission-denied The operating system denied permission to send the probe with the specified options. .TP .B invalid-argument The command request contained arguments which are invalid. .TP .B feature-support A reply to provided to .B check-support indicating the availability of a particular feature. The argument provided is: .HP 7 .IP .B support .I PRESENT .HP 14 .IP In most cases, the .I PRESENT value will be either .BR ok , indicating the feature is supported, or .BR no , indicating no support for the feature. .IP In the case that .B version is the requested .IR FEATURE-NAME , the version of .B mtr-packet is provided as the .I PRESENT value. .HP 7 .IP .SH EXAMPLES A controlling program may start .B mtr-packet as a child process and issue the following command on .IR stdin : .LP .RS 42 send-probe ip-4 127.0.0.1 .RE .LP This will send a network probe to the loopback interface. When the probe completes, .B mtr-packet will provide a response on .I stdout such as the following: .LP .RS 42 reply ip-4 127.0.0.1 round-trip-time 126 .RE .LP This indicates that the loopback address replied to the probe, and the round-trip time of the probe was 126 microseconds. .LP In order to trace the route to a remote host, multiple .B send-probe commands, each with a different .B ttl value, are used. .LP .RS 11 send-probe ip-4 8.8.8.8 ttl 1 .RS 0 12 send-probe ip-4 8.8.8.8 ttl 2 .RS 0 13 send-probe ip-4 8.8.8.8 ttl 3 .RS 0 \&... .RE 0 .LP Each interemediate host would respond with a .B ttl-expired message, and the destination host would respond with a .BR reply : .LP .RS 11 ttl-expired ip-4 192.168.254.254 round-trip-time 1634 .RS 0 12 ttl-expired ip-4 184.19.243.240 round-trip-time 7609 .RS 0 13 ttl-expired ip-4 172.76.20.169 round-trip-time 8643 .RS 0 14 ttl-expired ip-4 74.40.1.101 round-trip-time 9755 .RS 0 15 ttl-expired ip-4 74.40.5.126 round-trip-time 10695 .RS 0 17 ttl-expired ip-4 108.170.245.97 round-trip-time 14077 .RS 0 16 ttl-expired ip-4 74.40.26.131 round-trip-time 15253 .RS 0 18 ttl-expired ip-4 209.85.245.101 round-trip-time 17080 .RS 0 19 reply ip-4 8.8.8.8 round-trip-time 17039 .RE 0 .LP Note that the replies in this example are printed out of order. (The reply to probe 17 arrives prior to the reply to probe 16.) This is the reason that it is important to send commands with unique token values, and to use those token values to match replies with their originating commands. .SH CONTACT INFORMATION .PP For the latest version, see the mtr web page at .UR http://\:www.\:bitwizard.\:nl/\:mtr/ .UE .PP For patches, bug reports, or feature requests, please open an issue on GitHub at: .UR https://\:github\:.com/\:traviscross/\:mtr .UE . .SH "SEE ALSO" .BR mtr (8), .BR icmp (7), .BR tcp (7), .BR udp (7), TCP/IP Illustrated (Stevens, ISBN 0201633469). mtr-0.92/depcomp0000755000175000017500000005601612441555431012653 0ustar wolffwolff#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2013 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 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. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # 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: mtr-0.92/configure0000775000175000017500000067314313114223645013212 0ustar wolffwolff#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for mtr 0.91.1-4c982. # # 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 \$(( 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: R.E.Wolff@BitWizard.nl about your system, including any $0: error possibly output before this message. Then install $0: a modern shell, or manually run the script under such a $0: shell if you do have one." fi exit 1 fi fi 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'" 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='mtr' PACKAGE_TARNAME='mtr' PACKAGE_VERSION='0.91.1-4c982' PACKAGE_STRING='mtr 0.91.1-4c982' PACKAGE_BUGREPORT='R.E.Wolff@BitWizard.nl' PACKAGE_URL='http://www.BitWizard.nl/mtr/' ac_unique_file="ui/mtr.c" # 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 BUILD_BASH_COMPLETION_FALSE BUILD_BASH_COMPLETION_TRUE bashcompletiondir RESOLV_LIBS WITH_IPINFO_FALSE WITH_IPINFO_TRUE WITH_CURSES_FALSE WITH_CURSES_TRUE WITH_GTK_FALSE WITH_GTK_TRUE GTK_LIBS GTK_CFLAGS WITH_GETOPT_FALSE WITH_GETOPT_TRUE WITH_ERROR_FALSE WITH_ERROR_TRUE CYGWIN_FALSE CYGWIN_TRUE PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG host_os host_vendor host_cpu host build_os build_vendor build_cpu build AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR 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 EGREP GREP CPP OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking enable_silent_rules with_gtk with_ncurses with_ipinfo enable_ipv6 with_bashcompletiondir enable_bash_completion ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR GTK_CFLAGS GTK_LIBS' # 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' 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 ;; -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 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 mtr 0.91.1-4c982 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] --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/mtr] --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 mtr 0.91.1-4c982:";; 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-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --disable-ipv6 Do not enable IPv6 --disable-bash-completion do not install bash completion files Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-gtk Build without the GTK+2.0 interface --without-ncurses Build without the ncurses interface --without-ipinfo Do not try to use ipinfo lookup at all --with-bashcompletiondir=DIR Bash completions directory 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 CPP C preprocessor PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path GTK_CFLAGS C compiler flags for GTK, overriding pkg-config GTK_LIBS linker flags for GTK, overriding pkg-config 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 . mtr home page: . _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 mtr configure 0.91.1-4c982 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_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_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 R.E.Wolff@BitWizard.nl ## ## ------------------------------------- ##" ) | 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_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_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_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid; break else as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=$ac_mid; break else as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid else as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval () { return $2; } static unsigned long int ulongval () { return $2; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : echo >>conftest.val; read $3 &5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # 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 # 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 mtr $as_me 0.91.1-4c982, 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 build-aux "$srcdir"/build-aux; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then 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 build-aux \"$srcdir\"/build-aux" "$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. # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` 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 ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #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 ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= fi if test "$MINIX" = yes; then $as_echo "#define _POSIX_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h $as_echo "#define _MINIX 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_safe_to_define___extensions__=yes else ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h $as_echo "#define _ALL_SOURCE 1" >>confdefs.h $as_echo "#define _GNU_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h 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"` 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 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 # 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='mtr' VERSION='0.91.1-4c982' 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 -' 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 # 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 # --enable-silent-rules # 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=0;; 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='\' # 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 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 { $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 # Check pkg-config availability. if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; 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" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi if test "$host_os" = cygwin; then CYGWIN_TRUE= CYGWIN_FALSE='#' else CYGWIN_TRUE='#' CYGWIN_FALSE= fi # Check bytes in types. # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned char" >&5 $as_echo_n "checking size of unsigned char... " >&6; } if ${ac_cv_sizeof_unsigned_char+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned char))" "ac_cv_sizeof_unsigned_char" "$ac_includes_default"; then : else if test "$ac_cv_type_unsigned_char" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (unsigned char) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_unsigned_char=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_char" >&5 $as_echo "$ac_cv_sizeof_unsigned_char" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_UNSIGNED_CHAR $ac_cv_sizeof_unsigned_char _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned short" >&5 $as_echo_n "checking size of unsigned short... " >&6; } if ${ac_cv_sizeof_unsigned_short+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned short))" "ac_cv_sizeof_unsigned_short" "$ac_includes_default"; then : else if test "$ac_cv_type_unsigned_short" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (unsigned short) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_unsigned_short=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_short" >&5 $as_echo "$ac_cv_sizeof_unsigned_short" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_UNSIGNED_SHORT $ac_cv_sizeof_unsigned_short _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned int" >&5 $as_echo_n "checking size of unsigned int... " >&6; } if ${ac_cv_sizeof_unsigned_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned int))" "ac_cv_sizeof_unsigned_int" "$ac_includes_default"; then : else if test "$ac_cv_type_unsigned_int" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (unsigned int) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_unsigned_int=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_int" >&5 $as_echo "$ac_cv_sizeof_unsigned_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_UNSIGNED_INT $ac_cv_sizeof_unsigned_int _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned long" >&5 $as_echo_n "checking size of unsigned long... " >&6; } if ${ac_cv_sizeof_unsigned_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned long))" "ac_cv_sizeof_unsigned_long" "$ac_includes_default"; then : else if test "$ac_cv_type_unsigned_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (unsigned long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_unsigned_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_long" >&5 $as_echo "$ac_cv_sizeof_unsigned_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_UNSIGNED_LONG $ac_cv_sizeof_unsigned_long _ACEOF # Check headers. for ac_header in \ arpa/nameser_compat.h \ curses.h \ cursesX.h \ error.h \ fcntl.h \ linux/icmp.h \ ncurses.h \ ncurses/curses.h \ netinet/in.h \ socket.h \ sys/cdefs.h \ sys/limits.h \ sys/socket.h \ stdio_ext.h \ sys/types.h \ sys/xti.h \ values.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Check functions. for ac_func in \ __fpending \ fcntl \ 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 ac_fn_c_check_func "$LINENO" "error" "ac_cv_func_error" if test "x$ac_cv_func_error" = xyes; then : with_error=no else for ac_func in verr verrx vwarn vwarnx 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 with_error=yes else as_fn_error $? "cannot find working error printing function" "$LINENO" 5 fi done fi if test "x$with_error" = "xyes"; then WITH_ERROR_TRUE= WITH_ERROR_FALSE='#' else WITH_ERROR_TRUE='#' WITH_ERROR_FALSE= fi ac_fn_c_check_func "$LINENO" "getopt_long" "ac_cv_func_getopt_long" if test "x$ac_cv_func_getopt_long" = xyes; then : with_getopt=no else with_getopt=yes fi if test "x$with_getopt" = "xno"; then : $as_echo "#define HAVE_GETOPT 1" >>confdefs.h fi if test "x$with_getopt" = "xyes"; then WITH_GETOPT_TRUE= WITH_GETOPT_FALSE='#' else WITH_GETOPT_TRUE='#' WITH_GETOPT_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for floor in -lm" >&5 $as_echo_n "checking for floor in -lm... " >&6; } if ${ac_cv_lib_m_floor+:} 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 floor (); int main () { return floor (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_floor=yes else ac_cv_lib_m_floor=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_floor" >&5 $as_echo "$ac_cv_lib_m_floor" >&6; } if test "x$ac_cv_lib_m_floor" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF LIBS="-lm $LIBS" else as_fn_error $? "No math library found" "$LINENO" 5 fi # Find GTK # Check whether --with-gtk was given. if test "${with_gtk+set}" = set; then : withval=$with_gtk; else with_gtk=yes fi if test "x$with_gtk" = "xyes"; then : pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTK" >&5 $as_echo_n "checking for GTK... " >&6; } if test -n "$GTK_CFLAGS"; then pkg_cv_GTK_CFLAGS="$GTK_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk+-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "gtk+-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GTK_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$GTK_LIBS"; then pkg_cv_GTK_LIBS="$GTK_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk+-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "gtk+-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GTK_LIBS=`$PKG_CONFIG --libs "gtk+-2.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then GTK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gtk+-2.0" 2>&1` else GTK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gtk+-2.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$GTK_PKG_ERRORS" >&5 with_gtk=no elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } with_gtk=no else GTK_CFLAGS=$pkg_cv_GTK_CFLAGS GTK_LIBS=$pkg_cv_GTK_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define HAVE_GTK 1" >>confdefs.h fi fi if test "x$with_gtk" = xyes; then WITH_GTK_TRUE= WITH_GTK_FALSE='#' else WITH_GTK_TRUE='#' WITH_GTK_FALSE= fi # Find ncurses # Check whether --with-ncurses was given. if test "${with_ncurses+set}" = set; then : withval=$with_ncurses; else with_ncurses=yes fi if test "x$with_ncurses" = "xyes"; then : # Prefer ncurses over curses, if both are available. # (On Solaris 11.3, ncurses builds and links for us, but curses does not.) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing initscr" >&5 $as_echo_n "checking for library containing initscr... " >&6; } if ${ac_cv_search_initscr+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char initscr (); int main () { return initscr (); ; return 0; } _ACEOF for ac_lib in '' ncurses curses; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_initscr=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_initscr+:} false; then : break fi done if ${ac_cv_search_initscr+:} false; then : else ac_cv_search_initscr=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_initscr" >&5 $as_echo "$ac_cv_search_initscr" >&6; } ac_res=$ac_cv_search_initscr if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" $as_echo "#define HAVE_CURSES 1" >>confdefs.h else with_ncurses=no fi fi if test "x$with_ncurses" = xyes; then WITH_CURSES_TRUE= WITH_CURSES_FALSE='#' else WITH_CURSES_TRUE='#' WITH_CURSES_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cap_set_proc in -lcap" >&5 $as_echo_n "checking for cap_set_proc in -lcap... " >&6; } if ${ac_cv_lib_cap_cap_set_proc+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcap $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 cap_set_proc (); int main () { return cap_set_proc (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_cap_cap_set_proc=yes else ac_cv_lib_cap_cap_set_proc=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_cap_cap_set_proc" >&5 $as_echo "$ac_cv_lib_cap_cap_set_proc" >&6; } if test "x$ac_cv_lib_cap_cap_set_proc" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBCAP 1 _ACEOF LIBS="-lcap $LIBS" else if test "$host_os" = linux-gnu; then : { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Capabilities support is strongly recommended for increased security. See SECURITY for more information." >&5 $as_echo "$as_me: WARNING: Capabilities support is strongly recommended for increased security. See SECURITY for more information." >&2;} fi fi # Enable ipinfo # Check whether --with-ipinfo was given. if test "${with_ipinfo+set}" = set; then : withval=$with_ipinfo; else with_ipinfo=yes fi if test "x$with_ipinfo" = "xyes"; then WITH_IPINFO_TRUE= WITH_IPINFO_FALSE='#' else WITH_IPINFO_TRUE='#' WITH_IPINFO_FALSE= fi if test "x$with_ipinfo" = "xyes"; then : $as_echo "#define HAVE_IPINFO 1" >>confdefs.h fi # Check whether --enable-ipv6 was given. if test "${enable_ipv6+set}" = set; then : enableval=$enable_ipv6; WANTS_IPV6=$enableval else WANTS_IPV6=yes fi if test "x$WANTS_IPV6" = "xyes"; then : $as_echo "#define ENABLE_IPV6 1" >>confdefs.h USES_IPV6=yes fi ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket" if test "x$ac_cv_func_socket" = xyes; then : else { $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" else as_fn_error $? "No socket library found" "$LINENO" 5 fi fi ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" if test "x$ac_cv_func_gethostbyname" = xyes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; } if ${ac_cv_lib_nsl_gethostbyname+:} 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 gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_gethostbyname=yes else ac_cv_lib_nsl_gethostbyname=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_gethostbyname" >&5 $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNSL 1 _ACEOF LIBS="-lnsl $LIBS" else as_fn_error $? "No nameservice library found" "$LINENO" 5 fi fi # Find resolver library. ac_fn_c_check_func "$LINENO" "res_query" "ac_cv_func_res_query" if test "x$ac_cv_func_res_query" = xyes; then : RESOLV_LIBS="" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __res_query in -lresolv" >&5 $as_echo_n "checking for __res_query in -lresolv... " >&6; } if ${ac_cv_lib_resolv___res_query+:} 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 __res_query (); int main () { return __res_query (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_resolv___res_query=yes else ac_cv_lib_resolv___res_query=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___res_query" >&5 $as_echo "$ac_cv_lib_resolv___res_query" >&6; } if test "x$ac_cv_lib_resolv___res_query" = xyes; then : RESOLV_LIBS="-lresolv" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_query in -lresolv" >&5 $as_echo_n "checking for res_query in -lresolv... " >&6; } if ${ac_cv_lib_resolv_res_query+:} 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 res_query (); int main () { return res_query (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_resolv_res_query=yes else ac_cv_lib_resolv_res_query=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_res_query" >&5 $as_echo "$ac_cv_lib_resolv_res_query" >&6; } if test "x$ac_cv_lib_resolv_res_query" = xyes; then : RESOLV_LIBS="-lresolv" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_query in -lbind" >&5 $as_echo_n "checking for res_query in -lbind... " >&6; } if ${ac_cv_lib_bind_res_query+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbind $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 res_query (); int main () { return res_query (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_bind_res_query=yes else ac_cv_lib_bind_res_query=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_bind_res_query" >&5 $as_echo "$ac_cv_lib_bind_res_query" >&6; } if test "x$ac_cv_lib_bind_res_query" = xyes; then : RESOLV_LIBS="-lbind" else as_fn_error $? "No resolver library found" "$LINENO" 5 fi fi fi fi if test "x" = "x$RESOLV_LIBS"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dn_expand in -lresolv" >&5 $as_echo_n "checking for dn_expand in -lresolv... " >&6; } if ${ac_cv_lib_resolv_dn_expand+:} 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 dn_expand (); int main () { return dn_expand (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_resolv_dn_expand=yes else ac_cv_lib_resolv_dn_expand=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_dn_expand" >&5 $as_echo "$ac_cv_lib_resolv_dn_expand" >&6; } if test "x$ac_cv_lib_resolv_dn_expand" = xyes; then : RESOLV_LIBS="-lresolv" fi fi # Check errno and socket data types. ac_fn_c_check_decl "$LINENO" "errno" "ac_cv_have_decl_errno" " #include #include " if test "x$ac_cv_have_decl_errno" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_ERRNO $ac_have_decl _ACEOF ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include #ifdef HAVE_SOCKET_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif " if test "x$ac_cv_type_socklen_t" = xyes; then : $as_echo "#define HAVE_SOCKLEN_T /**/" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "time_t" "ac_cv_type_time_t" " #include " if test "x$ac_cv_type_time_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_TIME_T 1 _ACEOF fi # Add C flags to display more warnings { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C flags to get more warnings" >&5 $as_echo_n "checking for C flags to get more warnings... " >&6; } ac_save_CFLAGS="$CFLAGS" if test "x$ac_cv_c_compiler_gnu" = "xyes"; then : warning_CFLAGS="-Wall" # Check if compiler supports -Wno-pointer-sign and add it if supports CFLAGS_saved="$CFLAGS" CFLAGS="$CFLAGS -Wno-pointer-sign" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : warning_CFLAGS="${warning_CFLAGS} -Wno-pointer-sign" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS="$CFLAGS_saved" else case $host_os in #( irix*) : CFLAGS="$CFLAGS -fullwarn" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("test"); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : warning_CFLAGS="-fullwarn" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; #( sunos*) : if test "$CC" = "acc"; then : CFLAGS="$CFLAGS -vc" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { printf("test"); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : warning_CFLAGS="-vc" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi * ;; #( *) : warning_CFLAGS="none" ;; esac fi CFLAGS="$ac_save_CFLAGS" if test "$warning_CFLAGS" = "none"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } else CFLAGS="$CFLAGS $warning_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $warning_CFLAGS" >&5 $as_echo "$warning_CFLAGS" >&6; } fi # bash-completion # Check whether --with-bashcompletiondir was given. if test "${with_bashcompletiondir+set}" = set; then : withval=$with_bashcompletiondir; else if `$PKG_CONFIG --exists bash-completion`; then : with_bashcompletiondir=`$PKG_CONFIG --variable=completionsdir bash-completion` else with_bashcompletiondir=${datadir}/bash-completion/completions fi fi bashcompletiondir=$with_bashcompletiondir # Check whether --enable-bash-completion was given. if test "${enable_bash_completion+set}" = set; then : enableval=$enable_bash_completion; else enable_bash_completion=yes fi if test "x$enable_bash_completion" = xyes; then BUILD_BASH_COMPLETION_TRUE= BUILD_BASH_COMPLETION_FALSE='#' else BUILD_BASH_COMPLETION_TRUE='#' BUILD_BASH_COMPLETION_FALSE= fi # Prepare config.h, Makefile, and output them. ac_config_headers="$ac_config_headers config.h" ac_config_files="$ac_config_files 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 -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 -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${CYGWIN_TRUE}" && test -z "${CYGWIN_FALSE}"; then as_fn_error $? "conditional \"CYGWIN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_ERROR_TRUE}" && test -z "${WITH_ERROR_FALSE}"; then as_fn_error $? "conditional \"WITH_ERROR\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_GETOPT_TRUE}" && test -z "${WITH_GETOPT_FALSE}"; then as_fn_error $? "conditional \"WITH_GETOPT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_GTK_TRUE}" && test -z "${WITH_GTK_FALSE}"; then as_fn_error $? "conditional \"WITH_GTK\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_CURSES_TRUE}" && test -z "${WITH_CURSES_FALSE}"; then as_fn_error $? "conditional \"WITH_CURSES\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_IPINFO_TRUE}" && test -z "${WITH_IPINFO_FALSE}"; then as_fn_error $? "conditional \"WITH_IPINFO\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_BASH_COMPLETION_TRUE}" && test -z "${BUILD_BASH_COMPLETION_FALSE}"; then as_fn_error $? "conditional \"BUILD_BASH_COMPLETION\" 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 mtr $as_me 0.91.1-4c982, 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 . mtr home page: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ mtr config.status 0.91.1-4c982 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" _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" ;; "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES 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 } ;; 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 mtr-0.92/COPYING0000664000175000017500000004325413034463046012332 0ustar wolffwolff GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. mtr-0.92/ui/0000775000175000017500000000000013114223576011705 5ustar wolffwolffmtr-0.92/ui/dns.c0000664000175000017500000001626613045551745012655 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Non-blocking DNS portion -- Copyright (C) 1998 by Simon Kirby Released under GPL, as above. */ #include "config.h" #ifdef HAVE_ERROR_H #include #else #include "portability/error.h" #endif #include #include #include #include #include #include #include #include "mtr.h" #include "dns.h" #include "net.h" #include "utils.h" struct dns_results { ip_t ip; char *name; struct dns_results *next; }; static struct dns_results *results; char *strlongip( struct mtr_ctl *ctl, ip_t * ip) { #ifdef ENABLE_IPV6 static char addrstr[INET6_ADDRSTRLEN]; return (char *) inet_ntop(ctl->af, ip, addrstr, sizeof addrstr); #else return inet_ntoa(*ip); #endif } #ifdef ENABLE_IPV6 #define UNUSED_IF_NO_IPV6 /* empty */ #else #define UNUSED_IF_NO_IPV6 ATTRIBUTE_UNUSED #endif static int todns[2], fromdns[2]; static FILE *fromdnsfp; static int longipstr( char *s, ip_t * dst, int family UNUSED_IF_NO_IPV6) { #ifdef ENABLE_IPV6 return inet_pton(family, s, dst); #else return inet_aton(s, dst); #endif } struct hostent *dns_forward( const char *name) { struct hostent *host; if ((host = gethostbyname(name))) return host; else return NULL; } static struct dns_results *findip( struct mtr_ctl *ctl, ip_t * ip) { struct dns_results *t; for (t = results; t; t = t->next) { if (addrcmp((void *) ip, (void *) &t->ip, ctl->af) == 0) return t; } return NULL; } static void set_sockaddr_ip( struct mtr_ctl *ctl, struct sockaddr_storage *sa, ip_t * ip) { struct sockaddr_in *sa_in; struct sockaddr_in6 *sa_in6; memset(sa, 0, sizeof(struct sockaddr_storage)); switch (ctl->af) { case AF_INET: sa_in = (struct sockaddr_in *) sa; sa_in->sin_family = ctl->af; addrcpy((void *) &sa_in->sin_addr, (void *) ip, ctl->af); break; case AF_INET6: sa_in6 = (struct sockaddr_in6 *) sa; sa_in6->sin6_family = ctl->af; addrcpy((void *) &sa_in6->sin6_addr, (void *) ip, ctl->af); break; } } void dns_open( struct mtr_ctl *ctl) { int pid; if (pipe(todns) < 0) { error(EXIT_FAILURE, errno, "can't make a pipe for DNS process"); } if (pipe(fromdns) < 0) { error(EXIT_FAILURE, errno, "can't make a pipe for DNS process"); } fflush(stdout); pid = fork(); if (pid < 0) { error(EXIT_FAILURE, errno, "can't fork for DNS process"); } if (pid == 0) { char buf[2048]; int i; FILE *infp; /* Automatically reap children. */ if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) { error(EXIT_FAILURE, errno, "signal"); } /* Close all unneccessary FDs. for debugging and error reporting, keep std-in/out/err. */ for (i = 3; i < fromdns[1]; i++) { if (i == todns[0]) continue; if (i == fromdns[1]) continue; close(i); } infp = fdopen(todns[0], "r"); while (fgets(buf, sizeof(buf), infp)) { ip_t host; struct sockaddr_storage sa; socklen_t salen; char hostname[NI_MAXHOST]; char result[INET6_ADDRSTRLEN + NI_MAXHOST + 2]; if (!fork()) { int rv; buf[strlen(buf) - 1] = 0; /* chomp newline. */ longipstr(buf, &host, ctl->af); set_sockaddr_ip(ctl, &sa, &host); salen = (ctl->af == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6); rv = getnameinfo((struct sockaddr *) &sa, salen, hostname, sizeof(hostname), NULL, 0, 0); if (rv == 0) { snprintf(result, sizeof(result), "%s %s\n", strlongip(ctl, &host), hostname); rv = write(fromdns[1], result, strlen(result)); if (rv < 0) error(0, errno, "write DNS lookup result"); } exit(EXIT_SUCCESS); } } exit(EXIT_SUCCESS); } else { int flags; /* the parent. */ close(todns[0]); /* close the pipe ends we don't need. */ close(fromdns[1]); fromdnsfp = fdopen(fromdns[0], "r"); flags = fcntl(fromdns[0], F_GETFL, 0); flags |= O_NONBLOCK; fcntl(fromdns[0], F_SETFL, flags); } } int dns_waitfd( void) { return fromdns[0]; } void dns_ack( struct mtr_ctl *ctl) { char buf[2048], host[NI_MAXHOST], name[NI_MAXHOST]; ip_t hostip; struct dns_results *r; while (fgets(buf, sizeof(buf), fromdnsfp)) { sscanf(buf, "%s %s", host, name); longipstr(host, &hostip, ctl->af); r = findip(ctl, &hostip); if (r) r->name = xstrdup(name); else error(0, 0, "dns_ack: Couldn't find host %s", host); } } #ifdef ENABLE_IPV6 int dns_waitfd6( void) { return -1; } void dns_ack6( void) { return; } #endif char *dns_lookup2( struct mtr_ctl *ctl, ip_t * ip) { struct dns_results *r; char buf[INET6_ADDRSTRLEN + 1]; int rv; r = findip(ctl, ip); if (r) { /* we've got a result. */ if (r->name) return r->name; else return strlongip(ctl, ip); } else { r = xmalloc(sizeof(struct dns_results)); memcpy(&r->ip, ip, sizeof(r->ip)); r->name = NULL; r->next = results; results = r; snprintf(buf, sizeof(buf), "%s\n", strlongip(ctl, ip)); rv = write(todns[1], buf, strlen(buf)); if (rv < 0) error(0, errno, "couldn't write to resolver process"); } return strlongip(ctl, ip); } char *dns_lookup( struct mtr_ctl *ctl, ip_t * ip) { char *t; if (!ctl->dns || !ctl->use_dns) return NULL; t = dns_lookup2(ctl, ip); return t; } /* XXX check if necessary/exported. */ /* Resolve an IP address to a hostname. */ struct hostent *addr2host( const char *addr, int family) { int len = 0; switch (family) { case AF_INET: len = sizeof(struct in_addr); break; #ifdef ENABLE_IPV6 case AF_INET6: len = sizeof(struct in6_addr); break; #endif } return gethostbyaddr(addr, len, family); } mtr-0.92/ui/display.c0000664000175000017500000001061213045551745013523 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include #include #include #include #include "mtr.h" #include "display.h" #include "report.h" #include "select.h" #include "raw.h" #include "dns.h" #include "asn.h" #ifdef HAVE_CURSES #include "mtr-curses.h" #endif #ifdef HAVE_GTK #include "mtr-gtk.h" #endif #include "split.h" #ifdef HAVE_CURSES #define DEFAULT_DISPLAY DisplayCurses #else #define DEFAULT_DISPLAY DisplayReport #endif #ifdef HAVE_GTK #define UNUSED_IF_NO_GTK /* empty */ #else #define UNUSED_IF_NO_GTK ATTRIBUTE_UNUSED #endif void display_detect( struct mtr_ctl *ctl, int *argc UNUSED_IF_NO_GTK, char ***argv UNUSED_IF_NO_GTK) { ctl->DisplayMode = DEFAULT_DISPLAY; #ifdef HAVE_GTK if (gtk_detect(argc, argv)) { ctl->DisplayMode = DisplayGTK; } #endif } void display_open( struct mtr_ctl *ctl) { switch (ctl->DisplayMode) { case DisplayReport: report_open(); break; case DisplayTXT: txt_open(); break; case DisplayJSON: json_open(); break; case DisplayXML: xml_open(); break; case DisplayCSV: csv_open(); break; #ifdef HAVE_CURSES case DisplayCurses: mtr_curses_open(ctl); #ifdef HAVE_IPINFO asn_open(ctl); #endif break; #endif case DisplaySplit: split_open(); break; #ifdef HAVE_GTK case DisplayGTK: gtk_open(ctl); #ifdef HAVE_IPINFO asn_open(ctl); #endif break; #endif } } void display_close( struct mtr_ctl *ctl) { time_t now; now = time(NULL); switch (ctl->DisplayMode) { case DisplayReport: report_close(ctl); break; case DisplayTXT: txt_close(ctl); break; case DisplayJSON: json_close(ctl); break; case DisplayXML: xml_close(ctl); break; case DisplayCSV: csv_close(ctl, now); break; #ifdef HAVE_CURSES case DisplayCurses: #ifdef HAVE_IPINFO asn_close(ctl); #endif mtr_curses_close(); break; #endif case DisplaySplit: split_close(); break; #ifdef HAVE_GTK case DisplayGTK: gtk_close(); break; #endif } } void display_redraw( struct mtr_ctl *ctl) { switch (ctl->DisplayMode) { #ifdef HAVE_CURSES case DisplayCurses: mtr_curses_redraw(ctl); break; #endif case DisplaySplit: split_redraw(ctl); break; #ifdef HAVE_GTK case DisplayGTK: gtk_redraw(ctl); break; #endif } } int display_keyaction( struct mtr_ctl *ctl) { switch (ctl->DisplayMode) { #ifdef HAVE_CURSES case DisplayCurses: return mtr_curses_keyaction(ctl); #endif case DisplaySplit: return split_keyaction(); #ifdef HAVE_GTK case DisplayGTK: return gtk_keyaction(); #endif } return 0; } void display_rawxmit( struct mtr_ctl *ctl, int host, int seq) { if (ctl->DisplayMode == DisplayRaw) raw_rawxmit(host, seq); } void display_rawping( struct mtr_ctl *ctl, int host, int msec, int seq) { if (ctl->DisplayMode == DisplayRaw) raw_rawping(ctl, host, msec, seq); } void display_rawhost( struct mtr_ctl *ctl, int host, ip_t * ip_addr) { if (ctl->DisplayMode == DisplayRaw) raw_rawhost(ctl, host, ip_addr); } void display_loop( struct mtr_ctl *ctl) { #ifdef HAVE_GTK if (ctl->DisplayMode == DisplayGTK) gtk_loop(ctl); else #endif select_loop(ctl); } void display_clear( struct mtr_ctl *ctl) { #ifdef HAVE_CURSES if (ctl->DisplayMode == DisplayCurses) mtr_curses_clear(ctl); #endif } mtr-0.92/ui/mtr-gtk.h0000664000175000017500000000200713045551745013447 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Prototypes for gtk.c */ extern int gtk_detect( int *argc, char ***argv); extern void gtk_open( struct mtr_ctl *ctl); extern void gtk_close( void); extern void gtk_redraw( struct mtr_ctl *ctl); extern int gtk_keyaction( void); extern void gtk_loop( struct mtr_ctl *ctl); mtr-0.92/ui/utils.c0000664000175000017500000001026413045551745013221 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include #include #include #include #include #include #include #include #include #ifdef HAVE_ERROR_H #include #else #include "portability/error.h" #endif #ifdef HAVE_STDIO_EXT_H #include #endif #include "utils.h" char *trim( char *str, const char c) { char *p = str; size_t len; /* left trim */ while (*p && (isspace((unsigned char) *p) || (c && *p == c))) p++; if (str < p) { len = strlen(str); memmove(str, p, len + 1); } /* right trim */ len = strlen(str); while (len) { len--; if (isspace((unsigned char) str[len]) || (c && str[len] == c)) { continue; } len++; break; } str[len] = '\0'; return str; } /* Parse string, and return positive signed int. */ int strtonum_or_err( const char *str, const char *errmesg, const int type) { unsigned long int num; char *end = NULL; if (str != NULL && *str != '\0') { errno = 0; num = strtoul(str, &end, 10); if (errno == 0 && str != end && end != NULL && *end == '\0') { switch (type) { case STRTO_INT: if (num < INT_MAX) return num; break; case STRTO_U32INT: if (num < UINT32_MAX) return num; break; } } } error(EXIT_FAILURE, errno, "%s: '%s'", errmesg, str); return 0; } float strtofloat_or_err( const char *str, const char *errmesg) { double num; char *end = NULL; if (str != NULL && *str != '\0') { errno = 0; num = strtod(str, &end); if (errno == 0 && str != end && end != NULL && *end == '\0' #ifdef FLT_MAX && num < FLT_MAX #endif ) return num; } error(EXIT_FAILURE, errno, "%s: '%s'", errmesg, str); return 0; } void *xmalloc( const size_t size) { void *ret = malloc(size); if (!ret && size) error(EXIT_FAILURE, errno, "cannot allocate %zu bytes", size); return ret; } char *xstrdup( const char *str) { char *ret; if (!str) return NULL; ret = strdup(str); if (!ret) error(EXIT_FAILURE, errno, "cannot duplicate string: %s", str); return ret; } #ifndef HAVE___FPENDING static inline int __fpending( FILE * stream __attribute__ ((__unused__))) { return 0; } #endif static inline int close_stream( FILE * stream) { const int some_pending = (__fpending(stream) != 0); const int prev_fail = (ferror(stream) != 0); const int fclose_fail = (fclose(stream) != 0); if (prev_fail || (fclose_fail && (some_pending || errno != EBADF))) { if (!fclose_fail && !(errno == EPIPE)) errno = 0; return EOF; } return 0; } /* Meant to be used atexit(close_stdout); */ void close_stdout( void) { if (close_stream(stdout) != 0 && !(errno == EPIPE)) { error(0, errno, "write error"); _exit(EXIT_FAILURE); } if (close_stream(stderr) != 0) _exit(EXIT_FAILURE); } /* ctime() replacement that will reteturn ISO-8601 timestamp string such as: * 2016-08-29T19:25:02+01:00 */ const char *iso_time( const time_t * t) { static char s[32]; struct tm *tm; tm = localtime(t); strftime(s, sizeof(s), "%Y-%m-%dT%H:%M:%S%z", tm); return s; } mtr-0.92/ui/select.c0000664000175000017500000002013013045551745013331 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_ERROR_H #include #else #include "portability/error.h" #endif #include "mtr.h" #include "dns.h" #include "net.h" #include "asn.h" #include "display.h" #include "select.h" void select_loop( struct mtr_ctl *ctl) { fd_set readfd; fd_set writefd; int anyset = 0; int maxfd = 0; int dnsfd, netfd; #ifdef ENABLE_IPV6 int dnsfd6; #endif int NumPing = 0; int paused = 0; struct timeval lasttime, thistime, selecttime; struct timeval startgrace; int dt; int rv; int graceperiod = 0; struct timeval intervaltime; static double dnsinterval = 0; memset(&startgrace, 0, sizeof(startgrace)); gettimeofday(&lasttime, NULL); while (1) { dt = calc_deltatime(ctl->WaitTime); intervaltime.tv_sec = dt / 1000000; intervaltime.tv_usec = dt % 1000000; FD_ZERO(&readfd); FD_ZERO(&writefd); maxfd = 0; if (ctl->Interactive) { FD_SET(0, &readfd); maxfd = 1; } #ifdef ENABLE_IPV6 if (ctl->dns) { dnsfd6 = dns_waitfd6(); if (dnsfd6 >= 0) { FD_SET(dnsfd6, &readfd); if (dnsfd6 >= maxfd) maxfd = dnsfd6 + 1; } else { dnsfd6 = 0; } } else dnsfd6 = 0; #endif if (ctl->dns) { dnsfd = dns_waitfd(); FD_SET(dnsfd, &readfd); if (dnsfd >= maxfd) maxfd = dnsfd + 1; } else dnsfd = 0; netfd = net_waitfd(); FD_SET(netfd, &readfd); if (netfd >= maxfd) maxfd = netfd + 1; do { if (anyset || paused) { /* Set timeout to 0.1s. * While this is almost instantaneous for human operators, * it's slow enough for computers to go do something else; * this prevents mtr from hogging 100% CPU time on one core. */ selecttime.tv_sec = 0; selecttime.tv_usec = paused ? 100000 : 0; rv = select(maxfd, (void *) &readfd, &writefd, NULL, &selecttime); } else { if (ctl->Interactive) display_redraw(ctl); gettimeofday(&thistime, NULL); if (thistime.tv_sec > lasttime.tv_sec + intervaltime.tv_sec || (thistime.tv_sec == lasttime.tv_sec + intervaltime.tv_sec && thistime.tv_usec >= lasttime.tv_usec + intervaltime.tv_usec)) { lasttime = thistime; if (!graceperiod) { if (NumPing >= ctl->MaxPing && (!ctl->Interactive || ctl->ForceMaxPing)) { graceperiod = 1; startgrace = thistime; } /* do not send out batch when we've already initiated grace period */ if (!graceperiod && net_send_batch(ctl)) NumPing++; } } if (graceperiod) { dt = (thistime.tv_usec - startgrace.tv_usec) + 1000000 * (thistime.tv_sec - startgrace.tv_sec); if ((ctl->GraceTime * 1000 * 1000) < dt) return; } selecttime.tv_usec = (thistime.tv_usec - lasttime.tv_usec); selecttime.tv_sec = (thistime.tv_sec - lasttime.tv_sec); if (selecttime.tv_usec < 0) { --selecttime.tv_sec; selecttime.tv_usec += 1000000; } selecttime.tv_usec = intervaltime.tv_usec - selecttime.tv_usec; selecttime.tv_sec = intervaltime.tv_sec - selecttime.tv_sec; if (selecttime.tv_usec < 0) { --selecttime.tv_sec; selecttime.tv_usec += 1000000; } if (ctl->dns) { if ((selecttime.tv_sec > (time_t) dnsinterval) || ((selecttime.tv_sec == (time_t) dnsinterval) && (selecttime.tv_usec > ((time_t) (dnsinterval * 1000000) % 1000000)))) { selecttime.tv_sec = (time_t) dnsinterval; selecttime.tv_usec = (time_t) (dnsinterval * 1000000) % 1000000; } } rv = select(maxfd, (void *) &readfd, NULL, NULL, &selecttime); } } while ((rv < 0) && (errno == EINTR)); if (rv < 0) { error(EXIT_FAILURE, errno, "Select failed"); } anyset = 0; /* Have we got new packets back? */ if (FD_ISSET(netfd, &readfd)) { net_process_return(ctl); anyset = 1; } if (ctl->dns) { /* Handle any pending resolver events */ dnsinterval = ctl->WaitTime; } /* Have we finished a nameservice lookup? */ #ifdef ENABLE_IPV6 if (ctl->dns && dnsfd6 && FD_ISSET(dnsfd6, &readfd)) { dns_ack6(); anyset = 1; } #endif if (ctl->dns && dnsfd && FD_ISSET(dnsfd, &readfd)) { dns_ack(ctl); anyset = 1; } /* Has a key been pressed? */ if (FD_ISSET(0, &readfd)) { switch (display_keyaction(ctl)) { case ActionQuit: return; break; case ActionReset: net_reset(ctl); break; case ActionDisplay: ctl->display_mode = (ctl->display_mode + 1) % DisplayModeMAX; break; case ActionClear: display_clear(ctl); break; case ActionPause: paused = 1; break; case ActionResume: paused = 0; break; case ActionMPLS: ctl->enablempls = !ctl->enablempls; display_clear(ctl); break; case ActionDNS: if (ctl->dns) { ctl->use_dns = !ctl->use_dns; display_clear(ctl); } break; #ifdef HAVE_IPINFO case ActionII: ctl->ipinfo_no++; if (ctl->ipinfo_no > ctl->ipinfo_max) ctl->ipinfo_no = 0; break; case ActionAS: ctl->ipinfo_no = ctl->ipinfo_no ? 0 : ctl->ipinfo_max; break; #endif case ActionScrollDown: ctl->display_offset += 5; break; case ActionScrollUp: ctl->display_offset -= 5; if (ctl->display_offset < 0) { ctl->display_offset = 0; } break; } anyset = 1; } } return; } mtr-0.92/ui/utils.h0000664000175000017500000000260313045551745013224 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball Copyright (C) 2005 R.E.Wolff@BitWizard.nl This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ enum { STRTO_INT, STRTO_U32INT }; extern char *trim( char *s, const char c); extern int strtonum_or_err( const char *str, const char *errmesg, const int type); extern float strtofloat_or_err( const char *str, const char *errmesg); /* Like strncpy(3) but ensure null termination. */ static inline void xstrncpy( char *dest, const char *src, size_t n) { strncpy(dest, src, n - 1); dest[n - 1] = 0; } extern void *xmalloc( const size_t size); extern char *xstrdup( const char *str); extern void close_stdout( void); extern const char *iso_time( const time_t * t); mtr-0.92/ui/gtk.c0000664000175000017500000006337313045551745012657 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball Changes/additions Copyright (C) 1998 R.E.Wolff@BitWizard.nl This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include #include #include #include #include #ifdef HAVE_GTK #include #include #include #include "mtr.h" #include "net.h" #include "dns.h" #include "asn.h" #include "mtr-gtk.h" #include "utils.h" #include "img/mtr_icon.xpm" #endif static gint gtk_ping( gpointer data); static gint Copy_activate( GtkWidget * widget, gpointer data); static gint NewDestination_activate( GtkWidget * widget, gpointer data); static gboolean ReportTreeView_clicked( GtkWidget * Tree, GdkEventButton * event, gpointer data); static gchar *getSelectedHost( GtkTreePath * path); static int ping_timeout_timer; static GtkWidget *Pause_Button; static GtkWidget *Entry; static GtkWidget *main_window; static void gtk_add_ping_timeout( struct mtr_ctl *ctl) { int dt; if (gtk_toggle_button_get_active((GtkToggleButton *) Pause_Button)) { return; } dt = calc_deltatime(ctl->WaitTime); gtk_redraw(ctl); ping_timeout_timer = g_timeout_add(dt / 1000, gtk_ping, ctl); } static void gtk_do_init( int *argc, char ***argv) { static int done = 0; if (!done) { gtk_init(argc, argv); done = 1; } } int gtk_detect( ATTRIBUTE_UNUSED int *argc, ATTRIBUTE_UNUSED char ***argv) { if (getenv("DISPLAY") != NULL) { /* If we do this here, gtk_init exits on an error. This happens BEFORE the user has had a chance to tell us not to use the display... */ return TRUE; } else { return FALSE; } } static gint Window_destroy( ATTRIBUTE_UNUSED GtkWidget * Window, ATTRIBUTE_UNUSED gpointer data) { gtk_main_quit(); return FALSE; } static gint Restart_clicked( ATTRIBUTE_UNUSED GtkWidget * Button, gpointer data) { struct mtr_ctl *ctl = (struct mtr_ctl *) data; net_reset(ctl); gtk_redraw(ctl); return FALSE; } static gint Pause_clicked( ATTRIBUTE_UNUSED GtkWidget * Button, gpointer data) { struct mtr_ctl *ctl = (struct mtr_ctl *) data; static int paused = 0; if (paused) { gtk_add_ping_timeout(ctl); } else { g_source_remove(ping_timeout_timer); } paused = !paused; gtk_redraw(ctl); return FALSE; } static gint About_clicked( ATTRIBUTE_UNUSED GtkWidget * Button, ATTRIBUTE_UNUSED gpointer data) { static const gchar *authors[] = { "Matt Kimball ", "Roger Wolff ", "Bohdan Vlasyuk ", "Evgeniy Tretyak ", "John Thacker ", "Juha Takala", "David Sward ", "David Stone ", "Andrew Stesin", "Greg Stark ", "Robert Sparks ", "Mike Simons ", "Aaron Scarisbrick,", "Craig Milo Rogers ", "Antonio Querubin ", "Russell Nelson ", "Davin Milun ", "Josh Martin ", "Alexander V. Lukyanov ", "Charles Levert ", "Bertrand Leconte ", "Anand Kumria", "Olav Kvittem ", "Adam Kramer ", "Philip Kizer ", "Simon Kirby", "Sami Kerola ", "Christophe Kalt", "Steve Kann ", "Brett Johnson ", "Roland Illig ", "Damian Gryski ", "Rob Foehl ", "Mircea Damian", "Cougar ", "Travis Cross ", "Brian Casey", "Andrew Brown ", "Bill Bogstad ", "Marc Bejarano ", "Moritz Barsnick ", "Thomas Klausner ", NULL }; gtk_show_about_dialog(GTK_WINDOW(main_window) , "version", PACKAGE_VERSION, "copyright", "Copyright \xc2\xa9 1997,1998 Matt Kimball", "website", "http://www.bitwizard.nl/mtr/", "authors", authors, "comments", "The 'traceroute' and 'ping' programs in a single network diagnostic tool.", "license", "This program is free software; you can redistribute it and/or modify\n" "it under the terms of the GNU General Public License version 2 as\n" "published by the Free Software Foundation.\n" "\n" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" "GNU General Public License for more details.", NULL); return TRUE; } /* * There is a small problem with the following code: * The timeout is canceled and removed in order to ensure that * it takes effect (consider what happens if you set the timeout to 999, * then try to undo the change); is a better approach possible? * * What's the problem with this? (-> "I don't think so) */ static gint WaitTime_changed( ATTRIBUTE_UNUSED GtkAdjustment * Adj, GtkWidget * data) { struct mtr_ctl *ctl = (struct mtr_ctl *) data; GtkWidget *Button = (GtkWidget *) ctl->gtk_data; ctl->WaitTime = gtk_spin_button_get_value(GTK_SPIN_BUTTON(Button)); g_source_remove(ping_timeout_timer); gtk_add_ping_timeout(ctl); gtk_redraw(ctl); return FALSE; } static gint Host_activate( GtkWidget * entry, gpointer data) { struct mtr_ctl *ctl = (struct mtr_ctl *) data; struct hostent *addr; addr = dns_forward(gtk_entry_get_text(GTK_ENTRY(entry))); if (addr) { net_reopen(ctl, addr); /* If we are "Paused" at this point it is usually because someone entered a non-existing host. Therefore do the go-ahead... */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Pause_Button), 0); } else { int pos = strlen(gtk_entry_get_text(GTK_ENTRY(entry))); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Pause_Button), 1); gtk_editable_insert_text(GTK_EDITABLE(entry), ": not found", -1, &pos); } return FALSE; } static void Toolbar_fill( struct mtr_ctl *ctl, GtkWidget * Toolbar) { GtkWidget *Button; GtkWidget *Label; GtkAdjustment *Adjustment; Button = gtk_button_new_from_stock(GTK_STOCK_QUIT); gtk_box_pack_end(GTK_BOX(Toolbar), Button, FALSE, FALSE, 0); g_signal_connect(GTK_OBJECT(Button), "clicked", GTK_SIGNAL_FUNC(Window_destroy), NULL); Button = gtk_button_new_from_stock(GTK_STOCK_ABOUT); gtk_box_pack_end(GTK_BOX(Toolbar), Button, FALSE, FALSE, 0); g_signal_connect(GTK_OBJECT(Button), "clicked", GTK_SIGNAL_FUNC(About_clicked), NULL); Button = gtk_button_new_with_mnemonic("_Restart"); gtk_box_pack_end(GTK_BOX(Toolbar), Button, FALSE, FALSE, 0); g_signal_connect(GTK_OBJECT(Button), "clicked", GTK_SIGNAL_FUNC(Restart_clicked), ctl); Pause_Button = gtk_toggle_button_new_with_mnemonic("_Pause"); gtk_box_pack_end(GTK_BOX(Toolbar), Pause_Button, FALSE, FALSE, 0); g_signal_connect(GTK_OBJECT(Pause_Button), "clicked", GTK_SIGNAL_FUNC(Pause_clicked), ctl); /* allow root only to set zero delay */ Adjustment = (GtkAdjustment *) gtk_adjustment_new(ctl->WaitTime, getuid() == 0 ? 0.01 : 1.00, 999.99, 1.0, 10.0, 0.0); Button = gtk_spin_button_new(Adjustment, 0.5, 2); gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(Button), TRUE); gtk_box_pack_end(GTK_BOX(Toolbar), Button, FALSE, FALSE, 0); ctl->gtk_data = Button; g_signal_connect(GTK_OBJECT(Adjustment), "value_changed", GTK_SIGNAL_FUNC(WaitTime_changed), ctl); Label = gtk_label_new_with_mnemonic("_Hostname:"); gtk_box_pack_start(GTK_BOX(Toolbar), Label, FALSE, FALSE, 0); Entry = gtk_entry_new(); gtk_entry_set_text(GTK_ENTRY(Entry), ctl->Hostname); g_signal_connect(GTK_OBJECT(Entry), "activate", GTK_SIGNAL_FUNC(Host_activate), ctl); gtk_box_pack_start(GTK_BOX(Toolbar), Entry, TRUE, TRUE, 0); gtk_label_set_mnemonic_widget(GTK_LABEL(Label), Entry); } static GtkWidget *ReportTreeView; static GtkListStore *ReportStore; enum { #ifdef HAVE_IPINFO COL_ASN, #endif COL_HOSTNAME, COL_LOSS, COL_RCV, COL_SNT, COL_LAST, COL_BEST, COL_AVG, COL_WORST, COL_STDEV, COL_COLOR, N_COLS }; /* Trick to cast a pointer to integer. We are mis-using a pointer as a single integer. On 64-bit architectures, the pointer is 64 bits and the integer only 32. The compiler warns us of loss of precision. However we know we casted a normal 32-bit integer into this pointer a few microseconds earlier, so it is ok. Nothing to worry about. */ #define POINTER_TO_INT(p) ((int)(long)(p)) static void float_formatter( GtkTreeViewColumn * tree_column ATTRIBUTE_UNUSED, GtkCellRenderer * cell, GtkTreeModel * tree_model, GtkTreeIter * iter, gpointer data) { gfloat f; gchar text[64]; gtk_tree_model_get(tree_model, iter, POINTER_TO_INT(data), &f, -1); sprintf(text, "%.2f", f); g_object_set(cell, "text", text, NULL); } static void percent_formatter( GtkTreeViewColumn * tree_column ATTRIBUTE_UNUSED, GtkCellRenderer * cell, GtkTreeModel * tree_model, GtkTreeIter * iter, gpointer data) { gfloat f; gchar text[64]; gtk_tree_model_get(tree_model, iter, POINTER_TO_INT(data), &f, -1); sprintf(text, "%.1f%%", f); g_object_set(cell, "text", text, NULL); } static void TreeViewCreate( struct mtr_ctl *ctl) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; ReportStore = gtk_list_store_new(N_COLS, #ifdef HAVE_IPINFO G_TYPE_STRING, #endif G_TYPE_STRING, G_TYPE_FLOAT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_FLOAT, G_TYPE_STRING); ReportTreeView = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ReportStore)); g_signal_connect(GTK_OBJECT(ReportTreeView), "button_press_event", G_CALLBACK(ReportTreeView_clicked), ctl); #ifdef HAVE_IPINFO if (is_printii(ctl)) { renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes("ASN", renderer, "text", COL_ASN, "foreground", COL_COLOR, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(ReportTreeView), column); } #endif renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes("Hostname", renderer, "text", COL_HOSTNAME, "foreground", COL_COLOR, NULL); gtk_tree_view_column_set_expand(column, TRUE); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(ReportTreeView), column); renderer = gtk_cell_renderer_text_new(); g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL); column = gtk_tree_view_column_new_with_attributes("Loss", renderer, "text", COL_LOSS, "foreground", COL_COLOR, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_cell_data_func(column, renderer, percent_formatter, (void *) COL_LOSS, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(ReportTreeView), column); renderer = gtk_cell_renderer_text_new(); g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL); column = gtk_tree_view_column_new_with_attributes("Snt", renderer, "text", COL_SNT, "foreground", COL_COLOR, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(ReportTreeView), column); renderer = gtk_cell_renderer_text_new(); g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL); column = gtk_tree_view_column_new_with_attributes("Last", renderer, "text", COL_LAST, "foreground", COL_COLOR, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(ReportTreeView), column); renderer = gtk_cell_renderer_text_new(); g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL); column = gtk_tree_view_column_new_with_attributes("Avg", renderer, "text", COL_AVG, "foreground", COL_COLOR, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(ReportTreeView), column); renderer = gtk_cell_renderer_text_new(); g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL); column = gtk_tree_view_column_new_with_attributes("Best", renderer, "text", COL_BEST, "foreground", COL_COLOR, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(ReportTreeView), column); renderer = gtk_cell_renderer_text_new(); g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL); column = gtk_tree_view_column_new_with_attributes("Worst", renderer, "text", COL_WORST, "foreground", COL_COLOR, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(ReportTreeView), column); renderer = gtk_cell_renderer_text_new(); g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL); column = gtk_tree_view_column_new_with_attributes("StDev", renderer, "text", COL_STDEV, "foreground", COL_COLOR, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_cell_data_func(column, renderer, float_formatter, (void *) COL_STDEV, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(ReportTreeView), column); } static void update_tree_row( struct mtr_ctl *ctl, int row, GtkTreeIter * iter) { ip_t *addr; char str[256] = "???", *name = str; addr = net_addr(row); if (addrcmp((void *) addr, (void *) &ctl->unspec_addr, ctl->af)) { if ((name = dns_lookup(ctl, addr))) { if (ctl->show_ips) { snprintf(str, sizeof(str), "%s (%s)", name, strlongip(ctl, addr)); name = str; } } else name = strlongip(ctl, addr); } gtk_list_store_set(ReportStore, iter, COL_HOSTNAME, name, COL_LOSS, (float) (net_loss(row) / 1000.0), COL_RCV, net_returned(row), COL_SNT, net_xmit(row), COL_LAST, net_last(row) / 1000, COL_BEST, net_best(row) / 1000, COL_AVG, net_avg(row) / 1000, COL_WORST, net_worst(row) / 1000, COL_STDEV, (float) (net_stdev(row) / 1000.0), COL_COLOR, net_up(row) ? NULL : "red", -1); #ifdef HAVE_IPINFO if (is_printii(ctl)) gtk_list_store_set(ReportStore, iter, COL_ASN, fmt_ipinfo(ctl, addr), -1); #endif } void gtk_redraw( struct mtr_ctl *ctl) { int max = net_max(ctl); GtkTreeIter iter; int row = net_min(ctl); gboolean valid; valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(ReportStore), &iter); while (valid) { if (row < max) { update_tree_row(ctl, row++, &iter); valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(ReportStore), &iter); } else { valid = gtk_list_store_remove(ReportStore, &iter); } } while (row < max) { gtk_list_store_append(ReportStore, &iter); update_tree_row(ctl, row++, &iter); } } static void Window_fill( struct mtr_ctl *ctl, GtkWidget * Window) { GtkWidget *VBox; GtkWidget *Toolbar; GtkWidget *scroll; gtk_window_set_title(GTK_WINDOW(Window), "My traceroute"); gtk_window_set_default_size(GTK_WINDOW(Window), 650, 400); gtk_container_set_border_width(GTK_CONTAINER(Window), 10); VBox = gtk_vbox_new(FALSE, 10); Toolbar = gtk_hbox_new(FALSE, 10); Toolbar_fill(ctl, Toolbar); gtk_box_pack_start(GTK_BOX(VBox), Toolbar, FALSE, FALSE, 0); TreeViewCreate(ctl); scroll = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll), GTK_SHADOW_IN); gtk_container_add(GTK_CONTAINER(scroll), ReportTreeView); gtk_box_pack_start(GTK_BOX(VBox), scroll, TRUE, TRUE, 0); gtk_container_add(GTK_CONTAINER(Window), VBox); } void gtk_open( struct mtr_ctl *ctl) { GdkPixbuf *icon; int argc = 1; char *args[2]; char **argv; argv = args; argv[0] = xstrdup(""); argv[1] = NULL; gtk_do_init(&argc, &argv); free(argv[0]); icon = gdk_pixbuf_new_from_xpm_data((const char **) mtr_icon); gtk_window_set_default_icon(icon); main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_set_application_name("My traceroute"); Window_fill(ctl, main_window); g_signal_connect(GTK_OBJECT(main_window), "delete_event", GTK_SIGNAL_FUNC(Window_destroy), NULL); g_signal_connect(GTK_OBJECT(main_window), "destroy", GTK_SIGNAL_FUNC(Window_destroy), NULL); gtk_widget_show_all(main_window); } void gtk_close( void) { } int gtk_keyaction( void) { return 0; } static gint gtk_ping( gpointer data) { struct mtr_ctl *ctl = (struct mtr_ctl *) data; gtk_redraw(ctl); net_send_batch(ctl); net_harvest_fds(ctl); g_source_remove(ping_timeout_timer); gtk_add_ping_timeout(ctl); return TRUE; } static gboolean gtk_net_data( ATTRIBUTE_UNUSED GIOChannel * channel, ATTRIBUTE_UNUSED GIOCondition cond, gpointer data) { struct mtr_ctl *ctl = (struct mtr_ctl *) data; net_process_return(ctl); return TRUE; } static gboolean gtk_dns_data( ATTRIBUTE_UNUSED GIOChannel * channel, ATTRIBUTE_UNUSED GIOCondition cond, gpointer data) { struct mtr_ctl *ctl = (struct mtr_ctl *) data; dns_ack(ctl); gtk_redraw(ctl); return TRUE; } #ifdef ENABLE_IPV6 static gboolean gtk_dns_data6( ATTRIBUTE_UNUSED GIOChannel * channel, ATTRIBUTE_UNUSED GIOCondition cond, gpointer data) { struct mtr_ctl *ctl = (struct mtr_ctl *) data; dns_ack6(); gtk_redraw(ctl); return TRUE; } #endif void gtk_loop( struct mtr_ctl *ctl) { GIOChannel *net_iochannel, *dns_iochannel; gtk_add_ping_timeout(ctl); net_iochannel = g_io_channel_unix_new(net_waitfd()); g_io_add_watch(net_iochannel, G_IO_IN, gtk_net_data, ctl); #ifdef ENABLE_IPV6 if (dns_waitfd6() > 0) { dns_iochannel = g_io_channel_unix_new(dns_waitfd6()); g_io_add_watch(dns_iochannel, G_IO_IN, gtk_dns_data6, ctl); } #endif dns_iochannel = g_io_channel_unix_new(dns_waitfd()); g_io_add_watch(dns_iochannel, G_IO_IN, gtk_dns_data, ctl); gtk_main(); } static gboolean NewDestination_activate( GtkWidget * widget ATTRIBUTE_UNUSED, gpointer data) { gchar *hostname; struct mtr_ctl *ctl = (struct mtr_ctl *) data; GtkTreePath *path = (GtkTreePath *) ctl->gtk_data; hostname = getSelectedHost(path); if (hostname) { ctl->gtk_data = hostname; gtk_entry_set_text(GTK_ENTRY(Entry), hostname); Host_activate(Entry, ctl); g_free(hostname); } return TRUE; } static gboolean Copy_activate( GtkWidget * widget ATTRIBUTE_UNUSED, gpointer data) { gchar *hostname; GtkTreePath *path = (GtkTreePath *) data; hostname = getSelectedHost(path); if (hostname != NULL) { GtkClipboard *clipboard; clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); gtk_clipboard_set_text(clipboard, hostname, -1); clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); gtk_clipboard_set_text(clipboard, hostname, -1); g_free(hostname); } return TRUE; } static gchar *getSelectedHost( GtkTreePath * path) { GtkTreeIter iter; gchar *name = NULL; if (gtk_tree_model_get_iter(GTK_TREE_MODEL(ReportStore), &iter, path)) { gtk_tree_model_get(GTK_TREE_MODEL(ReportStore), &iter, COL_HOSTNAME, &name, -1); } gtk_tree_path_free(path); return name; } static gboolean ReportTreeView_clicked( GtkWidget * Tree ATTRIBUTE_UNUSED, GdkEventButton * event, gpointer data) { GtkWidget *popup_menu; GtkWidget *copy_item; GtkWidget *newdestination_item; GtkTreePath *path; struct mtr_ctl *ctl = (struct mtr_ctl *) data; if (event->type != GDK_BUTTON_PRESS || event->button != 3) return FALSE; if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(ReportTreeView), event->x, event->y, &path, NULL, NULL, NULL)) return FALSE; gtk_tree_view_set_cursor(GTK_TREE_VIEW(ReportTreeView), path, NULL, FALSE); /* Single right click: prepare and show the popup menu */ popup_menu = gtk_menu_new(); copy_item = gtk_menu_item_new_with_label("Copy to clipboard"); newdestination_item = gtk_menu_item_new_with_label("Set as new destination"); gtk_menu_append(GTK_MENU(popup_menu), copy_item); gtk_menu_append(GTK_MENU(popup_menu), newdestination_item); g_signal_connect(GTK_OBJECT(copy_item), "activate", GTK_SIGNAL_FUNC(Copy_activate), path); ctl->gtk_data = path; g_signal_connect(GTK_OBJECT(newdestination_item), "activate", GTK_SIGNAL_FUNC(NewDestination_activate), ctl); gtk_widget_show(copy_item); gtk_widget_show(newdestination_item); gtk_menu_popup(GTK_MENU(popup_menu), NULL, NULL, NULL, NULL, 0, event->time); return TRUE; } mtr-0.92/ui/display.h0000664000175000017500000000421413045551745013531 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include /* Don't put a trailing comma in enumeration lists. Some compilers (notably the one on Irix 5.2) do not like that. */ enum { ActionNone, ActionQuit, ActionReset, ActionDisplay, ActionClear, ActionPause, ActionResume, ActionMPLS, ActionDNS, #ifdef HAVE_IPINFO ActionII, ActionAS, #endif ActionScrollDown, ActionScrollUp }; enum { DisplayReport, #ifdef HAVE_CURSES DisplayCurses, #endif #ifdef HAVE_GTK DisplayGTK, #endif DisplaySplit, DisplayRaw, DisplayXML, DisplayCSV, DisplayTXT, DisplayJSON }; enum { DisplayModeDefault, DisplayModeBlockmap, DisplayModeBlockmapScale, DisplayModeMAX /* this must be the last DisplayMode entry */ }; /* Prototypes for display.c */ extern void display_detect( struct mtr_ctl *ctl, int *argc, char ***argv); extern void display_open( struct mtr_ctl *ctl); extern void display_close( struct mtr_ctl *ctl); extern void display_redraw( struct mtr_ctl *ctl); extern void display_rawxmit( struct mtr_ctl *ctl, int hostnum, int seq); extern void display_rawping( struct mtr_ctl *ctl, int hostnum, int msec, int seq); extern void display_rawhost( struct mtr_ctl *ctl, int hostnum, ip_t * ip_addr); extern int display_keyaction( struct mtr_ctl *ctl); extern void display_loop( struct mtr_ctl *ctl); extern void display_clear( struct mtr_ctl *ctl); mtr-0.92/ui/raw.h0000664000175000017500000000202713045551745012655 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1998 R.E.Wolff@BitWizard.nl raw.h -- raw output (for logging for later analysis) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Prototypes for raw.c */ extern void raw_rawxmit( int host, int seq); extern void raw_rawping( struct mtr_ctl *ctl, int host, int msec, int seq); extern void raw_rawhost( struct mtr_ctl *ctl, int host, ip_t * addr); mtr-0.92/ui/report.h0000664000175000017500000000225313045551745013400 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Prototypes for report.h */ extern void report_open( void); extern void report_close( struct mtr_ctl *ctl); extern void txt_open( void); extern void txt_close( struct mtr_ctl *ctl); extern void json_open( void); extern void json_close( struct mtr_ctl *ctl); extern void xml_open( void); extern void xml_close( struct mtr_ctl *ctl); extern void csv_open( void); extern void csv_close( struct mtr_ctl *ctl, time_t now); mtr-0.92/ui/cmdpipe.h0000664000175000017500000000371613045551745013513 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef CMDPIPE_H #define CMDPIPE_H #include "mtr.h" #define COMMAND_BUFFER_SIZE 4096 #define PACKET_REPLY_BUFFER_SIZE 4096 /* We use a pipe to the mtr-packet subprocess to generate probes */ struct packet_command_pipe_t { /* the process id of mtr-packet */ pid_t pid; /* the end of the pipe we read for replies */ int read_fd; /* the end of the pipe we write for commands */ int write_fd; /* storage for incoming replies */ char reply_buffer[PACKET_REPLY_BUFFER_SIZE]; /* the number of bytes currently used in reply_buffer */ size_t reply_buffer_used; }; typedef void ( *probe_reply_func_t) ( struct mtr_ctl * ctl, int sequence, struct mplslen * mpls, ip_t * addr, int round_trip_time); int open_command_pipe( struct mtr_ctl *ctl, struct packet_command_pipe_t *cmdpipe); void close_command_pipe( struct packet_command_pipe_t *cmdpipe); void send_probe_command( struct mtr_ctl *ctl, struct packet_command_pipe_t *cmdpipe, ip_t * address, ip_t * localaddress, int packet_size, int sequence, int time_to_live); void handle_command_replies( struct mtr_ctl *ctl, struct packet_command_pipe_t *cmdpipe, probe_reply_func_t reply_func); #endif mtr-0.92/ui/raw.c0000664000175000017500000000336313045551745012654 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1998 R.E.Wolff@BitWizard.nl raw.c -- raw output (for logging for later analysis) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include #include #include #include #include #include #include #include "mtr.h" #include "raw.h" #include "net.h" #include "dns.h" /* Log an echo request, or a "ping" */ void raw_rawxmit( int host, int seq) { printf("x %d %d\n", host, seq); fflush(stdout); } /* Log an echo reply, or a "pong" */ void raw_rawping( struct mtr_ctl *ctl, int host, int msec, int seq) { static int havename[MaxHost]; char *name; if (ctl->dns && !havename[host]) { name = dns_lookup2(ctl, net_addr(host)); if (name) { havename[host]++; printf("d %d %s\n", host, name); } } printf("p %d %d %d\n", host, msec, seq); fflush(stdout); } void raw_rawhost( struct mtr_ctl *ctl, int host, ip_t * ip_addr) { printf("h %d %s\n", host, strlongip(ctl, ip_addr)); fflush(stdout); } mtr-0.92/ui/cmdpipe.c0000664000175000017500000005300513045551745013502 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 2016 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "cmdpipe.h" #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_ERROR_H #include #else #include "portability/error.h" #endif #include "packet/cmdparse.h" #include "display.h" /* Set a file descriptor to non-blocking */ static void set_fd_nonblock( int fd) { int flags; /* Get the current flags of the file descriptor */ flags = fcntl(fd, F_GETFL, 0); if (flags == -1) { error(EXIT_FAILURE, errno, "F_GETFL failure"); exit(1); } /* Add the O_NONBLOCK bit to the current flags */ if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) { error(EXIT_FAILURE, errno, "Failure to set O_NONBLOCK"); exit(1); } } /* Send a command synchronously to mtr-packet, blocking until a result is available. This is intended to be used at start-up to check the capabilities of mtr-packet, but probes should be sent asynchronously to avoid blocking other probes and the user interface. */ static int send_synchronous_command( struct mtr_ctl *ctl, struct packet_command_pipe_t *cmdpipe, const char *cmd, struct command_t *result) { char reply[PACKET_REPLY_BUFFER_SIZE]; int command_length; int write_length; int read_length; /* Query send-probe support */ command_length = strlen(cmd); write_length = write(cmdpipe->write_fd, cmd, command_length); if (write_length == -1) { return -1; } if (write_length != command_length) { errno = EIO; return -1; } /* Read the reply to our query */ read_length = read(cmdpipe->read_fd, reply, PACKET_REPLY_BUFFER_SIZE - 1); if (read_length < 0) { return -1; } /* Parse the query reply */ reply[read_length] = 0; if (parse_command(result, reply)) { return -1; } return 0; } /* Check support for a particular feature with the mtr-packet we invoked */ static int check_feature( struct mtr_ctl *ctl, struct packet_command_pipe_t *cmdpipe, const char *feature) { char check_command[COMMAND_BUFFER_SIZE]; struct command_t reply; snprintf(check_command, COMMAND_BUFFER_SIZE, "1 check-support feature %s\n", feature); if (send_synchronous_command(ctl, cmdpipe, check_command, &reply) == -1) { return -1; } /* Check that the feature is supported */ if (!strcmp(reply.command_name, "feature-support") && reply.argument_count >= 1 && !strcmp(reply.argument_name[0], "support") && !strcmp(reply.argument_value[0], "ok")) { /* Looks good */ return 0; } errno = ENOTSUP; return -1; } /* Check the protocol selected against the mtr-packet we are using. Returns zero if everything is fine, or -1 with errno for either a failure during the check, or for an unsupported feature. */ static int check_packet_features( struct mtr_ctl *ctl, struct packet_command_pipe_t *cmdpipe) { /* Check the IP protocol version */ if (ctl->af == AF_INET6) { if (check_feature(ctl, cmdpipe, "ip-6")) { return -1; } } else if (ctl->af == AF_INET) { if (check_feature(ctl, cmdpipe, "ip-4")) { return -1; } } else { errno = EINVAL; return -1; } /* Check the transport protocol */ if (ctl->mtrtype == IPPROTO_ICMP) { if (check_feature(ctl, cmdpipe, "icmp")) { return -1; } } else if (ctl->mtrtype == IPPROTO_UDP) { if (check_feature(ctl, cmdpipe, "udp")) { return -1; } } else if (ctl->mtrtype == IPPROTO_TCP) { if (check_feature(ctl, cmdpipe, "tcp")) { return -1; } #ifdef HAS_SCTP } else if (ctl->mtrtype == IPPROTO_SCTP) { if (check_feature(ctl, cmdpipe, "sctp")) { return -1; } #endif } else { errno = EINVAL; return -1; } #ifdef SO_MARK if (ctl->mark) { if (check_feature(ctl, cmdpipe, "mark")) { return -1; } } #endif return 0; } /* Execute mtr-packet, allowing the MTR_PACKET evironment to override the PATH when locating the executable. */ static void execute_packet_child( void) { /* Allow the MTR_PACKET environment variable to override the path to the mtr-packet executable. This is necessary for debugging changes for mtr-packet. */ char *mtr_packet_path = getenv("MTR_PACKET"); if (mtr_packet_path == NULL) { mtr_packet_path = "mtr-packet"; } /* First, try to execute mtr-packet from PATH or MTR_PACKET environment variable. */ execlp(mtr_packet_path, "mtr-packet", (char *) NULL); /* If mtr-packet is not found, try to use mtr-packet from current directory */ execl("./mtr-packet", "./mtr-packet", (char *) NULL); /* Both exec attempts failed, so nothing to do but exit */ exit(1); } /* Create the command pipe to a new mtr-packet subprocess */ int open_command_pipe( struct mtr_ctl *ctl, struct packet_command_pipe_t *cmdpipe) { int stdin_pipe[2]; int stdout_pipe[2]; pid_t child_pid; int i; /* We actually need two Unix pipes. One for stdin and one for stdout on the new process. */ if (pipe(stdin_pipe) || pipe(stdout_pipe)) { return errno; } child_pid = fork(); if (child_pid == -1) { return errno; } if (child_pid == 0) { /* In the child process, attach our created pipes to stdin and stdout */ dup2(stdin_pipe[0], STDIN_FILENO); dup2(stdout_pipe[1], STDOUT_FILENO); /* Close all unnecessary fds */ for (i = STDERR_FILENO + 1; i <= stdout_pipe[1]; i++) { close(i); } execute_packet_child(); } else { memset(cmdpipe, 0, sizeof(struct packet_command_pipe_t)); /* In the parent process, save the opposite ends of the pipes attached as stdin and stdout in the child. */ cmdpipe->pid = child_pid; cmdpipe->read_fd = stdout_pipe[0]; cmdpipe->write_fd = stdin_pipe[1]; /* We don't need the child ends of the pipe open in the parent. */ close(stdout_pipe[1]); close(stdin_pipe[0]); /* Check that we can communicate with the client. If we failed to execute the mtr-packet binary, we will discover that here. */ if (check_feature(ctl, cmdpipe, "send-probe")) { error(EXIT_FAILURE, errno, "Failure to start mtr-packet"); } if (check_packet_features(ctl, cmdpipe)) { error(EXIT_FAILURE, errno, "Packet type unsupported"); } /* We will need non-blocking reads from the child */ set_fd_nonblock(cmdpipe->read_fd); } return 0; } /* Kill the mtr-packet child process and close the command pipe */ void close_command_pipe( struct packet_command_pipe_t *cmdpipe) { int child_exit_value; if (cmdpipe->pid) { close(cmdpipe->read_fd); close(cmdpipe->write_fd); kill(cmdpipe->pid, SIGTERM); waitpid(cmdpipe->pid, &child_exit_value, 0); } memset(cmdpipe, 0, sizeof(struct packet_command_pipe_t)); } /* Start building the command string for the "send-probe" command */ static void construct_base_command( struct mtr_ctl *ctl, char *command, int buffer_size, int command_token, ip_t * address, ip_t * localaddress) { char ip_string[INET6_ADDRSTRLEN]; char local_ip_string[INET6_ADDRSTRLEN]; const char *ip_type; const char *local_ip_type; const char *protocol = NULL; /* Conver the remote IP address to a string */ if (inet_ntop(ctl->af, address, ip_string, INET6_ADDRSTRLEN) == NULL) { display_close(ctl); error(EXIT_FAILURE, errno, "invalid remote IP address"); } if (inet_ntop(ctl->af, localaddress, local_ip_string, INET6_ADDRSTRLEN) == NULL) { display_close(ctl); error(EXIT_FAILURE, errno, "invalid local IP address"); } if (ctl->af == AF_INET6) { ip_type = "ip-6"; local_ip_type = "local-ip-6"; } else { ip_type = "ip-4"; local_ip_type = "local-ip-4"; } if (ctl->mtrtype == IPPROTO_ICMP) { protocol = "icmp"; } else if (ctl->mtrtype == IPPROTO_UDP) { protocol = "udp"; } else if (ctl->mtrtype == IPPROTO_TCP) { protocol = "tcp"; #ifdef HAS_SCTP } else if (ctl->mtrtype == IPPROTO_SCTP) { protocol = "sctp"; #endif } else { display_close(ctl); error(EXIT_FAILURE, 0, "protocol unsupported by mtr-packet interface"); } snprintf(command, buffer_size, "%d send-probe %s %s %s %s protocol %s", command_token, ip_type, ip_string, local_ip_type, local_ip_string, protocol); } /* Append an argument to the "send-probe" command string */ static void append_command_argument( char *command, int buffer_size, char *name, int value) { char argument[COMMAND_BUFFER_SIZE]; int remaining_size; remaining_size = buffer_size - strlen(command) - 1; snprintf(argument, buffer_size, " %s %d", name, value); strncat(command, argument, remaining_size); } /* Request a new probe from the "mtr-packet" child process */ void send_probe_command( struct mtr_ctl *ctl, struct packet_command_pipe_t *cmdpipe, ip_t * address, ip_t * localaddress, int packet_size, int sequence, int time_to_live) { char command[COMMAND_BUFFER_SIZE]; int remaining_size; int timeout; construct_base_command(ctl, command, COMMAND_BUFFER_SIZE, sequence, address, localaddress); append_command_argument(command, COMMAND_BUFFER_SIZE, "size", packet_size); append_command_argument(command, COMMAND_BUFFER_SIZE, "bit-pattern", ctl->bitpattern); append_command_argument(command, COMMAND_BUFFER_SIZE, "tos", ctl->tos); append_command_argument(command, COMMAND_BUFFER_SIZE, "ttl", time_to_live); timeout = ctl->probe_timeout / 1000000; append_command_argument(command, COMMAND_BUFFER_SIZE, "timeout", timeout); if (ctl->remoteport) { append_command_argument(command, COMMAND_BUFFER_SIZE, "port", ctl->remoteport); } if (ctl->localport) { append_command_argument(command, COMMAND_BUFFER_SIZE, "local-port", ctl->localport); } #ifdef SO_MARK if (ctl->mark) { append_command_argument(command, COMMAND_BUFFER_SIZE, "mark", ctl->mark); } #endif remaining_size = COMMAND_BUFFER_SIZE - strlen(command) - 1; strncat(command, "\n", remaining_size); /* Send a probe using the mtr-packet subprocess */ if (write(cmdpipe->write_fd, command, strlen(command)) == -1) { display_close(ctl); error(EXIT_FAILURE, errno, "mtr-packet command pipe write failure"); } } /* Parse a comma separated field of mpls values, filling out the mplslen structure with mpls labels. */ static void parse_mpls_values( struct mplslen *mpls, char *value_str) { char *next_value = value_str; char *end_of_value; int value; int label_count = 0; int label_field = 0; while (*next_value) { value = strtol(next_value, &end_of_value, 10); /* Failure to advance means an invalid numeric value */ if (end_of_value == next_value) { return; } /* If the next character is not a comma or a NUL, we have an invalid string */ if (*end_of_value == ',') { next_value = end_of_value + 1; } else if (*end_of_value == 0) { next_value = end_of_value; } else { return; } /* Store the converted value in the next field of the MPLS structure. */ if (label_field == 0) { mpls->label[label_count] = value; } else if (label_field == 1) { mpls->exp[label_count] = value; } else if (label_field == 2) { mpls->s[label_count] = value; } else if (label_field == 3) { mpls->ttl[label_count] = value; } label_field++; if (label_field > 3) { label_field = 0; label_count++; } /* If we've used up all MPLS labels in the structure, return with what we've got */ if (label_count >= MAXLABELS) { break; } } mpls->labels = label_count; } /* Extract the IP address and round trip time from a reply to a probe. Returns true if both arguments are found in the reply, false otherwise. */ static bool parse_reply_arguments( struct mtr_ctl *ctl, struct command_t *reply, ip_t * fromaddress, int *round_trip_time, struct mplslen *mpls) { bool found_round_trip; bool found_ip; char *arg_name; char *arg_value; int i; *round_trip_time = 0; memset(fromaddress, 0, sizeof(ip_t)); memset(mpls, 0, sizeof(struct mplslen)); found_ip = false; found_round_trip = false; /* Examine the reply arguments for known values */ for (i = 0; i < reply->argument_count; i++) { arg_name = reply->argument_name[i]; arg_value = reply->argument_value[i]; if (ctl->af == AF_INET6) { /* IPv6 address of the responding host */ if (!strcmp(arg_name, "ip-6")) { if (inet_pton(AF_INET6, arg_value, fromaddress)) { found_ip = true; } } } else { /* IPv4 address of the responding host */ if (!strcmp(arg_name, "ip-4")) { if (inet_pton(AF_INET, arg_value, fromaddress)) { found_ip = true; } } } /* The round trip time in microseconds */ if (!strcmp(arg_name, "round-trip-time")) { errno = 0; *round_trip_time = strtol(arg_value, NULL, 10); if (!errno) { found_round_trip = true; } } /* MPLS labels */ if (!strcmp(arg_name, "mpls")) { parse_mpls_values(mpls, arg_value); } } return found_ip && found_round_trip; } /* If an mtr-packet command has returned an error result, report the error and exit. */ static void handle_reply_errors( struct mtr_ctl *ctl, struct command_t *reply) { char *reply_name; reply_name = reply->command_name; if (!strcmp(reply_name, "no-route")) { display_close(ctl); error(EXIT_FAILURE, 0, "No route to host"); } if (!strcmp(reply_name, "network-down")) { display_close(ctl); error(EXIT_FAILURE, 0, "Network down"); } if (!strcmp(reply_name, "probes-exhausted")) { display_close(ctl); error(EXIT_FAILURE, 0, "Probes exhausted"); } if (!strcmp(reply_name, "invalid-argument")) { display_close(ctl); error(EXIT_FAILURE, 0, "mtr-packet reported invalid argument"); } if (!strcmp(reply_name, "permission-denied")) { display_close(ctl); error(EXIT_FAILURE, 0, "Permission denied"); } if (!strcmp(reply_name, "address-in-use")) { display_close(ctl); error(EXIT_FAILURE, 0, "Address in use"); } if (!strcmp(reply_name, "address-not-available")) { display_close(ctl); error(EXIT_FAILURE, 0, "Address not available"); } if (!strcmp(reply_name, "unexpected-error")) { display_close(ctl); error(EXIT_FAILURE, 0, "Unexpected mtr-packet error"); } } /* A complete mtr-packet reply line has arrived. Parse it and record the responding IP and round trip time, if it is a reply that we understand. */ static void handle_command_reply( struct mtr_ctl *ctl, char *reply_str, probe_reply_func_t reply_func) { struct command_t reply; ip_t fromaddress; int seq_num; int round_trip_time; char *reply_name; struct mplslen mpls; /* Parse the reply string */ if (parse_command(&reply, reply_str)) { /* If the reply isn't well structured, something is fundamentally wrong, as we might as well exit. Even if the reply is of an unknown type, it should still parse. */ display_close(ctl); error(EXIT_FAILURE, errno, "reply parse failure"); return; } handle_reply_errors(ctl, &reply); seq_num = reply.token; reply_name = reply.command_name; /* If the reply type is unknown, ignore it for future compatibility */ if (strcmp(reply_name, "reply") && strcmp(reply_name, "ttl-expired")) { return; } /* If the reply had an IP address and a round trip time, we can record the result. */ if (parse_reply_arguments (ctl, &reply, &fromaddress, &round_trip_time, &mpls)) { reply_func(ctl, seq_num, &mpls, (void *) &fromaddress, round_trip_time); } } /* Check the command pipe for completed replies to commands we have previously sent. Record the results of those replies. */ static void consume_reply_buffer( struct mtr_ctl *ctl, struct packet_command_pipe_t *cmdpipe, probe_reply_func_t reply_func) { char *reply_buffer; char *reply_start; char *end_of_reply; int used_size; int move_size; reply_buffer = cmdpipe->reply_buffer; /* Terminate the string storing the replies */ assert(cmdpipe->reply_buffer_used < PACKET_REPLY_BUFFER_SIZE); reply_buffer[cmdpipe->reply_buffer_used] = 0; reply_start = reply_buffer; /* We may have multiple completed replies. Loop until we don't have any more newlines termininating replies. */ while (true) { /* If no newline is found, our reply isn't yet complete */ end_of_reply = index(reply_start, '\n'); if (end_of_reply == NULL) { /* No complete replies remaining */ break; } /* Terminate the reply string at the newline, which is necessary in the case where we are able to read mulitple replies arriving simultaneously. */ *end_of_reply = 0; /* Parse and record the reply results */ handle_command_reply(ctl, reply_start, reply_func); reply_start = end_of_reply + 1; } /* After replies have been processed, free the space used by the replies, and move any remaining partial reply text to the start of the reply buffer. */ used_size = reply_start - reply_buffer; move_size = cmdpipe->reply_buffer_used - used_size; memmove(reply_buffer, reply_start, move_size); cmdpipe->reply_buffer_used -= used_size; if (cmdpipe->reply_buffer_used >= PACKET_REPLY_BUFFER_SIZE - 1) { /* We've overflowed the reply buffer without a complete reply. There's not much we can do about it but discard the data we've got and hope new data coming in fits. */ cmdpipe->reply_buffer_used = 0; } } /* Read as much as we can from the reply pipe from the child process, and process as many replies as are available. */ void handle_command_replies( struct mtr_ctl *ctl, struct packet_command_pipe_t *cmdpipe, probe_reply_func_t reply_func) { int read_count; int buffer_remaining; char *reply_buffer; char *read_buffer; reply_buffer = cmdpipe->reply_buffer; /* Read the available reply text, up to the the remaining buffer space. (Minus one for the terminating NUL.) */ read_buffer = &reply_buffer[cmdpipe->reply_buffer_used]; buffer_remaining = PACKET_REPLY_BUFFER_SIZE - cmdpipe->reply_buffer_used; read_count = read(cmdpipe->read_fd, read_buffer, buffer_remaining - 1); if (read_count < 0) { /* EAGAIN simply indicates that there is no data currently available on our non-blocking pipe. */ if (errno == EAGAIN) { return; } display_close(ctl); error(EXIT_FAILURE, errno, "command reply read failure"); return; } if (read_count == 0) { display_close(ctl); errno = EPIPE; error(EXIT_FAILURE, EPIPE, "unexpected packet generator exit"); } cmdpipe->reply_buffer_used += read_count; /* Handle any replies completed by this read */ consume_reply_buffer(ctl, cmdpipe, reply_func); } mtr-0.92/ui/net.h0000664000175000017500000000516213075124176012652 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Prototypes for functions in net.c */ #include #include #include #include #include #include #ifdef ENABLE_IPV6 #include #endif #include #include "mtr.h" extern int net_open( struct mtr_ctl *ctl, struct hostent *host); extern void net_reopen( struct mtr_ctl *ctl, struct hostent *address); extern void net_reset( struct mtr_ctl *ctl); extern void net_close( void); extern int net_waitfd( void); extern void net_process_return( struct mtr_ctl *ctl); extern void net_harvest_fds( struct mtr_ctl *ctl); extern int net_max( struct mtr_ctl *ctl); extern int net_min( struct mtr_ctl *ctl); extern int net_last( int at); extern ip_t *net_addr( int at); extern void *net_mpls( int at); extern void *net_mplss( int, int); extern int net_loss( int at); extern int net_drop( int at); extern int net_best( int at); extern int net_worst( int at); extern int net_avg( int at); extern int net_gmean( int at); extern int net_stdev( int at); extern int net_jitter( int at); extern int net_jworst( int at); extern int net_javg( int at); extern int net_jinta( int at); extern ip_t *net_addrs( int at, int i); extern char *net_localaddr( void); extern int net_send_batch( struct mtr_ctl *ctl); extern void net_end_transit( void); extern int calc_deltatime( float WaitTime); extern int net_returned( int at); extern int net_xmit( int at); extern int net_up( int at); extern int *net_saved_pings( int at); extern void net_save_xmit( int at); extern void net_save_return( int at, int seq, int ms); extern int addrcmp( char *a, char *b, int af); extern void addrcpy( char *a, char *b, int af); extern void net_add_fds( fd_set * writefd, int *maxfd); mtr-0.92/ui/curses.c0000664000175000017500000005304013045551745013364 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include "mtr.h" #include #include #include #include #include #include /* MacOSX may need this before socket.h...*/ #if defined(HAVE_SYS_TYPES_H) #include #endif #include #include #include #if defined(HAVE_NCURSES_H) #include #elif defined(HAVE_NCURSES_CURSES_H) #include #elif defined(HAVE_CURSES_H) #include #elif defined(HAVE_CURSESX_H) #include #else #error No curses header file available #endif /* This go-around is needed only when compiling with antique version of curses. getmaxyx is part of Technical Standard X/Open Curses Issue 4, Version 2 (1996). http://pubs.opengroup.org/onlinepubs/9693989999/toc.pdf see page 106 */ #ifndef getmaxyx #define getmaxyx(win,y,x) ((y) = (win)->_maxy + 1, (x) = (win)->_maxx + 1) #endif #include "mtr.h" #include "mtr-curses.h" #include "net.h" #include "dns.h" #include "asn.h" #include "display.h" #include "utils.h" enum { NUM_FACTORS = 8 }; static double factors[NUM_FACTORS]; static int scale[NUM_FACTORS]; static char block_map[NUM_FACTORS]; enum { black = 1, red, green, yellow, blue, magenta, cyan, white }; static const int block_col[NUM_FACTORS + 1] = { COLOR_PAIR(red) | A_BOLD, A_NORMAL, COLOR_PAIR(green), COLOR_PAIR(green) | A_BOLD, COLOR_PAIR(yellow) | A_BOLD, COLOR_PAIR(magenta) | A_BOLD, COLOR_PAIR(magenta), COLOR_PAIR(red), COLOR_PAIR(red) | A_BOLD }; static void pwcenter( char *str) { int maxx; size_t cx; int __unused_int ATTRIBUTE_UNUSED; getmaxyx(stdscr, __unused_int, maxx); cx = (size_t) (maxx - strlen(str)) / 2; printw("%*s%s", (int) cx, "", str); } static char *format_number( int n, int w, char *buf) { if (w != 5) /* XXX todo: implement w != 5.. */ snprintf(buf, w + 1, "%s", "unimpl"); else if (n < 100000) /* buf is good as-is */ ; else if (n < 1000000) snprintf(buf, w + 1, "%3dk%1d", n / 1000, (n % 1000) / 100); else if (n < 10000000) snprintf(buf, w + 1, "%1dM%03d", n / 1000000, (n % 1000000) / 1000); else if (n < 100000000) snprintf(buf, w + 1, "%2dM%02d", n / 1000000, (n % 1000000) / 10000); else if (n < 1000000000) snprintf(buf, w + 1, "%3dM%01d", n / 1000000, (n % 1000000) / 100000); else /* if (n < 10000000000) */ snprintf(buf, w + 1, "%1dG%03d", n / 1000000000, (n % 1000000000) / 1000000); return buf; } int mtr_curses_keyaction( struct mtr_ctl *ctl) { int c = getch(); int i = 0; float f = 0.0; char buf[MAXFLD + 1]; if (c == 'Q') { /* must be checked before c = tolower(c) */ mvprintw(2, 0, "Type of Service(tos): %d\n", ctl->tos); mvprintw(3, 0, "default 0x00, min cost 0x02, rel 0x04,, thr 0x08, low del 0x10...\n"); move(2, 22); refresh(); while ((c = getch()) != '\n' && i < MAXFLD) { attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh(); buf[i++] = c; /* need more checking on 'c' */ } buf[i] = '\0'; ctl->tos = atoi(buf); if (ctl->tos > 255 || ctl->tos < 0) ctl->tos = 0; return ActionNone; } c = tolower(c); switch (c) { case 'q': case 3: return ActionQuit; case 12: return ActionClear; case 19: case 'p': return ActionPause; case 17: case ' ': return ActionResume; case 'r': return ActionReset; case 'd': return ActionDisplay; case 'e': return ActionMPLS; case 'n': return ActionDNS; #ifdef HAVE_IPINFO case 'y': return ActionII; case 'z': return ActionAS; #endif case '+': return ActionScrollDown; case '-': return ActionScrollUp; case 's': mvprintw(2, 0, "Change Packet Size: %d\n", ctl->cpacketsize); mvprintw(3, 0, "Size Range: %d-%d, < 0:random.\n", MINPACKET, MAXPACKET); move(2, 20); refresh(); while ((c = getch()) != '\n' && i < MAXFLD) { attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh(); buf[i++] = c; /* need more checking on 'c' */ } buf[i] = '\0'; ctl->cpacketsize = atoi(buf); return ActionNone; case 'b': mvprintw(2, 0, "Ping Bit Pattern: %d\n", ctl->bitpattern); mvprintw(3, 0, "Pattern Range: 0(0x00)-255(0xff), <0 random.\n"); move(2, 18); refresh(); while ((c = getch()) != '\n' && i < MAXFLD) { attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh(); buf[i++] = c; /* need more checking on 'c' */ } buf[i] = '\0'; ctl->bitpattern = atoi(buf); if (ctl->bitpattern > 255) ctl->bitpattern = -1; return ActionNone; case 'i': mvprintw(2, 0, "Interval : %0.0f\n\n", ctl->WaitTime); move(2, 11); refresh(); while ((c = getch()) != '\n' && i < MAXFLD) { attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh(); buf[i++] = c; /* need more checking on 'c' */ } buf[i] = '\0'; f = atof(buf); if (f <= 0.0) return ActionNone; if (getuid() != 0 && f < 1.0) return ActionNone; ctl->WaitTime = f; return ActionNone; case 'f': mvprintw(2, 0, "First TTL: %d\n\n", ctl->fstTTL); move(2, 11); refresh(); while ((c = getch()) != '\n' && i < MAXFLD) { attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh(); buf[i++] = c; /* need more checking on 'c' */ } buf[i] = '\0'; i = atoi(buf); if (i < 1 || i > ctl->maxTTL) return ActionNone; ctl->fstTTL = i; return ActionNone; case 'm': mvprintw(2, 0, "Max TTL: %d\n\n", ctl->maxTTL); move(2, 9); refresh(); while ((c = getch()) != '\n' && i < MAXFLD) { attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh(); buf[i++] = c; /* need more checking on 'c' */ } buf[i] = '\0'; i = atoi(buf); if (i < ctl->fstTTL || i > (MaxHost - 1)) return ActionNone; ctl->maxTTL = i; return ActionNone; /* fields to display & their ordering */ case 'o': mvprintw(2, 0, "Fields: %s\n\n", ctl->fld_active); for (i = 0; i < MAXFLD; i++) { if (data_fields[i].descr != NULL) printw(" %s\n", data_fields[i].descr); } printw("\n"); move(2, 8); /* length of "Fields: " */ refresh(); i = 0; while ((c = getch()) != '\n' && i < MAXFLD) { if (strchr(ctl->available_options, c)) { attron(A_BOLD); printw("%c", c); attroff(A_BOLD); refresh(); buf[i++] = c; /* Only permit values in "available_options" be entered */ } else { printf("\a"); /* Illegal character. Beep, ring the bell. */ } } buf[i] = '\0'; if (strlen(buf) > 0) xstrncpy(ctl->fld_active, buf, 2 * MAXFLD); return ActionNone; case 'j': if (strchr(ctl->fld_active, 'N')) /* GeoMean and jitter */ xstrncpy(ctl->fld_active, "DR AGJMXI", 2 * MAXFLD); else /* default */ xstrncpy(ctl->fld_active, "LS NABWV", 2 * MAXFLD); return ActionNone; case 'u': switch (ctl->mtrtype) { case IPPROTO_ICMP: case IPPROTO_TCP: ctl->mtrtype = IPPROTO_UDP; break; case IPPROTO_UDP: ctl->mtrtype = IPPROTO_ICMP; break; } return ActionNone; case 't': switch (ctl->mtrtype) { case IPPROTO_ICMP: case IPPROTO_UDP: ctl->mtrtype = IPPROTO_TCP; break; case IPPROTO_TCP: ctl->mtrtype = IPPROTO_ICMP; break; } return ActionNone; /* reserve to display help message -Min */ case '?': case 'h': mvprintw(2, 0, "Command:\n"); printw(" ?|h help\n"); printw(" p pause (SPACE to resume)\n"); printw(" d switching display mode\n"); printw(" e toggle MPLS information on/off\n"); printw(" n toggle DNS on/off\n"); printw(" r reset all counters\n"); printw (" o str set the columns to display, default str='LRS N BAWV'\n"); printw (" j toggle latency(LS NABWV)/jitter(DR AGJMXI) stats\n"); printw(" c report cycle n, default n=infinite\n"); printw (" i set the ping interval to n seconds, default n=1\n"); printw (" f set the initial time-to-live(ttl), default n=1\n"); printw (" m set the max time-to-live, default n= # of hops\n"); printw(" s set the packet size to n or random(n<0)\n"); printw (" b set ping bit pattern to c(0..255) or random(c<0)\n"); printw(" Q set ping packet's TOS to t\n"); printw(" u switch between ICMP ECHO and UDP datagrams\n"); #ifdef HAVE_IPINFO printw(" y switching IP info\n"); printw(" z toggle ASN info on/off\n"); #endif printw("\n"); printw(" press any key to go back..."); getch(); /* read and ignore 'any key' */ return ActionNone; default: /* ignore unknown input */ return ActionNone; } } static void format_field( char *dst, int dst_length, const char *format, int n) { if (index(format, 'N')) { *dst++ = ' '; format_number(n, 5, dst); } else if (strchr(format, 'f')) { /* this is for fields where we measure integer microseconds but display floating point miliseconds. Convert to float here. */ snprintf(dst, dst_length, format, n / 1000.0); /* this was marked as a temporary hack over 10 years ago. -- REW */ } else { snprintf(dst, dst_length, format, n); } } static void mtr_curses_hosts( struct mtr_ctl *ctl, int startstat) { int max; int at; struct mplslen *mpls, *mplss; ip_t *addr, *addrs; int y; char *name; int i, j, k; int hd_len; char buf[1024]; int __unused_int ATTRIBUTE_UNUSED; max = net_max(ctl); for (at = net_min(ctl) + ctl->display_offset; at < max; at++) { printw("%2d. ", at + 1); addr = net_addr(at); mpls = net_mpls(at); if (addrcmp((void *) addr, (void *) &ctl->unspec_addr, ctl->af) != 0) { name = dns_lookup(ctl, addr); if (!net_up(at)) attron(A_BOLD); #ifdef HAVE_IPINFO if (is_printii(ctl)) printw(fmt_ipinfo(ctl, addr)); #endif if (name != NULL) { if (ctl->show_ips) printw("%s (%s)", name, strlongip(ctl, addr)); else printw("%s", name); } else { printw("%s", strlongip(ctl, addr)); } attroff(A_BOLD); getyx(stdscr, y, __unused_int); move(y, startstat); /* net_xxx returns times in usecs. Just display millisecs */ hd_len = 0; for (i = 0; i < MAXFLD; i++) { /* Ignore options that don't exist */ /* On the other hand, we now check the input side. Shouldn't happen, can't be careful enough. */ j = ctl->fld_index[ctl->fld_active[i]]; if (j == -1) continue; format_field(buf + hd_len, sizeof(buf) - hd_len, data_fields[j].format, data_fields[j].net_xxx(at)); hd_len += data_fields[j].length; } buf[hd_len] = 0; printw("%s", buf); for (k = 0; k < mpls->labels && ctl->enablempls; k++) { printw("\n [MPLS: Lbl %lu Exp %u S %u TTL %u]", mpls->label[k], mpls->exp[k], mpls->s[k], mpls->ttl[k]); } /* Multi path */ for (i = 0; i < MAXPATH; i++) { addrs = net_addrs(at, i); mplss = net_mplss(at, i); if (addrcmp((void *) addrs, (void *) addr, ctl->af) == 0) continue; if (addrcmp ((void *) addrs, (void *) &ctl->unspec_addr, ctl->af) == 0) break; name = dns_lookup(ctl, addrs); if (!net_up(at)) attron(A_BOLD); printw("\n "); #ifdef HAVE_IPINFO if (is_printii(ctl)) printw(fmt_ipinfo(ctl, addrs)); #endif if (name != NULL) { if (ctl->show_ips) printw("%s (%s)", name, strlongip(ctl, addrs)); else printw("%s", name); } else { printw("%s", strlongip(ctl, addrs)); } for (k = 0; k < mplss->labels && ctl->enablempls; k++) { printw("\n [MPLS: Lbl %lu Exp %u S %u TTL %u]", mplss->label[k], mplss->exp[k], mplss->s[k], mplss->ttl[k]); } attroff(A_BOLD); } } else { printw("???"); } printw("\n"); } move(2, 0); } static void mtr_gen_scale( struct mtr_ctl *ctl) { int *saved, i, max, at; int range; static int low_ms, high_ms; low_ms = 1000000; high_ms = -1; for (i = 0; i < NUM_FACTORS; i++) { scale[i] = 0; } max = net_max(ctl); for (at = ctl->display_offset; at < max; at++) { saved = net_saved_pings(at); for (i = 0; i < SAVED_PINGS; i++) { if (saved[i] < 0) continue; if (saved[i] < low_ms) { low_ms = saved[i]; } if (saved[i] > high_ms) { high_ms = saved[i]; } } } range = high_ms - low_ms; for (i = 0; i < NUM_FACTORS; i++) { scale[i] = low_ms + ((double) range * factors[i]); } } static void mtr_curses_init( void) { int i; int block_split; /* Initialize factors to a log scale. */ for (i = 0; i < NUM_FACTORS; i++) { factors[i] = ((double) 1 / NUM_FACTORS) * (i + 1); factors[i] *= factors[i]; /* Squared. */ } /* Initialize block_map. The block_split is always smaller than 9 */ block_split = (NUM_FACTORS - 2) / 2; for (i = 1; i <= block_split; i++) { block_map[i] = '0' + i; } for (i = block_split + 1; i < NUM_FACTORS - 1; i++) { block_map[i] = 'a' + i - block_split - 1; } block_map[0] = '.'; block_map[NUM_FACTORS - 1] = '>'; } static void mtr_print_scaled( int ms) { int i; for (i = 0; i < NUM_FACTORS; i++) { if (ms <= scale[i]) { attrset(block_col[i + 1]); printw("%c", block_map[i]); attrset(A_NORMAL); return; } } printw(">"); } static void mtr_fill_graph( struct mtr_ctl *ctl, int at, int cols) { int *saved; int i; saved = net_saved_pings(at); for (i = SAVED_PINGS - cols; i < SAVED_PINGS; i++) { if (saved[i] == -2) { printw(" "); } else if (saved[i] == -1) { attrset(block_col[0]); printw("%c", '?'); attrset(A_NORMAL); } else { if (ctl->display_mode == DisplayModeBlockmap) { if (saved[i] > scale[6]) { printw("%c", block_map[NUM_FACTORS - 1]); } else { printw("."); } } else { mtr_print_scaled(saved[i]); } } } } static void mtr_curses_graph( struct mtr_ctl *ctl, int startstat, int cols) { int max, at, y; ip_t *addr; char *name; int __unused_int ATTRIBUTE_UNUSED; max = net_max(ctl); for (at = ctl->display_offset; at < max; at++) { printw("%2d. ", at + 1); addr = net_addr(at); if (!addr) { printw("???\n"); continue; } if (!net_up(at)) attron(A_BOLD); if (addrcmp((void *) addr, (void *) &ctl->unspec_addr, ctl->af)) { #ifdef HAVE_IPINFO if (is_printii(ctl)) printw(fmt_ipinfo(ctl, addr)); #endif name = dns_lookup(ctl, addr); printw("%s", name ? name : strlongip(ctl, addr)); } else printw("???"); attroff(A_BOLD); getyx(stdscr, y, __unused_int); move(y, startstat); printw(" "); mtr_fill_graph(ctl, at, cols); printw("\n"); } } void mtr_curses_redraw( struct mtr_ctl *ctl) { int maxx; int startstat; int rowstat; time_t t; int __unused_int ATTRIBUTE_UNUSED; int i, j; int hd_len = 0; char buf[1024]; char fmt[16]; erase(); getmaxyx(stdscr, __unused_int, maxx); rowstat = 5; move(0, 0); attron(A_BOLD); snprintf(buf, sizeof(buf), "%s%s%s", "My traceroute [v", PACKAGE_VERSION, "]"); pwcenter(buf); attroff(A_BOLD); mvprintw(1, 0, "%s (%s)", ctl->LocalHostname, net_localaddr()); t = time(NULL); mvprintw(1, maxx - 25, iso_time(&t)); printw("\n"); printw("Keys: "); attron(A_BOLD); printw("H"); attroff(A_BOLD); printw("elp "); attron(A_BOLD); printw("D"); attroff(A_BOLD); printw("isplay mode "); attron(A_BOLD); printw("R"); attroff(A_BOLD); printw("estart statistics "); attron(A_BOLD); printw("O"); attroff(A_BOLD); printw("rder of fields "); attron(A_BOLD); printw("q"); attroff(A_BOLD); printw("uit\n"); if (ctl->display_mode == DisplayModeDefault) { for (i = 0; i < MAXFLD; i++) { j = ctl->fld_index[ctl->fld_active[i]]; if (j < 0) continue; snprintf(fmt, sizeof(fmt), "%%%ds", data_fields[j].length); snprintf(buf + hd_len, sizeof(buf) - hd_len, fmt, data_fields[j].title); hd_len += data_fields[j].length; } attron(A_BOLD); mvprintw(rowstat - 1, 0, " Host"); mvprintw(rowstat - 1, maxx - hd_len - 1, "%s", buf); mvprintw(rowstat - 2, maxx - hd_len - 1, " Packets Pings"); attroff(A_BOLD); move(rowstat, 0); mtr_curses_hosts(ctl, maxx - hd_len - 1); } else { char msg[80]; int padding = 30; int max_cols; #ifdef HAVE_IPINFO if (is_printii(ctl)) padding += get_iiwidth(ctl->ipinfo_no); #endif max_cols = maxx <= SAVED_PINGS + padding ? maxx - padding : SAVED_PINGS; startstat = padding - 2; snprintf(msg, sizeof(msg), " Last %3d pings", max_cols); mvprintw(rowstat - 1, startstat, msg); attroff(A_BOLD); move(rowstat, 0); mtr_gen_scale(ctl); mtr_curses_graph(ctl, startstat, max_cols); printw("\n"); attron(A_BOLD); printw("Scale:"); attroff(A_BOLD); for (i = 0; i < NUM_FACTORS - 1; i++) { printw(" "); attrset(block_col[i + 1]); printw("%c", block_map[i]); attrset(A_NORMAL); printw(":%d ms", scale[i] / 1000); } printw(" "); attrset(block_col[NUM_FACTORS]); printw("%c", block_map[NUM_FACTORS - 1]); attrset(A_NORMAL); } refresh(); } void mtr_curses_open( struct mtr_ctl *ctl) { int bg_col = 0; int i; initscr(); raw(); noecho(); start_color(); if (use_default_colors() == OK) bg_col = -1; for (i = 0; i < NUM_FACTORS; i++) init_pair(i + 1, i, bg_col); mtr_curses_init(); mtr_curses_redraw(ctl); } void mtr_curses_close( void) { printw("\n"); endwin(); } void mtr_curses_clear( struct mtr_ctl *ctl) { mtr_curses_close(); mtr_curses_open(ctl); } mtr-0.92/ui/mtr-curses.h0000664000175000017500000000200413045551745014163 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Prototypes for curses.c */ extern void mtr_curses_open( struct mtr_ctl *ctl); extern void mtr_curses_close( void); extern void mtr_curses_redraw( struct mtr_ctl *ctl); extern int mtr_curses_keyaction( struct mtr_ctl *ctl); extern void mtr_curses_clear( struct mtr_ctl *ctl); mtr-0.92/ui/split.h0000664000175000017500000000176713045551745013231 0ustar wolffwolff/* mtr -- a network diagnostic tool split.h -- raw output (for inclusion in KDE Network Utilities) Copyright (C) 1998 Bertrand Leconte This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Prototypes for split.c */ extern void split_open( void); extern void split_close( void); extern void split_redraw( struct mtr_ctl *ctl); extern int split_keyaction( void); mtr-0.92/ui/mtr.h0000664000175000017500000001062513045551745012671 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball Copyright (C) 2005 R.E.Wolff@BitWizard.nl This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef MTR_MTR_H #define MTR_MTR_H #include "config.h" #include #include #include #ifdef HAVE_NETINET_IN_H #include #endif /* Typedefs */ #ifdef ENABLE_IPV6 typedef struct in6_addr ip_t; #else typedef struct in_addr ip_t; #endif #ifndef HAVE_TIME_T typedef int time_t; #endif /* The __unused__ attribute was added in gcc 3.2.7. */ #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) #define ATTRIBUTE_UNUSED __attribute__((__unused__)) #else #define ATTRIBUTE_UNUSED /* empty */ #endif /* The __const__ attribute was added in gcc 2.95. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) #define ATTRIBUTE_CONST __attribute__ ((__const__)) #else #define ATTRIBUTE_CONST /* empty */ #endif /* stuff used by display such as report, curses... */ #define MAXFLD 20 /* max stats fields to display */ #define FLD_INDEX_SZ 256 /* net related definitions */ #define SAVED_PINGS 200 #define MAXPATH 8 #define MaxHost 256 #define MinPort 1024 #define MaxPort 65535 #define MAXPACKET 4470 /* largest test packet size */ #define MINPACKET 28 /* 20 bytes IP header and 8 bytes ICMP or UDP */ #define MAXLABELS 8 /* http://kb.juniper.net/KB2190 (+ 3 just in case) */ /* Stream Control Transmission Protocol is defined in netinet/in.h */ #ifdef IPPROTO_SCTP #define HAS_SCTP 1 #endif #ifndef HAVE_SOCKLEN_T typedef int socklen_t; #endif struct mtr_ctl { int MaxPing; float WaitTime; float GraceTime; char *Hostname; char *InterfaceAddress; char LocalHostname[128]; int ipinfo_no; int ipinfo_max; int cpacketsize; /* packet size used by ping */ int bitpattern; /* packet bit pattern used by ping */ int tos; /* type of service set in ping packet */ #ifdef SO_MARK uint32_t mark; #endif ip_t unspec_addr; int af; /* address family of remote target */ int mtrtype; /* type of query packet used */ int fstTTL; /* initial hub(ttl) to ping byMin */ int maxTTL; /* last hub to ping byMin */ int maxUnknown; /* stop ping threshold */ int remoteport; /* target port for TCP tracing */ int localport; /* source port for UDP tracing */ int probe_timeout; /* timeout for probe sockets */ unsigned char fld_active[2 * MAXFLD]; /* SO_MARK to set for ping packet */ int display_mode; /* display mode selector */ int fld_index[FLD_INDEX_SZ]; /* default display field (defined by key in net.h) and order */ char available_options[MAXFLD]; int display_offset; /* only used in text mode */ void *gtk_data; /* pointer to hold arbitrary gtk data */ unsigned int /* bit field to hold named booleans */ ForceMaxPing:1, use_dns:1, show_ips:1, enablempls:1, dns:1, reportwide:1, Interactive:1, DisplayMode:5; }; /* dynamic field drawing */ struct fields { const unsigned char key; const char *descr; const char *title; const char *format; const int length; int ( *net_xxx) ( int); }; /* defined in mtr.c */ extern const struct fields data_fields[MAXFLD]; /* MPLS label object */ struct mplslen { unsigned long label[MAXLABELS]; /* label value */ uint8_t exp[MAXLABELS]; /* experimental bits */ uint8_t ttl[MAXLABELS]; /* MPLS TTL */ char s[MAXLABELS]; /* bottom of stack */ char labels; /* how many labels did we get? */ }; #endif /* MTR_MTR_H */ mtr-0.92/ui/select.h0000664000175000017500000000141313045551745013341 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ extern void select_loop( struct mtr_ctl *ctl); mtr-0.92/ui/asn.c0000664000175000017500000001745513045551745012653 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include #include #include #include #ifdef HAVE_ERROR_H #include #else #include "portability/error.h" #endif #include #ifdef __APPLE__ #define BIND_8_COMPAT #endif #include #ifdef HAVE_ARPA_NAMESER_COMPAT_H #include #endif #include #include #include #include #include #include #include "mtr.h" #include "asn.h" #include "utils.h" /* #define IIDEBUG */ #ifdef IIDEBUG #include #define DEB_syslog syslog #else #define DEB_syslog(...) do {} while (0) #endif #define IIHASH_HI 128 #define ITEMSMAX 15 #define ITEMSEP '|' #define NAMELEN 127 #define UNKN "???" static int iihash = 0; static char fmtinfo[32]; /* items width: ASN, Route, Country, Registry, Allocated */ static const int iiwidth[] = { 7, 19, 4, 8, 11 }; /* item len + space */ typedef char *items_t[ITEMSMAX + 1]; static items_t items_a; /* without hash: items */ static char txtrec[NAMELEN + 1]; /* without hash: txtrec */ static items_t *items = &items_a; static char *ipinfo_lookup( const char *domain) { unsigned char answer[PACKETSZ], *pt; char host[128]; char *txt; int len, exp, size, txtlen, type; if (res_init() < 0) { error(0, 0, "@res_init failed"); return NULL; } memset(answer, 0, PACKETSZ); if ((len = res_query(domain, C_IN, T_TXT, answer, PACKETSZ)) < 0) { if (iihash) DEB_syslog(LOG_INFO, "Malloc-txt: %s", UNKN); return xstrdup(UNKN); } pt = answer + sizeof(HEADER); if ((exp = dn_expand(answer, answer + len, pt, host, sizeof(host))) < 0) { printf("@dn_expand failed\n"); return NULL; } pt += exp; GETSHORT(type, pt); if (type != T_TXT) { printf("@Broken DNS reply.\n"); return NULL; } pt += INT16SZ; /* class */ if ((exp = dn_expand(answer, answer + len, pt, host, sizeof(host))) < 0) { printf("@second dn_expand failed\n"); return NULL; } pt += exp; GETSHORT(type, pt); if (type != T_TXT) { printf("@Not a TXT record\n"); return NULL; } pt += INT16SZ; /* class */ pt += INT32SZ; /* ttl */ GETSHORT(size, pt); txtlen = *pt; if (txtlen >= size || !txtlen) { printf("@Broken TXT record (txtlen = %d, size = %d)\n", txtlen, size); return NULL; } if (txtlen > NAMELEN) txtlen = NAMELEN; if (iihash) { txt = xmalloc(txtlen + 1); } else txt = (char *) txtrec; pt++; xstrncpy(txt, (char *) pt, txtlen + 1); if (iihash) DEB_syslog(LOG_INFO, "Malloc-txt(%p): %s", txt, txt); return txt; } /* originX.asn.cymru.com txtrec: ASN | Route | Country | Registry | Allocated */ static char *split_txtrec( struct mtr_ctl *ctl, char *txt_rec) { char *prev; char *next; int i = 0, j; if (!txt_rec) return NULL; if (iihash) { DEB_syslog(LOG_INFO, "Malloc-tbl: %s", txt_rec); if (!(items = malloc(sizeof(*items)))) { DEB_syslog(LOG_INFO, "Free-txt(%p)", txt_rec); free(txt_rec); return NULL; } } prev = txt_rec; while ((next = strchr(prev, ITEMSEP)) && (i < ITEMSMAX)) { *next = '\0'; next++; (*items)[i] = trim(prev, ITEMSEP); prev = next; i++; } (*items)[i] = trim(prev, ITEMSEP); if (i < ITEMSMAX) i++; for (j = i; j <= ITEMSMAX; j++) (*items)[j] = NULL; if (i > ctl->ipinfo_max) ctl->ipinfo_max = i; if (ctl->ipinfo_no >= i) { if (ctl->ipinfo_no >= ctl->ipinfo_max) ctl->ipinfo_no = 0; return (*items)[0]; } else return (*items)[ctl->ipinfo_no]; } #ifdef ENABLE_IPV6 /* from dns.c:addr2ip6arpa() */ static void reverse_host6( struct in6_addr *addr, char *buff, int buff_length) { int i; char *b = buff; for (i = (sizeof(*addr) / 2 - 1); i >= 0; i--, b += 4) /* 64b portion */ snprintf(b, buff_length, "%x.%x.", addr->s6_addr[i] & 0xf, addr->s6_addr[i] >> 4); buff[strlen(buff) - 1] = '\0'; } #endif static char *get_ipinfo( struct mtr_ctl *ctl, ip_t * addr) { char key[NAMELEN]; char lookup_key[NAMELEN]; char *val = NULL; ENTRY item; if (!addr) return NULL; if (ctl->af == AF_INET6) { #ifdef ENABLE_IPV6 reverse_host6(addr, key, NAMELEN); if (snprintf(lookup_key, NAMELEN, "%s.origin6.asn.cymru.com", key) >= NAMELEN) return NULL; #else return NULL; #endif } else { unsigned char buff[4]; memcpy(buff, addr, 4); if (snprintf (key, NAMELEN, "%d.%d.%d.%d", buff[3], buff[2], buff[1], buff[0]) >= NAMELEN) return NULL; if (snprintf(lookup_key, NAMELEN, "%s.origin.asn.cymru.com", key) >= NAMELEN) return NULL; } if (iihash) { ENTRY *found_item; DEB_syslog(LOG_INFO, ">> Search: %s", key); item.key = key;; if ((found_item = hsearch(item, FIND))) { if (!(val = (*((items_t *) found_item->data))[ctl->ipinfo_no])) val = (*((items_t *) found_item->data))[0]; DEB_syslog(LOG_INFO, "Found (hashed): %s", val); } } if (!val) { DEB_syslog(LOG_INFO, "Lookup: %s", key); if ((val = split_txtrec(ctl, ipinfo_lookup(lookup_key)))) { DEB_syslog(LOG_INFO, "Looked up: %s", key); if (iihash) if ((item.key = xstrdup(key))) { item.data = (void *) items; hsearch(item, ENTER); DEB_syslog(LOG_INFO, "Insert into hash: %s", key); } } } return val; } ATTRIBUTE_CONST size_t get_iiwidth_len( void) { return (sizeof(iiwidth) / sizeof((iiwidth)[0])); } ATTRIBUTE_CONST int get_iiwidth( int ipinfo_no) { static const int len = (sizeof(iiwidth) / sizeof((iiwidth)[0])); if (ipinfo_no < len) return iiwidth[ipinfo_no]; return iiwidth[ipinfo_no % len]; } char *fmt_ipinfo( struct mtr_ctl *ctl, ip_t * addr) { char *ipinfo = get_ipinfo(ctl, addr); char fmt[8]; snprintf(fmt, sizeof(fmt), "%s%%-%ds", ctl->ipinfo_no ? "" : "AS", get_iiwidth(ctl->ipinfo_no)); snprintf(fmtinfo, sizeof(fmtinfo), fmt, ipinfo ? ipinfo : UNKN); return fmtinfo; } int is_printii( struct mtr_ctl *ctl) { return ((ctl->ipinfo_no >= 0) && (ctl->ipinfo_no != ctl->ipinfo_max)); } void asn_open( struct mtr_ctl *ctl) { if (ctl->ipinfo_no >= 0) { DEB_syslog(LOG_INFO, "hcreate(%d)", IIHASH_HI); if (!(iihash = hcreate(IIHASH_HI))) error(0, errno, "ipinfo hash"); } } void asn_close( struct mtr_ctl *ctl) { if ((ctl->ipinfo_no >= 0) && iihash) { DEB_syslog(LOG_INFO, "hdestroy()"); hdestroy(); iihash = 0; } } mtr-0.92/ui/dns.h0000664000175000017500000000264313045551745012654 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include /* Prototypes for dns.c */ extern void dns_open( struct mtr_ctl *ctl); extern int dns_waitfd( void); extern void dns_ack( struct mtr_ctl *ctl); #ifdef ENABLE_IPV6 extern int dns_waitfd6( void); extern void dns_ack6( void); #endif extern char *dns_lookup( struct mtr_ctl *ctl, ip_t * address); extern char *dns_lookup2( struct mtr_ctl *ctl, ip_t * address); extern struct hostent *dns_forward( const char *name); extern char *strlongip( struct mtr_ctl *ctl, ip_t * ip); extern void addr2ip6arpa( ip_t * ip, char *buf); extern struct hostent *addr2host( const char *addr, int type); mtr-0.92/ui/split.c0000664000175000017500000001025713045551745013216 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997 Matt Kimball split.c -- raw output (for inclusion in KDE Network Utilities or others GUI based tools) Copyright (C) 1998 Bertrand Leconte This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include #include #include #include #include #include "mtr.h" #include "display.h" #include "dns.h" #include "net.h" #include "split.h" #include "utils.h" #ifdef HAVE_CURSES #if defined(HAVE_NCURSES_H) #include #elif defined(HAVE_NCURSES_CURSES_H) #include #elif defined(HAVE_CURSES_H) #include #else #error No curses header file available #endif #else #include #include #include #endif /* There is 256 hops max in the IP header (coded with a byte) */ #define MAX_LINE_COUNT 256 #define MAX_LINE_SIZE 256 static char Lines[MAX_LINE_COUNT][MAX_LINE_SIZE]; static int LineCount; #define DEBUG 0 void split_redraw( struct mtr_ctl *ctl) { int max; int at; ip_t *addr; char newLine[MAX_LINE_SIZE]; int i; #if DEBUG fprintf(stderr, "split_redraw()\n"); #endif /* * If there is less lines than last time, we delete them * TEST THIS PLEASE */ max = net_max(ctl); for (i = LineCount; i > max; i--) { printf("-%d\n", i); LineCount--; } /* * For each line, we compute the new one and we compare it to the old one */ for (at = 0; at < max; at++) { addr = net_addr(at); if (addrcmp((void *) addr, (void *) &ctl->unspec_addr, ctl->af)) { char str[256], *name; if (!(name = dns_lookup(ctl, addr))) name = strlongip(ctl, addr); if (ctl->show_ips) { snprintf(str, sizeof(str), "%s %s", name, strlongip(ctl, addr)); name = str; } /* May be we should test name's length */ snprintf(newLine, sizeof(newLine), "%s %d %d %d %d %d %d", name, net_loss(at), net_returned(at), net_xmit(at), net_best(at) / 1000, net_avg(at) / 1000, net_worst(at) / 1000); } else { snprintf(newLine, sizeof(newLine), "???"); } if (strcmp(newLine, Lines[at]) == 0) { /* The same, so do nothing */ #if DEBUG printf("SAME LINE\n"); #endif } else { printf("%d %s\n", at + 1, newLine); fflush(stdout); xstrncpy(Lines[at], newLine, MAX_LINE_SIZE); if (LineCount < (at + 1)) { LineCount = at + 1; } } } } void split_open( void) { int i; #if DEBUG printf("split_open()\n"); #endif LineCount = -1; for (i = 0; i < MAX_LINE_COUNT; i++) { xstrncpy(Lines[i], "???", MAX_LINE_SIZE); } } void split_close( void) { #if DEBUG printf("split_close()\n"); #endif } int split_keyaction( void) { #ifdef HAVE_CURSES unsigned char c = getch(); #else fd_set readfds; struct timeval tv; char c; FD_ZERO(&readfds); FD_SET(0, &readfds); tv.tv_sec = 0; tv.tv_usec = 0; if (select(1, &readfds, NULL, NULL, &tv) > 0) { read(0, &c, 1); } else return 0; #endif #if DEBUG printf("split_keyaction()\n"); #endif if (tolower(c) == 'q') return ActionQuit; if (c == 3) return ActionQuit; if (tolower(c) == 'r') return ActionReset; return 0; } mtr-0.92/ui/report.c0000664000175000017500000003543213114223576013373 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include #include #include #include #include #include #include #include #include "mtr.h" #include "report.h" #include "net.h" #include "dns.h" #include "asn.h" #include "utils.h" #define MAXLOADBAL 5 #define MAX_FORMAT_STR 81 void report_open( void) { const time_t now = time(NULL); const char *t = iso_time(&now); printf("Start: %s\n", t); } static size_t snprint_addr( struct mtr_ctl *ctl, char *dst, size_t dst_len, ip_t * addr) { if (addrcmp((void *) addr, (void *) &ctl->unspec_addr, ctl->af)) { struct hostent *host = ctl->dns ? addr2host((void *) addr, ctl->af) : NULL; if (!host) return snprintf(dst, dst_len, "%s", strlongip(ctl, addr)); else if (ctl->dns && ctl->show_ips) return snprintf(dst, dst_len, "%s (%s)", host->h_name, strlongip(ctl, addr)); else return snprintf(dst, dst_len, "%s", host->h_name); } else return snprintf(dst, dst_len, "%s", "???"); } #ifdef HAVE_IPINFO static void print_mpls( struct mplslen *mpls) { int k; for (k = 0; k < mpls->labels; k++) printf(" [MPLS: Lbl %lu Exp %u S %cu TTL %u]\n", mpls->label[k], mpls->exp[k], mpls->s[k], mpls->ttl[k]); } #endif void report_close( struct mtr_ctl *ctl) { int i, j, at, max, z, w; struct mplslen *mpls, *mplss; ip_t *addr; ip_t *addr2 = NULL; char name[MAX_FORMAT_STR]; char buf[1024]; char fmt[16]; size_t len = 0; size_t len_hosts = 33; #ifdef HAVE_IPINFO int len_tmp; const size_t iiwidth_len = get_iiwidth_len(); #endif if (ctl->reportwide) { /* get the longest hostname */ len_hosts = strlen(ctl->LocalHostname); max = net_max(ctl); at = net_min(ctl); for (; at < max; at++) { size_t nlen; addr = net_addr(at); if ((nlen = snprint_addr(ctl, name, sizeof(name), addr))) if (len_hosts < nlen) len_hosts = nlen; } } #ifdef HAVE_IPINFO len_tmp = len_hosts; if (ctl->ipinfo_no >= 0 && iiwidth_len) { ctl->ipinfo_no %= iiwidth_len; if (ctl->reportwide) { len_hosts++; /* space */ len_tmp += get_iiwidth(ctl->ipinfo_no); if (!ctl->ipinfo_no) len_tmp += 2; /* align header: AS */ } } snprintf(fmt, sizeof(fmt), "HOST: %%-%ds", len_tmp); #else snprintf(fmt, sizeof(fmt), "HOST: %%-%zus", len_hosts); #endif snprintf(buf, sizeof(buf), fmt, ctl->LocalHostname); len = ctl->reportwide ? strlen(buf) : len_hosts; for (i = 0; i < MAXFLD; i++) { j = ctl->fld_index[ctl->fld_active[i]]; if (j < 0) continue; snprintf(fmt, sizeof(fmt), "%%%ds", data_fields[j].length); snprintf(buf + len, sizeof(buf), fmt, data_fields[j].title); len += data_fields[j].length; } printf("%s\n", buf); max = net_max(ctl); at = net_min(ctl); for (; at < max; at++) { addr = net_addr(at); mpls = net_mpls(at); snprint_addr(ctl, name, sizeof(name), addr); #ifdef HAVE_IPINFO if (is_printii(ctl)) { snprintf(fmt, sizeof(fmt), " %%2d. %%s%%-%zus", len_hosts); snprintf(buf, sizeof(buf), fmt, at + 1, fmt_ipinfo(ctl, addr), name); } else { #endif snprintf(fmt, sizeof(fmt), " %%2d.|-- %%-%zus", len_hosts); snprintf(buf, sizeof(buf), fmt, at + 1, name); #ifdef HAVE_IPINFO } #endif len = ctl->reportwide ? strlen(buf) : len_hosts; for (i = 0; i < MAXFLD; i++) { j = ctl->fld_index[ctl->fld_active[i]]; if (j < 0) continue; /* 1000.0 is a temporay hack for stats usec to ms, impacted net_loss. */ if (strchr(data_fields[j].format, 'f')) { snprintf(buf + len, sizeof(buf), data_fields[j].format, data_fields[j].net_xxx(at) / 1000.0); } else { snprintf(buf + len, sizeof(buf), data_fields[j].format, data_fields[j].net_xxx(at)); } len += data_fields[j].length; } printf("%s\n", buf); /* This feature shows 'loadbalances' on routes */ /* z is starting at 1 because addrs[0] is the same that addr */ for (z = 1; z < MAXPATH; z++) { int found = 0; addr2 = net_addrs(at, z); mplss = net_mplss(at, z); if ((addrcmp ((void *) &ctl->unspec_addr, (void *) addr2, ctl->af)) == 0) break; for (w = 0; w < z; w++) /* Ok... checking if there are ips repeated on same hop */ if ((addrcmp ((void *) addr2, (void *) net_addrs(at, w), ctl->af)) == 0) { found = 1; break; } if (!found) { #ifdef HAVE_IPINFO if (is_printii(ctl)) { if (mpls->labels && z == 1 && ctl->enablempls) print_mpls(mpls); snprint_addr(ctl, name, sizeof(name), addr2); printf(" %s%s\n", fmt_ipinfo(ctl, addr2), name); if (ctl->enablempls) print_mpls(mplss); } #else int k; if (mpls->labels && z == 1 && ctl->enablempls) { for (k = 0; k < mpls->labels; k++) { printf (" | |+-- [MPLS: Lbl %lu Exp %u S %u TTL %u]\n", mpls->label[k], mpls->exp[k], mpls->s[k], mpls->ttl[k]); } } if (z == 1) { printf(" | `|-- %s\n", strlongip(ctl, addr2)); for (k = 0; k < mplss->labels && ctl->enablempls; k++) { printf (" | +-- [MPLS: Lbl %lu Exp %u S %u TTL %u]\n", mplss->label[k], mplss->exp[k], mplss->s[k], mplss->ttl[k]); } } else { printf(" | |-- %s\n", strlongip(ctl, addr2)); for (k = 0; k < mplss->labels && ctl->enablempls; k++) { printf (" | +-- [MPLS: Lbl %lu Exp %u S %u TTL %u]\n", mplss->label[k], mplss->exp[k], mplss->s[k], mplss->ttl[k]); } } #endif } } /* No multipath */ #ifdef HAVE_IPINFO if (is_printii(ctl)) { if (mpls->labels && z == 1 && ctl->enablempls) print_mpls(mpls); } #else if (mpls->labels && z == 1 && ctl->enablempls) { int k; for (k = 0; k < mpls->labels; k++) { printf(" | +-- [MPLS: Lbl %lu Exp %u S %u TTL %u]\n", mpls->label[k], mpls->exp[k], mpls->s[k], mpls->ttl[k]); } } #endif } } void txt_open( void) { } void txt_close( struct mtr_ctl *ctl) { report_close(ctl); } void json_open( void) { } void json_close( struct mtr_ctl *ctl) { int i, j, at, first, max; ip_t *addr; char name[MAX_FORMAT_STR]; printf("{\n"); printf(" \"report\": {\n"); printf(" \"mtr\": {\n"); printf(" \"src\": \"%s\",\n", ctl->LocalHostname); printf(" \"dst\": \"%s\",\n", ctl->Hostname); printf(" \"tos\": \"0x%X\",\n", ctl->tos); if (ctl->cpacketsize >= 0) { printf(" \"psize\": \"%d\",\n", ctl->cpacketsize); } else { printf(" \"psize\": \"rand(%d-%d)\",\n", MINPACKET, -ctl->cpacketsize); } if (ctl->bitpattern >= 0) { printf(" \"bitpattern\": \"0x%02X\",\n", (unsigned char) (ctl->bitpattern)); } else { printf(" \"bitpattern\": \"rand(0x00-FF)\",\n"); } printf(" \"tests\": \"%d\"\n", ctl->MaxPing); printf(" },\n"); printf(" \"hubs\": ["); max = net_max(ctl); at = first = net_min(ctl); for (; at < max; at++) { addr = net_addr(at); snprint_addr(ctl, name, sizeof(name), addr); if (at == first) { printf("{\n"); } else { printf(" {\n"); } printf(" \"count\": \"%d\",\n", at + 1); printf(" \"host\": \"%s\",\n", name); #ifdef HAVE_IPINFO if(!ctl->ipinfo_no) { char* fmtinfo = fmt_ipinfo(ctl, addr); if (fmtinfo != NULL) fmtinfo = trim(fmtinfo, '\0'); printf(" \"ASN\": \"%s\",\n", fmtinfo); } #endif for (i = 0; i < MAXFLD; i++) { const char *format; j = ctl->fld_index[ctl->fld_active[i]]; /* Commas */ if (i + 1 == MAXFLD) { printf("\n"); } else if (j > 0 && i != 0) { printf(",\n"); } if (j <= 0) continue; /* Field nr 0, " " shouldn't be printed in this method. */ /* Format value */ format = data_fields[j].format; if (strchr(format, 'f')) { format = "%.2f"; } else { format = "%d"; } /* Format json line */ snprintf(name, sizeof(name), "%s%s", " \"%s\": ", format); /* Output json line */ if (strchr(data_fields[j].format, 'f')) { /* 1000.0 is a temporay hack for stats usec to ms, impacted net_loss. */ printf(name, data_fields[j].title, data_fields[j].net_xxx(at) / 1000.0); } else { printf(name, data_fields[j].title, data_fields[j].net_xxx(at)); } } if (at + 1 == max) { printf(" }]\n"); } else { printf(" },\n"); } } printf(" }\n"); printf("}\n"); } void xml_open( void) { } void xml_close( struct mtr_ctl *ctl) { int i, j, at, max; ip_t *addr; char name[MAX_FORMAT_STR]; printf("\n"); printf("LocalHostname, ctl->Hostname); printf(" TOS=\"0x%X\"", ctl->tos); if (ctl->cpacketsize >= 0) { printf(" PSIZE=\"%d\"", ctl->cpacketsize); } else { printf(" PSIZE=\"rand(%d-%d)\"", MINPACKET, -ctl->cpacketsize); } if (ctl->bitpattern >= 0) { printf(" BITPATTERN=\"0x%02X\"", (unsigned char) (ctl->bitpattern)); } else { printf(" BITPATTERN=\"rand(0x00-FF)\""); } printf(" TESTS=\"%d\">\n", ctl->MaxPing); max = net_max(ctl); at = net_min(ctl); for (; at < max; at++) { addr = net_addr(at); snprint_addr(ctl, name, sizeof(name), addr); printf(" \n", at + 1, name); for (i = 0; i < MAXFLD; i++) { const char *title; j = ctl->fld_index[ctl->fld_active[i]]; if (j <= 0) continue; /* Field nr 0, " " shouldn't be printed in this method. */ snprintf(name, sizeof(name), "%s%s%s", " <%s>", data_fields[j].format, "\n"); /* XML doesn't allow "%" in tag names, rename Loss% to just Loss */ title = data_fields[j].title; if (strcmp(data_fields[j].title, "Loss%") == 0) { title = "Loss"; } /* 1000.0 is a temporay hack for stats usec to ms, impacted net_loss. */ if (strchr(data_fields[j].format, 'f')) { printf(name, title, data_fields[j].net_xxx(at) / 1000.0, title); } else { printf(name, title, data_fields[j].net_xxx(at), title); } } printf(" \n"); } printf("\n"); } void csv_open( void) { } void csv_close( struct mtr_ctl *ctl, time_t now) { int i, j, at, max; ip_t *addr; char name[MAX_FORMAT_STR]; for (i = 0; i < MAXFLD; i++) { j = ctl->fld_index[ctl->fld_active[i]]; if (j < 0) continue; } max = net_max(ctl); at = net_min(ctl); for (; at < max; at++) { addr = net_addr(at); snprint_addr(ctl, name, sizeof(name), addr); if (at == net_min(ctl)) { printf("Mtr_Version,Start_Time,Status,Host,Hop,Ip,"); #ifdef HAVE_IPINFO if (!ctl->ipinfo_no) { printf("Asn,"); } #endif for (i = 0; i < MAXFLD; i++) { j = ctl->fld_index[ctl->fld_active[i]]; if (j < 0) continue; printf("%s,", data_fields[j].title); } printf("\n"); } #ifdef HAVE_IPINFO if (!ctl->ipinfo_no) { char *fmtinfo = fmt_ipinfo(ctl, addr); fmtinfo = trim(fmtinfo, '\0'); printf("MTR.%s,%lld,%s,%s,%d,%s,%s", PACKAGE_VERSION, (long long) now, "OK", ctl->Hostname, at + 1, name, fmtinfo); } else #endif printf("MTR.%s,%lld,%s,%s,%d,%s", PACKAGE_VERSION, (long long) now, "OK", ctl->Hostname, at + 1, name); for (i = 0; i < MAXFLD; i++) { j = ctl->fld_index[ctl->fld_active[i]]; if (j < 0) continue; /* 1000.0 is a temporay hack for stats usec to ms, impacted net_loss. */ if (strchr(data_fields[j].format, 'f')) { printf(",%.2f", (double) (data_fields[j].net_xxx(at) / 1000.0)); } else { printf(",%d", data_fields[j].net_xxx(at)); } } printf("\n"); } } mtr-0.92/ui/net.c0000664000175000017500000004714713045551745012661 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include #include #include #include #include #include #ifdef HAVE_ERROR_H #include #else #include "portability/error.h" #endif #include "mtr.h" #include "cmdpipe.h" #include "net.h" #include "display.h" #include "dns.h" #include "utils.h" #define MinSequence 33000 #define MaxSequence 65536 static int packetsize; /* packet size used by ping */ static void sockaddrtop( struct sockaddr *saddr, char *strptr, size_t len); struct nethost { ip_t addr; ip_t addrs[MAXPATH]; /* for multi paths byMin */ int xmit; int returned; int sent; int up; long long ssd; /* sum of squares of differences from the current average */ int last; int best; int worst; int avg; /* average: addByMin */ int gmean; /* geometric mean: addByMin */ int jitter; /* current jitter, defined as t1-t0 addByMin */ int javg; /* avg jitter */ int jworst; /* max jitter */ int jinta; /* estimated variance,? rfc1889's "Interarrival Jitter" */ int transit; int saved[SAVED_PINGS]; int saved_seq_offset; struct mplslen mpls; struct mplslen mplss[MAXPATH]; }; struct sequence { int index; int transit; int saved_seq; struct timeval time; }; static struct nethost host[MaxHost]; static struct sequence sequence[MaxSequence]; static struct packet_command_pipe_t packet_command_pipe; #ifdef ENABLE_IPV6 static struct sockaddr_storage sourcesockaddr_struct; static struct sockaddr_storage remotesockaddr_struct; static struct sockaddr_in6 *ssa6 = (struct sockaddr_in6 *) &sourcesockaddr_struct; static struct sockaddr_in6 *rsa6 = (struct sockaddr_in6 *) &remotesockaddr_struct; #else static struct sockaddr_in sourcesockaddr_struct; static struct sockaddr_in remotesockaddr_struct; #endif static struct sockaddr *sourcesockaddr = (struct sockaddr *) &sourcesockaddr_struct; static struct sockaddr *remotesockaddr = (struct sockaddr *) &remotesockaddr_struct; static struct sockaddr_in *ssa4 = (struct sockaddr_in *) &sourcesockaddr_struct; static struct sockaddr_in *rsa4 = (struct sockaddr_in *) &remotesockaddr_struct; static ip_t *sourceaddress; static ip_t *remoteaddress; #ifdef ENABLE_IPV6 static char localaddr[INET6_ADDRSTRLEN]; #else #ifndef INET_ADDRSTRLEN #define INET_ADDRSTRLEN 16 #endif static char localaddr[INET_ADDRSTRLEN]; #endif static int batch_at = 0; static int numhosts = 10; /* return the number of microseconds to wait before sending the next ping */ int calc_deltatime( float waittime) { waittime /= numhosts; return 1000000 * waittime; } static void save_sequence( struct mtr_ctl *ctl, int index, int seq) { display_rawxmit(ctl, index, seq); sequence[seq].index = index; sequence[seq].transit = 1; sequence[seq].saved_seq = ++host[index].xmit; memset(&sequence[seq].time, 0, sizeof(sequence[seq].time)); host[index].transit = 1; if (host[index].sent) { host[index].up = 0; } host[index].sent = 1; net_save_xmit(index); } static int new_sequence( struct mtr_ctl *ctl, int index) { static int next_sequence = MinSequence; int seq; seq = next_sequence++; if (next_sequence >= MaxSequence) { next_sequence = MinSequence; } save_sequence(ctl, index, seq); return seq; } /* Attempt to find the host at a particular number of hops away */ static void net_send_query( struct mtr_ctl *ctl, int index, int packet_size) { int seq = new_sequence(ctl, index); int time_to_live = index + 1; send_probe_command(ctl, &packet_command_pipe, remoteaddress, sourceaddress, packetsize, seq, time_to_live); } /* We got a return on something we sent out. Record the address and time. */ static void net_process_ping( struct mtr_ctl *ctl, int seq, struct mplslen *mpls, ip_t * addr, int totusec) { int index; int oldavg; /* usedByMin */ int oldjavg; /* usedByMin */ int i; /* usedByMin */ #ifdef ENABLE_IPV6 char addrcopy[sizeof(struct in6_addr)]; #else char addrcopy[sizeof(struct in_addr)]; #endif addrcpy((void *) &addrcopy, (char *) addr, ctl->af); if ((seq < 0) || (seq >= MaxSequence)) { return; } if (!sequence[seq].transit) { return; } sequence[seq].transit = 0; index = sequence[seq].index; if (addrcmp((void *) &(host[index].addr), (void *) &ctl->unspec_addr, ctl->af) == 0) { /* should be out of if as addr can change */ addrcpy((void *) &(host[index].addr), addrcopy, ctl->af); host[index].mpls = *mpls; display_rawhost(ctl, index, (void *) &(host[index].addr)); /* multi paths */ addrcpy((void *) &(host[index].addrs[0]), addrcopy, ctl->af); host[index].mplss[0] = *mpls; } else { for (i = 0; i < MAXPATH;) { if (addrcmp ((void *) &(host[index].addrs[i]), (void *) &addrcopy, ctl->af) == 0 || addrcmp((void *) &(host[index].addrs[i]), (void *) &ctl->unspec_addr, ctl->af) == 0) { break; } i++; } if (addrcmp((void *) &(host[index].addrs[i]), addrcopy, ctl->af) != 0 && i < MAXPATH) { addrcpy((void *) &(host[index].addrs[i]), addrcopy, ctl->af); host[index].mplss[i] = *mpls; display_rawhost(ctl, index, (void *) &(host[index].addrs[i])); } } host[index].jitter = totusec - host[index].last; if (host[index].jitter < 0) { host[index].jitter = -host[index].jitter; } host[index].last = totusec; if (host[index].returned < 1) { host[index].best = host[index].worst = host[index].gmean = totusec; host[index].avg = host[index].ssd = 0; host[index].jitter = host[index].jworst = host[index].jinta = 0; } if (totusec < host[index].best) { host[index].best = totusec; } if (totusec > host[index].worst) { host[index].worst = totusec; } if (host[index].jitter > host[index].jworst) { host[index].jworst = host[index].jitter; } host[index].returned++; oldavg = host[index].avg; host[index].avg += (totusec - oldavg + .0) / host[index].returned; host[index].ssd += (totusec - oldavg + .0) * (totusec - host[index].avg); oldjavg = host[index].javg; host[index].javg += (host[index].jitter - oldjavg) / host[index].returned; /* below algorithm is from rfc1889, A.8 */ host[index].jinta += host[index].jitter - ((host[index].jinta + 8) >> 4); if (host[index].returned > 1) { host[index].gmean = pow((double) host[index].gmean, (host[index].returned - 1.0) / host[index].returned) * pow((double) totusec, 1.0 / host[index].returned); } host[index].sent = 0; host[index].up = 1; host[index].transit = 0; net_save_return(index, sequence[seq].saved_seq, totusec); display_rawping(ctl, index, totusec, seq); } /* Invoked when the read pipe from the mtr-packet subprocess is readable. If we have received a complete reply, process it. */ void net_process_return( struct mtr_ctl *ctl) { handle_command_replies(ctl, &packet_command_pipe, net_process_ping); } ip_t *net_addr( int at) { return (ip_t *) & (host[at].addr); } ip_t *net_addrs( int at, int i) { return (ip_t *) & (host[at].addrs[i]); } void *net_mpls( int at) { return (struct mplslen *) &(host[at].mplss); } void *net_mplss( int at, int i) { return (struct mplslen *) &(host[at].mplss[i]); } int net_loss( int at) { if ((host[at].xmit - host[at].transit) == 0) { return 0; } /* times extra 1000 */ return 1000 * (100 - (100.0 * host[at].returned / (host[at].xmit - host[at].transit))); } int net_drop( int at) { return (host[at].xmit - host[at].transit) - host[at].returned; } int net_last( int at) { return (host[at].last); } int net_best( int at) { return (host[at].best); } int net_worst( int at) { return (host[at].worst); } int net_avg( int at) { return (host[at].avg); } int net_gmean( int at) { return (host[at].gmean); } int net_stdev( int at) { if (host[at].returned > 1) { return (sqrt(host[at].ssd / (host[at].returned - 1.0))); } else { return (0); } } int net_jitter( int at) { return (host[at].jitter); } int net_jworst( int at) { return (host[at].jworst); } int net_javg( int at) { return (host[at].javg); } int net_jinta( int at) { return (host[at].jinta); } int net_max( struct mtr_ctl *ctl) { int at; int max; max = 0; for (at = 0; at < ctl->maxTTL - 1; at++) { if (addrcmp((void *) &(host[at].addr), (void *) remoteaddress, ctl->af) == 0) { return at + 1; } else if (addrcmp((void *) &(host[at].addr), (void *) &ctl->unspec_addr, ctl->af) != 0) { max = at + 2; } } return max; } int net_min( struct mtr_ctl *ctl) { return (ctl->fstTTL - 1); } int net_returned( int at) { return host[at].returned; } int net_xmit( int at) { return host[at].xmit; } int net_up( int at) { return host[at].up; } char *net_localaddr( void) { return localaddr; } void net_end_transit( void) { int at; for (at = 0; at < MaxHost; at++) { host[at].transit = 0; } } int net_send_batch( struct mtr_ctl *ctl) { int n_unknown = 0, i; /* randomized packet size and/or bit pattern if packetsize<0 and/or bitpattern<0. abs(packetsize) and/or abs(bitpattern) will be used */ if (batch_at < ctl->fstTTL) { if (ctl->cpacketsize < 0) { /* Someone used a formula here that tried to correct for the "end-error" in "rand()". By "end-error" I mean that if you have a range for "rand()" that runs to 32768, and the destination range is 10000, you end up with 4 out of 32768 0-2768's and only 3 out of 32768 for results 2769 .. 9999. As our detination range (in the example 10000) is much smaller (reasonable packet sizes), and our rand() range much larger, this effect is insignificant. Oh! That other formula didn't work. */ packetsize = MINPACKET + rand() % (-ctl->cpacketsize - MINPACKET); } else { packetsize = ctl->cpacketsize; } if (ctl->bitpattern < 0) { ctl->bitpattern = -(int) (256 + 255 * (rand() / (RAND_MAX + 0.1))); } } net_send_query(ctl, batch_at, abs(packetsize)); for (i = ctl->fstTTL - 1; i < batch_at; i++) { if (addrcmp ((void *) &(host[i].addr), (void *) &ctl->unspec_addr, ctl->af) == 0) n_unknown++; /* The second condition in the next "if" statement was added in mtr-0.56, but I don't remember why. It makes mtr stop skipping sections of unknown hosts. Removed in 0.65. If the line proves necessary, it should at least NOT trigger that line when host[i].addr == 0 */ if ((addrcmp((void *) &(host[i].addr), (void *) remoteaddress, ctl->af) == 0)) n_unknown = MaxHost; /* Make sure we drop into "we should restart" */ } if ( /* success in reaching target */ (addrcmp((void *) &(host[batch_at].addr), (void *) remoteaddress, ctl->af) == 0) || /* fail in consecutive maxUnknown (firewall?) */ (n_unknown > ctl->maxUnknown) || /* or reach limit */ (batch_at >= ctl->maxTTL - 1)) { numhosts = batch_at + 1; batch_at = ctl->fstTTL - 1; return 1; } batch_at++; return 0; } /* Ensure the interface address a valid address for our use */ static void net_validate_interface_address( int address_family, char *interface_address) { if (inet_pton(address_family, interface_address, sourceaddress) != 1) { error(EXIT_FAILURE, errno, "invalid local address"); } if (inet_ntop (address_family, sourceaddress, localaddr, sizeof(localaddr)) == NULL) { error(EXIT_FAILURE, errno, "invalid local address"); } } /* Find the local address we will use to sent to the remote host by connecting a UDP socket and checking the address the socket is bound to. */ static void net_find_local_address( void) { int udp_socket; int addr_length; struct sockaddr_storage remote_sockaddr; struct sockaddr_in *remote4; struct sockaddr_in6 *remote6; udp_socket = socket(remotesockaddr->sa_family, SOCK_DGRAM, IPPROTO_UDP); if (udp_socket == -1) { error(EXIT_FAILURE, errno, "udp socket creation failed"); } /* We need to set the port to a non-zero value for the connect to succeed. */ if (remotesockaddr->sa_family == AF_INET6) { #ifdef ENABLE_IPV6 addr_length = sizeof(struct sockaddr_in6); memcpy(&remote_sockaddr, rsa6, addr_length); remote6 = (struct sockaddr_in6 *) &remote_sockaddr; remote6->sin6_port = htons(1); #endif } else { addr_length = sizeof(struct sockaddr_in); memcpy(&remote_sockaddr, rsa4, addr_length); remote4 = (struct sockaddr_in *) &remote_sockaddr; remote4->sin_port = htons(1); } if (connect (udp_socket, (struct sockaddr *) &remote_sockaddr, addr_length)) { error(EXIT_FAILURE, errno, "udp socket connect failed"); } if (getsockname(udp_socket, sourcesockaddr, &addr_length)) { error(EXIT_FAILURE, errno, "local address determination failed"); } sockaddrtop(sourcesockaddr, localaddr, sizeof(localaddr)); close(udp_socket); } int net_open( struct mtr_ctl *ctl, struct hostent *hostent) { int err; /* Spawn the mtr-packet child process */ err = open_command_pipe(ctl, &packet_command_pipe); if (err) { return err; } net_reset(ctl); remotesockaddr->sa_family = hostent->h_addrtype; switch (hostent->h_addrtype) { case AF_INET: addrcpy((void *) &(rsa4->sin_addr), hostent->h_addr, AF_INET); sourceaddress = (ip_t *) & (ssa4->sin_addr); remoteaddress = (ip_t *) & (rsa4->sin_addr); break; #ifdef ENABLE_IPV6 case AF_INET6: addrcpy((void *) &(rsa6->sin6_addr), hostent->h_addr, AF_INET6); sourceaddress = (ip_t *) & (ssa6->sin6_addr); remoteaddress = (ip_t *) & (rsa6->sin6_addr); break; #endif default: error(EXIT_FAILURE, 0, "net_open bad address type"); } if (ctl->InterfaceAddress) { net_validate_interface_address(ctl->af, ctl->InterfaceAddress); } else { net_find_local_address(); } return 0; } void net_reopen( struct mtr_ctl *ctl, struct hostent *addr) { int at; for (at = 0; at < MaxHost; at++) { memset(&host[at], 0, sizeof(host[at])); } remotesockaddr->sa_family = addr->h_addrtype; addrcpy((void *) remoteaddress, addr->h_addr, addr->h_addrtype); switch (addr->h_addrtype) { case AF_INET: addrcpy((void *) &(rsa4->sin_addr), addr->h_addr, AF_INET); break; #ifdef ENABLE_IPV6 case AF_INET6: addrcpy((void *) &(rsa6->sin6_addr), addr->h_addr, AF_INET6); break; #endif default: error(EXIT_FAILURE, 0, "net_reopen bad address type"); } net_reset(ctl); net_send_batch(ctl); } void net_reset( struct mtr_ctl *ctl) { static struct nethost template = { .saved_seq_offset = 2 - SAVED_PINGS }; int at, i; batch_at = ctl->fstTTL - 1; /* above replacedByMin */ numhosts = 10; for (i = 0; i < SAVED_PINGS; i++) template.saved[i] = -2; for (at = 0; at < MaxHost; at++) { memcpy(&(host[at]), &template, sizeof(template)); } for (at = 0; at < MaxSequence; at++) { sequence[at].transit = 0; } } /* Close the pipe to the packet generator process, and kill the process */ void net_close( void) { close_command_pipe(&packet_command_pipe); } int net_waitfd( void) { return packet_command_pipe.read_fd; } int *net_saved_pings( int at) { return host[at].saved; } static void net_save_increment( void) { int at; for (at = 0; at < MaxHost; at++) { memmove(host[at].saved, host[at].saved + 1, (SAVED_PINGS - 1) * sizeof(int)); host[at].saved[SAVED_PINGS - 1] = -2; host[at].saved_seq_offset += 1; } } void net_save_xmit( int at) { if (host[at].saved[SAVED_PINGS - 1] != -2) net_save_increment(); host[at].saved[SAVED_PINGS - 1] = -1; } void net_save_return( int at, int seq, int ms) { int idx; idx = seq - host[at].saved_seq_offset; if ((idx < 0) || (idx >= SAVED_PINGS)) { return; } host[at].saved[idx] = ms; } /* Similar to inet_ntop but uses a sockaddr as it's argument. */ static void sockaddrtop( struct sockaddr *saddr, char *strptr, size_t len) { struct sockaddr_in *sa4; #ifdef ENABLE_IPV6 struct sockaddr_in6 *sa6; #endif switch (saddr->sa_family) { case AF_INET: sa4 = (struct sockaddr_in *) saddr; xstrncpy(strptr, inet_ntoa(sa4->sin_addr), len - 1); strptr[len - 1] = '\0'; return; #ifdef ENABLE_IPV6 case AF_INET6: sa6 = (struct sockaddr_in6 *) saddr; inet_ntop(sa6->sin6_family, &(sa6->sin6_addr), strptr, len); return; #endif default: error(0, 0, "sockaddrtop unknown address type"); strptr[0] = '\0'; return; } } /* Address comparison. */ int addrcmp( char *a, char *b, int family) { int rc = -1; switch (family) { case AF_INET: rc = memcmp(a, b, sizeof(struct in_addr)); break; #ifdef ENABLE_IPV6 case AF_INET6: rc = memcmp(a, b, sizeof(struct in6_addr)); break; #endif } return rc; } /* Address copy. */ void addrcpy( char *a, char *b, int family) { switch (family) { case AF_INET: memcpy(a, b, sizeof(struct in_addr)); break; #ifdef ENABLE_IPV6 case AF_INET6: memcpy(a, b, sizeof(struct in6_addr)); break; #endif } } /* for GTK frontend */ void net_harvest_fds( struct mtr_ctl *ctl) { fd_set writefd; int maxfd = 0; struct timeval tv; FD_ZERO(&writefd); tv.tv_sec = 0; tv.tv_usec = 0; select(maxfd, NULL, &writefd, NULL, &tv); } mtr-0.92/ui/mtr.c0000664000175000017500000006157313045551745012674 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" #include #include #include #include #include #include #include #include #ifdef HAVE_ERROR_H #include #else #include "portability/error.h" #endif #ifdef HAVE_VALUES_H #include #endif #ifdef HAVE_SYS_LIMITS_H #include #endif #include #include #include #include #include #include #include #include #include #include "mtr.h" #include "mtr-curses.h" #include "display.h" #include "dns.h" #include "report.h" #include "net.h" #include "asn.h" #include "utils.h" #ifdef HAVE_GETOPT #include #else #include "portability/getopt.h" #endif #ifdef ENABLE_IPV6 #define DEFAULT_AF AF_UNSPEC #else #define DEFAULT_AF AF_INET #endif const struct fields data_fields[MAXFLD] = { /* key, Remark, Header, Format, Width, CallBackFunc */ {' ', ": Space between fields", " ", " ", 1, &net_drop}, {'L', "L: Loss Ratio", "Loss%", " %4.1f%%", 6, &net_loss}, {'D', "D: Dropped Packets", "Drop", " %4d", 5, &net_drop}, {'R', "R: Received Packets", "Rcv", " %5d", 6, &net_returned}, {'S', "S: Sent Packets", "Snt", " %5d", 6, &net_xmit}, {'N', "N: Newest RTT(ms)", "Last", " %5.1f", 6, &net_last}, {'B', "B: Min/Best RTT(ms)", "Best", " %5.1f", 6, &net_best}, {'A', "A: Average RTT(ms)", "Avg", " %5.1f", 6, &net_avg}, {'W', "W: Max/Worst RTT(ms)", "Wrst", " %5.1f", 6, &net_worst}, {'V', "V: Standard Deviation", "StDev", " %5.1f", 6, &net_stdev}, {'G', "G: Geometric Mean", "Gmean", " %5.1f", 6, &net_gmean}, {'J', "J: Current Jitter", "Jttr", " %4.1f", 5, &net_jitter}, {'M', "M: Jitter Mean/Avg.", "Javg", " %4.1f", 5, &net_javg}, {'X', "X: Worst Jitter", "Jmax", " %4.1f", 5, &net_jworst}, {'I', "I: Interarrival Jitter", "Jint", " %4.1f", 5, &net_jinta}, {'\0', NULL, NULL, NULL, 0, NULL} }; typedef struct names { char *name; struct names *next; } names_t; static void __attribute__ ((__noreturn__)) usage(FILE * out) { fputs("\nUsage:\n", out); fputs(" mtr [options] hostname\n", out); fputs("\n", out); fputs(" -F, --filename FILE read hostname(s) from a file\n", out); fputs(" -4 use IPv4 only\n", out); #ifdef ENABLE_IPV6 fputs(" -6 use IPv6 only\n", out); #endif fputs(" -u, --udp use UDP instead of ICMP echo\n", out); fputs(" -T, --tcp use TCP instead of ICMP echo\n", out); fputs (" -a, --address ADDRESS bind the outgoing socket to ADDRESS\n", out); fputs(" -f, --first-ttl NUMBER set what TTL to start\n", out); fputs(" -m, --max-ttl NUMBER maximum number of hops\n", out); fputs(" -U, --max-unknown NUMBER maximum unknown host\n", out); fputs (" -P, --port PORT target port number for TCP, SCTP, or UDP\n", out); fputs(" -L, --localport LOCALPORT source port number for UDP\n", out); fputs (" -s, --psize PACKETSIZE set the packet size used for probing\n", out); fputs (" -B, --bitpattern NUMBER set bit pattern to use in payload\n", out); fputs(" -i, --interval SECONDS ICMP echo request interval\n", out); fputs (" -G, --gracetime SECONDS number of seconds to wait for responses\n", out); fputs (" -Q, --tos NUMBER type of service field in IP header\n", out); fputs (" -e, --mpls display information from ICMP extensions\n", out); fputs (" -Z, --timeout SECONDS seconds to keep probe sockets open\n", out); #ifdef SO_MARK fputs(" -M, --mark MARK mark each sent packet\n", out); #endif fputs(" -r, --report output using report mode\n", out); fputs(" -w, --report-wide output wide report\n", out); fputs(" -c, --report-cycles COUNT set the number of pings sent\n", out); fputs(" -j, --json output json\n", out); fputs(" -x, --xml output xml\n", out); fputs(" -C, --csv output comma separated values\n", out); fputs(" -l, --raw output raw format\n", out); fputs(" -p, --split split output\n", out); #ifdef HAVE_CURSES fputs(" -t, --curses use curses terminal interface\n", out); #endif fputs(" --displaymode MODE select initial display mode\n", out); #ifdef HAVE_GTK fputs(" -g, --gtk use GTK+ xwindow interface\n", out); #endif fputs(" -n, --no-dns do not resove host names\n", out); fputs(" -b, --show-ips show IP numbers and host names\n", out); fputs(" -o, --order FIELDS select output fields\n", out); #ifdef HAVE_IPINFO fputs(" -y, --ipinfo NUMBER select IP information in output\n", out); fputs(" -z, --aslookup display AS number\n", out); #endif fputs(" -h, --help display this help and exit\n", out); fputs (" -v, --version output version information and exit\n", out); fputs("\n", out); fputs("See the 'man 8 mtr' for details.\n", out); exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); } static void append_to_names( names_t ** names_head, const char *item) { names_t **name_tail = names_head; while (*name_tail) { name_tail = &(*name_tail)->next; } names_t *name = calloc(1, sizeof(names_t)); if (name == NULL) { error(EXIT_FAILURE, errno, "memory allocation failure"); } name->name = xstrdup(item); name->next = NULL; *name_tail = name; } static void read_from_file( names_t ** names, const char *filename) { FILE *in; char line[512]; if (!filename || strcmp(filename, "-") == 0) { clearerr(stdin); in = stdin; } else { in = fopen(filename, "r"); if (!in) { error(EXIT_FAILURE, errno, "open %s", filename); } } while (fgets(line, sizeof(line), in)) { char *name = trim(line, '\0'); append_to_names(names, name); } if (ferror(in)) { error(EXIT_FAILURE, errno, "ferror %s", filename); } if (in != stdin) fclose(in); } /* * If the file stream is associated with a regular file, lock the file * in order coordinate writes to a common file from multiple mtr * instances. This is useful if, for example, multiple mtr instances * try to append results to a common file. */ static void lock( FILE * f) { int fd; struct stat buf; static struct flock lock; assert(f); lock.l_type = F_WRLCK; lock.l_start = 0; lock.l_whence = SEEK_END; lock.l_len = 0; lock.l_pid = getpid(); fd = fileno(f); if ((fstat(fd, &buf) == 0) && S_ISREG(buf.st_mode)) { if (fcntl(fd, F_SETLKW, &lock) == -1) { error(0, errno, "fcntl (ignored)"); } } } /* * If the file stream is associated with a regular file, unlock the * file (which presumably has previously been locked). */ static void unlock( FILE * f) { int fd; struct stat buf; static struct flock lock; assert(f); lock.l_type = F_UNLCK; lock.l_start = 0; lock.l_whence = SEEK_END; lock.l_len = 0; lock.l_pid = getpid(); fd = fileno(f); if ((fstat(fd, &buf) == 0) && S_ISREG(buf.st_mode)) { if (fcntl(fd, F_SETLKW, &lock) == -1) { error(0, errno, "fcntl (ignored)"); } } } static void init_fld_options( struct mtr_ctl *ctl) { int i; memset(ctl->fld_index, -1, FLD_INDEX_SZ); for (i = 0; data_fields[i].key != 0; i++) { ctl->available_options[i] = data_fields[i].key; ctl->fld_index[data_fields[i].key] = i; } ctl->available_options[i] = 0; } static void parse_arg( struct mtr_ctl *ctl, names_t ** names, int argc, char **argv) { int opt; int i; /* IMPORTANT: when adding or modifying an option: 0/ try to find a somewhat logical order; 1/ add the long option name in "long_options" below; 2/ update the man page (use the same order); 3/ update the help message (see usage() function). */ enum { OPT_DISPLAYMODE = CHAR_MAX + 1 }; static const struct option long_options[] = { /* option name, has argument, NULL, short name */ {"help", 0, NULL, 'h'}, {"version", 0, NULL, 'v'}, {"inet", 0, NULL, '4'}, /* IPv4 only */ #ifdef ENABLE_IPV6 {"inet6", 0, NULL, '6'}, /* IPv6 only */ #endif {"filename", 1, NULL, 'F'}, {"report", 0, NULL, 'r'}, {"report-wide", 0, NULL, 'w'}, {"xml", 0, NULL, 'x'}, #ifdef HAVE_CURSES {"curses", 0, NULL, 't'}, #endif #ifdef HAVE_GTK {"gtk", 0, NULL, 'g'}, #endif {"raw", 0, NULL, 'l'}, {"csv", 0, NULL, 'C'}, {"json", 0, NULL, 'j'}, {"displaymode", 1, NULL, OPT_DISPLAYMODE}, {"split", 0, NULL, 'p'}, /* BL */ /* maybe above should change to -d 'x' */ {"no-dns", 0, NULL, 'n'}, {"show-ips", 0, NULL, 'b'}, {"order", 1, NULL, 'o'}, /* fields to display & their order */ #ifdef HAVE_IPINFO {"ipinfo", 1, NULL, 'y'}, /* IP info lookup */ {"aslookup", 0, NULL, 'z'}, /* Do AS lookup (--ipinfo 0) */ #endif {"interval", 1, NULL, 'i'}, {"report-cycles", 1, NULL, 'c'}, {"psize", 1, NULL, 's'}, /* overload psize<0, ->rand(min,max) */ {"bitpattern", 1, NULL, 'B'}, /* overload B>255, ->rand(0,255) */ {"tos", 1, NULL, 'Q'}, /* typeof service (0,255) */ {"mpls", 0, NULL, 'e'}, {"address", 1, NULL, 'a'}, {"first-ttl", 1, NULL, 'f'}, /* -f & -m are borrowed from traceroute */ {"max-ttl", 1, NULL, 'm'}, {"max-unknown", 1, NULL, 'U'}, {"udp", 0, NULL, 'u'}, /* UDP (default is ICMP) */ {"tcp", 0, NULL, 'T'}, /* TCP (default is ICMP) */ #ifdef HAS_SCTP {"sctp", 0, NULL, 'S'}, /* SCTP (default is ICMP) */ #endif {"port", 1, NULL, 'P'}, /* target port number for TCP/SCTP/UDP */ {"localport", 1, NULL, 'L'}, /* source port number for UDP */ {"timeout", 1, NULL, 'Z'}, /* timeout for probe sockets */ {"gracetime", 1, NULL, 'G'}, /* gracetime for replies after last probe */ #ifdef SO_MARK {"mark", 1, NULL, 'M'}, /* use SO_MARK */ #endif {NULL, 0, NULL, 0} }; enum { num_options = sizeof(long_options) / sizeof(struct option) }; char short_options[num_options * 2]; size_t n, p; for (n = p = 0; n < num_options; n++) { if (CHAR_MAX < long_options[n].val) { continue; } short_options[p] = long_options[n].val; p++; if (long_options[n].has_arg == 1) { short_options[p] = ':'; p++; } /* optional options need two ':', but ignore them now as they are not in use */ } opt = 0; while (1) { opt = getopt_long(argc, argv, short_options, long_options, NULL); if (opt == -1) break; switch (opt) { case 'v': printf("mtr " PACKAGE_VERSION "\n"); exit(EXIT_SUCCESS); break; case 'h': usage(stdout); break; case 'r': ctl->DisplayMode = DisplayReport; break; case 'w': ctl->reportwide = 1; ctl->DisplayMode = DisplayReport; break; #ifdef HAVE_CURSES case 't': ctl->DisplayMode = DisplayCurses; break; #endif #ifdef HAVE_GTK case 'g': ctl->DisplayMode = DisplayGTK; break; #endif case 'p': /* BL */ ctl->DisplayMode = DisplaySplit; break; case 'l': ctl->DisplayMode = DisplayRaw; break; case 'C': ctl->DisplayMode = DisplayCSV; break; case 'j': ctl->DisplayMode = DisplayJSON; break; case 'x': ctl->DisplayMode = DisplayXML; break; case OPT_DISPLAYMODE: ctl->display_mode = strtonum_or_err(optarg, "invalid argument", STRTO_INT); if ((DisplayModeMAX - 1) < ctl->display_mode) error(EXIT_FAILURE, 0, "value out of range (%d - %d): %s", DisplayModeDefault, (DisplayModeMAX - 1), optarg); break; case 'c': ctl->MaxPing = strtonum_or_err(optarg, "invalid argument", STRTO_INT); ctl->ForceMaxPing = 1; break; case 's': ctl->cpacketsize = strtonum_or_err(optarg, "invalid argument", STRTO_INT); break; case 'a': ctl->InterfaceAddress = optarg; break; case 'e': ctl->enablempls = 1; break; case 'n': ctl->dns = 0; break; case 'i': ctl->WaitTime = strtofloat_or_err(optarg, "invalid argument"); if (ctl->WaitTime <= 0.0) { error(EXIT_FAILURE, 0, "wait time must be positive"); } if (getuid() != 0 && ctl->WaitTime < 1.0) { error(EXIT_FAILURE, 0, "non-root users cannot request an interval < 1.0 seconds"); } break; case 'f': ctl->fstTTL = strtonum_or_err(optarg, "invalid argument", STRTO_INT); if (ctl->fstTTL > ctl->maxTTL) { ctl->fstTTL = ctl->maxTTL; } if (ctl->fstTTL < 1) { /* prevent 0 hop */ ctl->fstTTL = 1; } break; case 'F': read_from_file(names, optarg); break; case 'm': ctl->maxTTL = strtonum_or_err(optarg, "invalid argument", STRTO_INT); if (ctl->maxTTL > (MaxHost - 1)) { ctl->maxTTL = MaxHost - 1; } if (ctl->maxTTL < 1) { /* prevent 0 hop */ ctl->maxTTL = 1; } if (ctl->fstTTL > ctl->maxTTL) { /* don't know the pos of -m or -f */ ctl->fstTTL = ctl->maxTTL; } break; case 'U': ctl->maxUnknown = strtonum_or_err(optarg, "invalid argument", STRTO_INT); if (ctl->maxUnknown < 1) { ctl->maxUnknown = 1; } break; case 'o': /* Check option before passing it on to fld_active. */ if (strlen(optarg) > MAXFLD) { error(EXIT_FAILURE, 0, "Too many fields: %s", optarg); } for (i = 0; optarg[i]; i++) { if (!strchr(ctl->available_options, optarg[i])) { error(EXIT_FAILURE, 0, "Unknown field identifier: %c", optarg[i]); } } xstrncpy(ctl->fld_active, optarg, 2 * MAXFLD); break; case 'B': ctl->bitpattern = strtonum_or_err(optarg, "invalid argument", STRTO_INT); if (ctl->bitpattern > 255) ctl->bitpattern = -1; break; case 'G': ctl->GraceTime = strtofloat_or_err(optarg, "invalid argument"); if (ctl->GraceTime <= 0.0) { error(EXIT_FAILURE, 0, "wait time must be positive"); } break; case 'Q': ctl->tos = strtonum_or_err(optarg, "invalid argument", STRTO_INT); if (ctl->tos > 255 || ctl->tos < 0) { /* error message, should do more checking for valid values, * details in rfc2474 */ ctl->tos = 0; } break; case 'u': if (ctl->mtrtype != IPPROTO_ICMP) { error(EXIT_FAILURE, 0, "-u , -T and -S are mutually exclusive"); } ctl->mtrtype = IPPROTO_UDP; break; case 'T': if (ctl->mtrtype != IPPROTO_ICMP) { error(EXIT_FAILURE, 0, "-u , -T and -S are mutually exclusive"); } if (!ctl->remoteport) { ctl->remoteport = 80; } ctl->mtrtype = IPPROTO_TCP; break; #ifdef HAS_SCTP case 'S': if (ctl->mtrtype != IPPROTO_ICMP) { error(EXIT_FAILURE, 0, "-u , -T and -S are mutually exclusive"); } if (!ctl->remoteport) { ctl->remoteport = 80; } ctl->mtrtype = IPPROTO_SCTP; break; #endif case 'b': ctl->show_ips = 1; break; case 'P': ctl->remoteport = strtonum_or_err(optarg, "invalid argument", STRTO_INT); if (ctl->remoteport < 1 || MaxPort < ctl->remoteport) { error(EXIT_FAILURE, 0, "Illegal port number: %d", ctl->remoteport); } break; case 'L': ctl->localport = strtonum_or_err(optarg, "invalid argument", STRTO_INT); if (ctl->localport < MinPort || MaxPort < ctl->localport) { error(EXIT_FAILURE, 0, "Illegal port number: %d", ctl->localport); } break; case 'Z': ctl->probe_timeout = strtonum_or_err(optarg, "invalid argument", STRTO_INT); ctl->probe_timeout *= 1000000; break; case '4': ctl->af = AF_INET; break; #ifdef ENABLE_IPV6 case '6': ctl->af = AF_INET6; break; #endif #ifdef HAVE_IPINFO case 'y': ctl->ipinfo_no = strtonum_or_err(optarg, "invalid argument", STRTO_INT); if (ctl->ipinfo_no < 0 || 4 < ctl->ipinfo_no) { error(EXIT_FAILURE, 0, "value %d out of range (0 - 4)", ctl->ipinfo_no); } break; case 'z': ctl->ipinfo_no = 0; break; #endif #ifdef SO_MARK case 'M': ctl->mark = strtonum_or_err(optarg, "invalid argument", STRTO_U32INT); break; #endif default: usage(stderr); } } if (ctl->DisplayMode == DisplayReport || ctl->DisplayMode == DisplayTXT || ctl->DisplayMode == DisplayJSON || ctl->DisplayMode == DisplayXML || ctl->DisplayMode == DisplayRaw || ctl->DisplayMode == DisplayCSV) ctl->Interactive = 0; if (optind > argc - 1) return; } static void parse_mtr_options( struct mtr_ctl *ctl, names_t ** names, char *string) { int argc = 1; char *argv[128], *p; if (!string) return; argv[0] = xstrdup(PACKAGE_NAME); argc = 1; p = strtok(string, " \t"); while (p != NULL && ((size_t) argc < (sizeof(argv) / sizeof(argv[0])))) { argv[argc++] = p; p = strtok(NULL, " \t"); } if (p != NULL) { error(0, 0, "Warning: extra arguments ignored: %s", p); } parse_arg(ctl, names, argc, argv); free(argv[0]); optind = 0; } static void init_rand( void) { struct timeval tv; gettimeofday(&tv, NULL); srand((getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec); } int main( int argc, char **argv) { struct hostent *host = NULL; struct addrinfo hints, *res; int gai_error; struct hostent trhost; char *alptr[2]; struct sockaddr_in *sa4; #ifdef ENABLE_IPV6 struct sockaddr_in6 *sa6; #endif names_t *names_head = NULL; names_t *names_walk; struct mtr_ctl ctl; memset(&ctl, 0, sizeof(ctl)); /* initialize non-null values */ ctl.Interactive = 1; ctl.MaxPing = 10; ctl.WaitTime = 1.0; ctl.GraceTime = 5.0; ctl.dns = 1; ctl.use_dns = 1; ctl.cpacketsize = 64; ctl.af = DEFAULT_AF; ctl.mtrtype = IPPROTO_ICMP; ctl.fstTTL = 1; ctl.maxTTL = 30; ctl.maxUnknown = 12; ctl.probe_timeout = 10 * 1000000; ctl.ipinfo_no = -1; ctl.ipinfo_max = -1; xstrncpy(ctl.fld_active, "LS NABWV", 2 * MAXFLD); /* mtr used to be suid root. It should not be with this version. We'll check so that we can notify people using installation mechanisms with obsolete assumptions. */ if ((geteuid() != getuid()) || (getegid() != getgid())) { error(EXIT_FAILURE, errno, "mtr should not run suid"); } /* This will check if stdout/stderr writing is successful */ atexit(close_stdout); /* reset the random seed */ init_rand(); display_detect(&ctl, &argc, &argv); ctl.display_mode = DisplayModeDefault; /* The field options are now in a static array all together, but that requires a run-time initialization. */ init_fld_options(&ctl); parse_mtr_options(&ctl, &names_head, getenv("MTR_OPTIONS")); parse_arg(&ctl, &names_head, argc, argv); while (optind < argc) { char *name = argv[optind++]; append_to_names(&names_head, name); } /* default: localhost. */ if (!names_head) append_to_names(&names_head, "localhost"); names_walk = names_head; while (names_walk != NULL) { ctl.Hostname = names_walk->name; if (gethostname(ctl.LocalHostname, sizeof(ctl.LocalHostname))) { xstrncpy(ctl.LocalHostname, "UNKNOWNHOST", sizeof(ctl.LocalHostname)); } /* gethostbyname2() is deprecated so we'll use getaddrinfo() instead. */ memset(&hints, 0, sizeof hints); hints.ai_family = ctl.af; hints.ai_socktype = SOCK_DGRAM; gai_error = getaddrinfo(ctl.Hostname, NULL, &hints, &res); if (gai_error) { if (gai_error == EAI_SYSTEM) error(0, 0, "Failed to resolve host: %s", ctl.Hostname); else error(0, 0, "Failed to resolve host: %s: %s", ctl.Hostname, gai_strerror(gai_error)); if (ctl.Interactive) exit(EXIT_FAILURE); else { names_walk = names_walk->next; continue; } } /* Convert the first addrinfo into a hostent. */ host = &trhost; memset(host, 0, sizeof trhost); host->h_name = res->ai_canonname; host->h_aliases = NULL; host->h_addrtype = res->ai_family; ctl.af = res->ai_family; host->h_length = res->ai_addrlen; host->h_addr_list = alptr; switch (ctl.af) { case AF_INET: sa4 = (struct sockaddr_in *) res->ai_addr; alptr[0] = (void *) &(sa4->sin_addr); break; #ifdef ENABLE_IPV6 case AF_INET6: sa6 = (struct sockaddr_in6 *) res->ai_addr; alptr[0] = (void *) &(sa6->sin6_addr); break; #endif default: error(0, 0, "unknown address type"); if (ctl.Interactive) exit(EXIT_FAILURE); else { names_walk = names_walk->next; continue; } } alptr[1] = NULL; if (net_open(&ctl, host) != 0) { error(0, 0, "Unable to start net module"); if (ctl.Interactive) exit(EXIT_FAILURE); else { names_walk = names_walk->next; continue; } } lock(stdout); dns_open(&ctl); display_open(&ctl); display_loop(&ctl); net_end_transit(); display_close(&ctl); unlock(stdout); if (ctl.Interactive) break; else names_walk = names_walk->next; } net_close(); while (names_head != NULL) { names_t *item = names_head; free(item->name); item->name = NULL; names_head = item->next; free(item); item = NULL; } return 0; } mtr-0.92/ui/asn.h0000664000175000017500000000206513045551745012647 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "mtr.h" extern void asn_open( struct mtr_ctl *ctl); extern void asn_close( struct mtr_ctl *ctl); extern char *fmt_ipinfo( struct mtr_ctl *ctl, ip_t * addr); extern ATTRIBUTE_CONST size_t get_iiwidth_len( void); extern ATTRIBUTE_CONST int get_iiwidth( int ipinfo_no); extern int is_printii( struct mtr_ctl *ctl); mtr-0.92/install-sh0000755000175000017500000003325512441555431013302 0ustar wolffwolff#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-11-20.07; # 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. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # 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_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' 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 no_target_directory= 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 *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done 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 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 -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob 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` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob 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: mtr-0.92/missing0000755000175000017500000001533012441555431012667 0ustar wolffwolff#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2013 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: mtr-0.92/Makefile.in0000664000175000017500000025126313114223644013342 0ustar wolffwolff# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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@ sbin_PROGRAMS = mtr$(EXEEXT) mtr-packet$(EXEEXT) @WITH_ERROR_TRUE@am__append_1 = \ @WITH_ERROR_TRUE@ portability/error.h \ @WITH_ERROR_TRUE@ portability/error.c @WITH_GETOPT_TRUE@am__append_2 = \ @WITH_GETOPT_TRUE@ portability/getopt.h \ @WITH_GETOPT_TRUE@ portability/getopt.c \ @WITH_GETOPT_TRUE@ portability/getopt1.c @WITH_IPINFO_TRUE@am__append_3 = ui/asn.c ui/asn.h @WITH_CURSES_TRUE@am__append_4 = ui/curses.c @WITH_GTK_TRUE@am__append_5 = ui/gtk.c @CYGWIN_TRUE@am__append_6 = \ @CYGWIN_TRUE@ packet/command_cygwin.c packet/command_cygwin.h \ @CYGWIN_TRUE@ packet/probe_cygwin.c packet/probe_cygwin.h \ @CYGWIN_TRUE@ packet/wait_cygwin.c @CYGWIN_TRUE@am__append_7 = -lcygwin -liphlpapi -lws2_32 @CYGWIN_FALSE@check_PROGRAMS = mtr-packet-listen$(EXEEXT) @CYGWIN_FALSE@am__append_8 = \ @CYGWIN_FALSE@ packet/command_unix.c packet/command_unix.h \ @CYGWIN_FALSE@ packet/construct_unix.c packet/construct_unix.h \ @CYGWIN_FALSE@ packet/deconstruct_unix.c packet/deconstruct_unix.h \ @CYGWIN_FALSE@ packet/probe_unix.c packet/probe_unix.h \ @CYGWIN_FALSE@ packet/wait_unix.c subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(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_bashcompletion_DATA_DIST) \ $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" \ "$(DESTDIR)$(bashcompletiondir)" PROGRAMS = $(sbin_PROGRAMS) am__mtr_SOURCES_DIST = ui/mtr.c ui/mtr.h ui/net.c ui/net.h \ ui/cmdpipe.c ui/cmdpipe.h ui/dns.c ui/dns.h ui/raw.c ui/raw.h \ ui/split.c ui/split.h ui/display.c ui/display.h ui/report.c \ ui/report.h ui/select.c ui/select.h ui/utils.c ui/utils.h \ packet/cmdparse.c packet/cmdparse.h ui/mtr-curses.h \ img/mtr_icon.xpm ui/mtr-gtk.h portability/error.h \ portability/error.c portability/getopt.h portability/getopt.c \ portability/getopt1.c ui/asn.c ui/asn.h ui/curses.c ui/gtk.c am__dirstamp = $(am__leading_dot)dirstamp @WITH_ERROR_TRUE@am__objects_1 = portability/mtr-error.$(OBJEXT) @WITH_GETOPT_TRUE@am__objects_2 = portability/mtr-getopt.$(OBJEXT) \ @WITH_GETOPT_TRUE@ portability/mtr-getopt1.$(OBJEXT) @WITH_IPINFO_TRUE@am__objects_3 = ui/mtr-asn.$(OBJEXT) @WITH_CURSES_TRUE@am__objects_4 = ui/mtr-curses.$(OBJEXT) @WITH_GTK_TRUE@am__objects_5 = ui/mtr-gtk.$(OBJEXT) am_mtr_OBJECTS = ui/mtr-mtr.$(OBJEXT) ui/mtr-net.$(OBJEXT) \ ui/mtr-cmdpipe.$(OBJEXT) ui/mtr-dns.$(OBJEXT) \ ui/mtr-raw.$(OBJEXT) ui/mtr-split.$(OBJEXT) \ ui/mtr-display.$(OBJEXT) ui/mtr-report.$(OBJEXT) \ ui/mtr-select.$(OBJEXT) ui/mtr-utils.$(OBJEXT) \ packet/mtr-cmdparse.$(OBJEXT) $(am__objects_1) \ $(am__objects_2) $(am__objects_3) $(am__objects_4) \ $(am__objects_5) mtr_OBJECTS = $(am_mtr_OBJECTS) am__DEPENDENCIES_1 = mtr_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) mtr_LINK = $(CCLD) $(mtr_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \ $@ am__mtr_packet_SOURCES_DIST = portability/queue.h packet/packet.c \ packet/cmdparse.c packet/cmdparse.h packet/command.c \ packet/command.h packet/platform.h packet/probe.c \ packet/probe.h packet/protocols.h packet/timeval.c \ packet/timeval.h packet/wait.h packet/command_cygwin.c \ packet/command_cygwin.h packet/probe_cygwin.c \ packet/probe_cygwin.h packet/wait_cygwin.c \ packet/command_unix.c packet/command_unix.h \ packet/construct_unix.c packet/construct_unix.h \ packet/deconstruct_unix.c packet/deconstruct_unix.h \ packet/probe_unix.c packet/probe_unix.h packet/wait_unix.c @CYGWIN_TRUE@am__objects_6 = packet/command_cygwin.$(OBJEXT) \ @CYGWIN_TRUE@ packet/probe_cygwin.$(OBJEXT) \ @CYGWIN_TRUE@ packet/wait_cygwin.$(OBJEXT) @CYGWIN_FALSE@am__objects_7 = packet/command_unix.$(OBJEXT) \ @CYGWIN_FALSE@ packet/construct_unix.$(OBJEXT) \ @CYGWIN_FALSE@ packet/deconstruct_unix.$(OBJEXT) \ @CYGWIN_FALSE@ packet/probe_unix.$(OBJEXT) \ @CYGWIN_FALSE@ packet/wait_unix.$(OBJEXT) am_mtr_packet_OBJECTS = packet/packet.$(OBJEXT) \ packet/cmdparse.$(OBJEXT) packet/command.$(OBJEXT) \ packet/probe.$(OBJEXT) packet/timeval.$(OBJEXT) \ $(am__objects_6) $(am__objects_7) mtr_packet_OBJECTS = $(am_mtr_packet_OBJECTS) mtr_packet_DEPENDENCIES = $(am__DEPENDENCIES_1) am__mtr_packet_listen_SOURCES_DIST = test/packet_listen.c @CYGWIN_FALSE@am_mtr_packet_listen_OBJECTS = \ @CYGWIN_FALSE@ test/packet_listen.$(OBJEXT) mtr_packet_listen_OBJECTS = $(am_mtr_packet_listen_OBJECTS) mtr_packet_listen_LDADD = $(LDADD) 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@ depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles am__mv = mv -f 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 = 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 = $(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 = $(mtr_SOURCES) $(mtr_packet_SOURCES) \ $(mtr_packet_listen_SOURCES) DIST_SOURCES = $(am__mtr_SOURCES_DIST) $(am__mtr_packet_SOURCES_DIST) \ $(am__mtr_packet_listen_SOURCES_DIST) 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; }; \ } man8dir = $(mandir)/man8 NROFF = nroff MANS = $(dist_man_MANS) am__dist_bashcompletion_DATA_DIST = bash-completion/mtr DATA = $(dist_bashcompletion_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)config.h.in # 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_RECURSIVE_TARGETS = cscope check recheck am__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` RECHECK_LOGS = $(TEST_LOGS) TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \ $(srcdir)/config.h.in $(top_srcdir)/build-aux/compile \ $(top_srcdir)/build-aux/config.guess \ $(top_srcdir)/build-aux/config.sub \ $(top_srcdir)/build-aux/depcomp \ $(top_srcdir)/build-aux/install-sh \ $(top_srcdir)/build-aux/missing \ $(top_srcdir)/build-aux/mkinstalldirs \ $(top_srcdir)/build-aux/test-driver AUTHORS COPYING NEWS \ README TODO build-aux/compile build-aux/config.guess \ build-aux/config.sub build-aux/depcomp build-aux/install-sh \ build-aux/missing build-aux/mkinstalldirs compile depcomp \ install-sh 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) 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@ 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@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RESOLV_LIBS = @RESOLV_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bashcompletiondir = @bashcompletiondir@ 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@ 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@ EXTRA_DIST = BSDCOPYING SECURITY build-aux/mtr.bat img/mtr_icon.xpm \ $(TEST_FILES) $(PATHFILES:=.in) TESTS = \ test/cmdparse.py \ test/param.py \ test/probe.py TEST_FILES = \ test/cmdparse.py \ test/mtrpacket.py \ test/param.py \ test/probe.py \ test/lint.sh PATHFILES = man/mtr.8 man/mtr-packet.8 CLEANFILES = $(PATHFILES) dist_man_MANS = mtr.8 mtr-packet.8 mtr_SOURCES = ui/mtr.c ui/mtr.h ui/net.c ui/net.h ui/cmdpipe.c \ ui/cmdpipe.h ui/dns.c ui/dns.h ui/raw.c ui/raw.h ui/split.c \ ui/split.h ui/display.c ui/display.h ui/report.c ui/report.h \ ui/select.c ui/select.h ui/utils.c ui/utils.h \ packet/cmdparse.c packet/cmdparse.h ui/mtr-curses.h \ img/mtr_icon.xpm ui/mtr-gtk.h $(am__append_1) $(am__append_2) \ $(am__append_3) $(am__append_4) $(am__append_5) mtr_INCLUDES = $(GLIB_CFLAGS) -I$(top_builddir) -I$(top_srcdir) mtr_CFLAGS = $(GTK_CFLAGS) $(NCURSES_CFLAGS) mtr_LDADD = $(GTK_LIBS) $(NCURSES_LIBS) $(RESOLV_LIBS) mtr_packet_SOURCES = portability/queue.h packet/packet.c \ packet/cmdparse.c packet/cmdparse.h packet/command.c \ packet/command.h packet/platform.h packet/probe.c \ packet/probe.h packet/protocols.h packet/timeval.c \ packet/timeval.h packet/wait.h $(am__append_6) $(am__append_8) mtr_packet_LDADD = $(CAP_LIBS) $(am__append_7) @CYGWIN_TRUE@dist_windows_aux = \ @CYGWIN_TRUE@ $(srcdir)/build-aux/mtr.bat \ @CYGWIN_TRUE@ $(srcdir)/AUTHORS \ @CYGWIN_TRUE@ $(srcdir)/BSDCOPYING \ @CYGWIN_TRUE@ $(srcdir)/COPYING \ @CYGWIN_TRUE@ $(srcdir)/README \ @CYGWIN_TRUE@ $(srcdir)/NEWS @CYGWIN_TRUE@distwindir = $(distdir)-win-$(host_cpu) @CYGWIN_FALSE@mtr_packet_listen_SOURCES = \ @CYGWIN_FALSE@ test/packet_listen.c @BUILD_BASH_COMPLETION_TRUE@dist_bashcompletion_DATA = bash-completion/mtr all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .log .o .obj .test .test$(EXEEXT) .trs 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): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ ; 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) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || 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)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && rm -f $$files clean-sbinPROGRAMS: -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) ui/$(am__dirstamp): @$(MKDIR_P) ui @: > ui/$(am__dirstamp) ui/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) ui/$(DEPDIR) @: > ui/$(DEPDIR)/$(am__dirstamp) ui/mtr-mtr.$(OBJEXT): ui/$(am__dirstamp) ui/$(DEPDIR)/$(am__dirstamp) ui/mtr-net.$(OBJEXT): ui/$(am__dirstamp) ui/$(DEPDIR)/$(am__dirstamp) ui/mtr-cmdpipe.$(OBJEXT): ui/$(am__dirstamp) \ ui/$(DEPDIR)/$(am__dirstamp) ui/mtr-dns.$(OBJEXT): ui/$(am__dirstamp) ui/$(DEPDIR)/$(am__dirstamp) ui/mtr-raw.$(OBJEXT): ui/$(am__dirstamp) ui/$(DEPDIR)/$(am__dirstamp) ui/mtr-split.$(OBJEXT): ui/$(am__dirstamp) \ ui/$(DEPDIR)/$(am__dirstamp) ui/mtr-display.$(OBJEXT): ui/$(am__dirstamp) \ ui/$(DEPDIR)/$(am__dirstamp) ui/mtr-report.$(OBJEXT): ui/$(am__dirstamp) \ ui/$(DEPDIR)/$(am__dirstamp) ui/mtr-select.$(OBJEXT): ui/$(am__dirstamp) \ ui/$(DEPDIR)/$(am__dirstamp) ui/mtr-utils.$(OBJEXT): ui/$(am__dirstamp) \ ui/$(DEPDIR)/$(am__dirstamp) packet/$(am__dirstamp): @$(MKDIR_P) packet @: > packet/$(am__dirstamp) packet/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) packet/$(DEPDIR) @: > packet/$(DEPDIR)/$(am__dirstamp) packet/mtr-cmdparse.$(OBJEXT): packet/$(am__dirstamp) \ packet/$(DEPDIR)/$(am__dirstamp) portability/$(am__dirstamp): @$(MKDIR_P) portability @: > portability/$(am__dirstamp) portability/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) portability/$(DEPDIR) @: > portability/$(DEPDIR)/$(am__dirstamp) portability/mtr-error.$(OBJEXT): portability/$(am__dirstamp) \ portability/$(DEPDIR)/$(am__dirstamp) portability/mtr-getopt.$(OBJEXT): portability/$(am__dirstamp) \ portability/$(DEPDIR)/$(am__dirstamp) portability/mtr-getopt1.$(OBJEXT): portability/$(am__dirstamp) \ portability/$(DEPDIR)/$(am__dirstamp) ui/mtr-asn.$(OBJEXT): ui/$(am__dirstamp) ui/$(DEPDIR)/$(am__dirstamp) ui/mtr-curses.$(OBJEXT): ui/$(am__dirstamp) \ ui/$(DEPDIR)/$(am__dirstamp) ui/mtr-gtk.$(OBJEXT): ui/$(am__dirstamp) ui/$(DEPDIR)/$(am__dirstamp) mtr$(EXEEXT): $(mtr_OBJECTS) $(mtr_DEPENDENCIES) $(EXTRA_mtr_DEPENDENCIES) @rm -f mtr$(EXEEXT) $(AM_V_CCLD)$(mtr_LINK) $(mtr_OBJECTS) $(mtr_LDADD) $(LIBS) packet/packet.$(OBJEXT): packet/$(am__dirstamp) \ packet/$(DEPDIR)/$(am__dirstamp) packet/cmdparse.$(OBJEXT): packet/$(am__dirstamp) \ packet/$(DEPDIR)/$(am__dirstamp) packet/command.$(OBJEXT): packet/$(am__dirstamp) \ packet/$(DEPDIR)/$(am__dirstamp) packet/probe.$(OBJEXT): packet/$(am__dirstamp) \ packet/$(DEPDIR)/$(am__dirstamp) packet/timeval.$(OBJEXT): packet/$(am__dirstamp) \ packet/$(DEPDIR)/$(am__dirstamp) packet/command_cygwin.$(OBJEXT): packet/$(am__dirstamp) \ packet/$(DEPDIR)/$(am__dirstamp) packet/probe_cygwin.$(OBJEXT): packet/$(am__dirstamp) \ packet/$(DEPDIR)/$(am__dirstamp) packet/wait_cygwin.$(OBJEXT): packet/$(am__dirstamp) \ packet/$(DEPDIR)/$(am__dirstamp) packet/command_unix.$(OBJEXT): packet/$(am__dirstamp) \ packet/$(DEPDIR)/$(am__dirstamp) packet/construct_unix.$(OBJEXT): packet/$(am__dirstamp) \ packet/$(DEPDIR)/$(am__dirstamp) packet/deconstruct_unix.$(OBJEXT): packet/$(am__dirstamp) \ packet/$(DEPDIR)/$(am__dirstamp) packet/probe_unix.$(OBJEXT): packet/$(am__dirstamp) \ packet/$(DEPDIR)/$(am__dirstamp) packet/wait_unix.$(OBJEXT): packet/$(am__dirstamp) \ packet/$(DEPDIR)/$(am__dirstamp) mtr-packet$(EXEEXT): $(mtr_packet_OBJECTS) $(mtr_packet_DEPENDENCIES) $(EXTRA_mtr_packet_DEPENDENCIES) @rm -f mtr-packet$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtr_packet_OBJECTS) $(mtr_packet_LDADD) $(LIBS) test/$(am__dirstamp): @$(MKDIR_P) test @: > test/$(am__dirstamp) test/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) test/$(DEPDIR) @: > test/$(DEPDIR)/$(am__dirstamp) test/packet_listen.$(OBJEXT): test/$(am__dirstamp) \ test/$(DEPDIR)/$(am__dirstamp) mtr-packet-listen$(EXEEXT): $(mtr_packet_listen_OBJECTS) $(mtr_packet_listen_DEPENDENCIES) $(EXTRA_mtr_packet_listen_DEPENDENCIES) @rm -f mtr-packet-listen$(EXEEXT) $(AM_V_CCLD)$(LINK) $(mtr_packet_listen_OBJECTS) $(mtr_packet_listen_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f packet/*.$(OBJEXT) -rm -f portability/*.$(OBJEXT) -rm -f test/*.$(OBJEXT) -rm -f ui/*.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@packet/$(DEPDIR)/cmdparse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@packet/$(DEPDIR)/command.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@packet/$(DEPDIR)/command_cygwin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@packet/$(DEPDIR)/command_unix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@packet/$(DEPDIR)/construct_unix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@packet/$(DEPDIR)/deconstruct_unix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@packet/$(DEPDIR)/mtr-cmdparse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@packet/$(DEPDIR)/packet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@packet/$(DEPDIR)/probe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@packet/$(DEPDIR)/probe_cygwin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@packet/$(DEPDIR)/probe_unix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@packet/$(DEPDIR)/timeval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@packet/$(DEPDIR)/wait_cygwin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@packet/$(DEPDIR)/wait_unix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@portability/$(DEPDIR)/mtr-error.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@portability/$(DEPDIR)/mtr-getopt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@portability/$(DEPDIR)/mtr-getopt1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/packet_listen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ui/$(DEPDIR)/mtr-asn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ui/$(DEPDIR)/mtr-cmdpipe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ui/$(DEPDIR)/mtr-curses.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ui/$(DEPDIR)/mtr-display.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ui/$(DEPDIR)/mtr-dns.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ui/$(DEPDIR)/mtr-gtk.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ui/$(DEPDIR)/mtr-mtr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ui/$(DEPDIR)/mtr-net.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ui/$(DEPDIR)/mtr-raw.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ui/$(DEPDIR)/mtr-report.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ui/$(DEPDIR)/mtr-select.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ui/$(DEPDIR)/mtr-split.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ui/$(DEPDIR)/mtr-utils.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ui/mtr-mtr.o: ui/mtr.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-mtr.o -MD -MP -MF ui/$(DEPDIR)/mtr-mtr.Tpo -c -o ui/mtr-mtr.o `test -f 'ui/mtr.c' || echo '$(srcdir)/'`ui/mtr.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-mtr.Tpo ui/$(DEPDIR)/mtr-mtr.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/mtr.c' object='ui/mtr-mtr.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-mtr.o `test -f 'ui/mtr.c' || echo '$(srcdir)/'`ui/mtr.c ui/mtr-mtr.obj: ui/mtr.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-mtr.obj -MD -MP -MF ui/$(DEPDIR)/mtr-mtr.Tpo -c -o ui/mtr-mtr.obj `if test -f 'ui/mtr.c'; then $(CYGPATH_W) 'ui/mtr.c'; else $(CYGPATH_W) '$(srcdir)/ui/mtr.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-mtr.Tpo ui/$(DEPDIR)/mtr-mtr.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/mtr.c' object='ui/mtr-mtr.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-mtr.obj `if test -f 'ui/mtr.c'; then $(CYGPATH_W) 'ui/mtr.c'; else $(CYGPATH_W) '$(srcdir)/ui/mtr.c'; fi` ui/mtr-net.o: ui/net.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-net.o -MD -MP -MF ui/$(DEPDIR)/mtr-net.Tpo -c -o ui/mtr-net.o `test -f 'ui/net.c' || echo '$(srcdir)/'`ui/net.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-net.Tpo ui/$(DEPDIR)/mtr-net.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/net.c' object='ui/mtr-net.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-net.o `test -f 'ui/net.c' || echo '$(srcdir)/'`ui/net.c ui/mtr-net.obj: ui/net.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-net.obj -MD -MP -MF ui/$(DEPDIR)/mtr-net.Tpo -c -o ui/mtr-net.obj `if test -f 'ui/net.c'; then $(CYGPATH_W) 'ui/net.c'; else $(CYGPATH_W) '$(srcdir)/ui/net.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-net.Tpo ui/$(DEPDIR)/mtr-net.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/net.c' object='ui/mtr-net.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-net.obj `if test -f 'ui/net.c'; then $(CYGPATH_W) 'ui/net.c'; else $(CYGPATH_W) '$(srcdir)/ui/net.c'; fi` ui/mtr-cmdpipe.o: ui/cmdpipe.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-cmdpipe.o -MD -MP -MF ui/$(DEPDIR)/mtr-cmdpipe.Tpo -c -o ui/mtr-cmdpipe.o `test -f 'ui/cmdpipe.c' || echo '$(srcdir)/'`ui/cmdpipe.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-cmdpipe.Tpo ui/$(DEPDIR)/mtr-cmdpipe.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/cmdpipe.c' object='ui/mtr-cmdpipe.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-cmdpipe.o `test -f 'ui/cmdpipe.c' || echo '$(srcdir)/'`ui/cmdpipe.c ui/mtr-cmdpipe.obj: ui/cmdpipe.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-cmdpipe.obj -MD -MP -MF ui/$(DEPDIR)/mtr-cmdpipe.Tpo -c -o ui/mtr-cmdpipe.obj `if test -f 'ui/cmdpipe.c'; then $(CYGPATH_W) 'ui/cmdpipe.c'; else $(CYGPATH_W) '$(srcdir)/ui/cmdpipe.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-cmdpipe.Tpo ui/$(DEPDIR)/mtr-cmdpipe.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/cmdpipe.c' object='ui/mtr-cmdpipe.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-cmdpipe.obj `if test -f 'ui/cmdpipe.c'; then $(CYGPATH_W) 'ui/cmdpipe.c'; else $(CYGPATH_W) '$(srcdir)/ui/cmdpipe.c'; fi` ui/mtr-dns.o: ui/dns.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-dns.o -MD -MP -MF ui/$(DEPDIR)/mtr-dns.Tpo -c -o ui/mtr-dns.o `test -f 'ui/dns.c' || echo '$(srcdir)/'`ui/dns.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-dns.Tpo ui/$(DEPDIR)/mtr-dns.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/dns.c' object='ui/mtr-dns.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-dns.o `test -f 'ui/dns.c' || echo '$(srcdir)/'`ui/dns.c ui/mtr-dns.obj: ui/dns.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-dns.obj -MD -MP -MF ui/$(DEPDIR)/mtr-dns.Tpo -c -o ui/mtr-dns.obj `if test -f 'ui/dns.c'; then $(CYGPATH_W) 'ui/dns.c'; else $(CYGPATH_W) '$(srcdir)/ui/dns.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-dns.Tpo ui/$(DEPDIR)/mtr-dns.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/dns.c' object='ui/mtr-dns.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-dns.obj `if test -f 'ui/dns.c'; then $(CYGPATH_W) 'ui/dns.c'; else $(CYGPATH_W) '$(srcdir)/ui/dns.c'; fi` ui/mtr-raw.o: ui/raw.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-raw.o -MD -MP -MF ui/$(DEPDIR)/mtr-raw.Tpo -c -o ui/mtr-raw.o `test -f 'ui/raw.c' || echo '$(srcdir)/'`ui/raw.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-raw.Tpo ui/$(DEPDIR)/mtr-raw.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/raw.c' object='ui/mtr-raw.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-raw.o `test -f 'ui/raw.c' || echo '$(srcdir)/'`ui/raw.c ui/mtr-raw.obj: ui/raw.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-raw.obj -MD -MP -MF ui/$(DEPDIR)/mtr-raw.Tpo -c -o ui/mtr-raw.obj `if test -f 'ui/raw.c'; then $(CYGPATH_W) 'ui/raw.c'; else $(CYGPATH_W) '$(srcdir)/ui/raw.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-raw.Tpo ui/$(DEPDIR)/mtr-raw.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/raw.c' object='ui/mtr-raw.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-raw.obj `if test -f 'ui/raw.c'; then $(CYGPATH_W) 'ui/raw.c'; else $(CYGPATH_W) '$(srcdir)/ui/raw.c'; fi` ui/mtr-split.o: ui/split.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-split.o -MD -MP -MF ui/$(DEPDIR)/mtr-split.Tpo -c -o ui/mtr-split.o `test -f 'ui/split.c' || echo '$(srcdir)/'`ui/split.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-split.Tpo ui/$(DEPDIR)/mtr-split.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/split.c' object='ui/mtr-split.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-split.o `test -f 'ui/split.c' || echo '$(srcdir)/'`ui/split.c ui/mtr-split.obj: ui/split.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-split.obj -MD -MP -MF ui/$(DEPDIR)/mtr-split.Tpo -c -o ui/mtr-split.obj `if test -f 'ui/split.c'; then $(CYGPATH_W) 'ui/split.c'; else $(CYGPATH_W) '$(srcdir)/ui/split.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-split.Tpo ui/$(DEPDIR)/mtr-split.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/split.c' object='ui/mtr-split.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-split.obj `if test -f 'ui/split.c'; then $(CYGPATH_W) 'ui/split.c'; else $(CYGPATH_W) '$(srcdir)/ui/split.c'; fi` ui/mtr-display.o: ui/display.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-display.o -MD -MP -MF ui/$(DEPDIR)/mtr-display.Tpo -c -o ui/mtr-display.o `test -f 'ui/display.c' || echo '$(srcdir)/'`ui/display.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-display.Tpo ui/$(DEPDIR)/mtr-display.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/display.c' object='ui/mtr-display.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-display.o `test -f 'ui/display.c' || echo '$(srcdir)/'`ui/display.c ui/mtr-display.obj: ui/display.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-display.obj -MD -MP -MF ui/$(DEPDIR)/mtr-display.Tpo -c -o ui/mtr-display.obj `if test -f 'ui/display.c'; then $(CYGPATH_W) 'ui/display.c'; else $(CYGPATH_W) '$(srcdir)/ui/display.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-display.Tpo ui/$(DEPDIR)/mtr-display.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/display.c' object='ui/mtr-display.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-display.obj `if test -f 'ui/display.c'; then $(CYGPATH_W) 'ui/display.c'; else $(CYGPATH_W) '$(srcdir)/ui/display.c'; fi` ui/mtr-report.o: ui/report.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-report.o -MD -MP -MF ui/$(DEPDIR)/mtr-report.Tpo -c -o ui/mtr-report.o `test -f 'ui/report.c' || echo '$(srcdir)/'`ui/report.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-report.Tpo ui/$(DEPDIR)/mtr-report.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/report.c' object='ui/mtr-report.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-report.o `test -f 'ui/report.c' || echo '$(srcdir)/'`ui/report.c ui/mtr-report.obj: ui/report.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-report.obj -MD -MP -MF ui/$(DEPDIR)/mtr-report.Tpo -c -o ui/mtr-report.obj `if test -f 'ui/report.c'; then $(CYGPATH_W) 'ui/report.c'; else $(CYGPATH_W) '$(srcdir)/ui/report.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-report.Tpo ui/$(DEPDIR)/mtr-report.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/report.c' object='ui/mtr-report.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-report.obj `if test -f 'ui/report.c'; then $(CYGPATH_W) 'ui/report.c'; else $(CYGPATH_W) '$(srcdir)/ui/report.c'; fi` ui/mtr-select.o: ui/select.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-select.o -MD -MP -MF ui/$(DEPDIR)/mtr-select.Tpo -c -o ui/mtr-select.o `test -f 'ui/select.c' || echo '$(srcdir)/'`ui/select.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-select.Tpo ui/$(DEPDIR)/mtr-select.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/select.c' object='ui/mtr-select.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-select.o `test -f 'ui/select.c' || echo '$(srcdir)/'`ui/select.c ui/mtr-select.obj: ui/select.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-select.obj -MD -MP -MF ui/$(DEPDIR)/mtr-select.Tpo -c -o ui/mtr-select.obj `if test -f 'ui/select.c'; then $(CYGPATH_W) 'ui/select.c'; else $(CYGPATH_W) '$(srcdir)/ui/select.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-select.Tpo ui/$(DEPDIR)/mtr-select.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/select.c' object='ui/mtr-select.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-select.obj `if test -f 'ui/select.c'; then $(CYGPATH_W) 'ui/select.c'; else $(CYGPATH_W) '$(srcdir)/ui/select.c'; fi` ui/mtr-utils.o: ui/utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-utils.o -MD -MP -MF ui/$(DEPDIR)/mtr-utils.Tpo -c -o ui/mtr-utils.o `test -f 'ui/utils.c' || echo '$(srcdir)/'`ui/utils.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-utils.Tpo ui/$(DEPDIR)/mtr-utils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/utils.c' object='ui/mtr-utils.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-utils.o `test -f 'ui/utils.c' || echo '$(srcdir)/'`ui/utils.c ui/mtr-utils.obj: ui/utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-utils.obj -MD -MP -MF ui/$(DEPDIR)/mtr-utils.Tpo -c -o ui/mtr-utils.obj `if test -f 'ui/utils.c'; then $(CYGPATH_W) 'ui/utils.c'; else $(CYGPATH_W) '$(srcdir)/ui/utils.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-utils.Tpo ui/$(DEPDIR)/mtr-utils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/utils.c' object='ui/mtr-utils.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-utils.obj `if test -f 'ui/utils.c'; then $(CYGPATH_W) 'ui/utils.c'; else $(CYGPATH_W) '$(srcdir)/ui/utils.c'; fi` packet/mtr-cmdparse.o: packet/cmdparse.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT packet/mtr-cmdparse.o -MD -MP -MF packet/$(DEPDIR)/mtr-cmdparse.Tpo -c -o packet/mtr-cmdparse.o `test -f 'packet/cmdparse.c' || echo '$(srcdir)/'`packet/cmdparse.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) packet/$(DEPDIR)/mtr-cmdparse.Tpo packet/$(DEPDIR)/mtr-cmdparse.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='packet/cmdparse.c' object='packet/mtr-cmdparse.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o packet/mtr-cmdparse.o `test -f 'packet/cmdparse.c' || echo '$(srcdir)/'`packet/cmdparse.c packet/mtr-cmdparse.obj: packet/cmdparse.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT packet/mtr-cmdparse.obj -MD -MP -MF packet/$(DEPDIR)/mtr-cmdparse.Tpo -c -o packet/mtr-cmdparse.obj `if test -f 'packet/cmdparse.c'; then $(CYGPATH_W) 'packet/cmdparse.c'; else $(CYGPATH_W) '$(srcdir)/packet/cmdparse.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) packet/$(DEPDIR)/mtr-cmdparse.Tpo packet/$(DEPDIR)/mtr-cmdparse.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='packet/cmdparse.c' object='packet/mtr-cmdparse.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o packet/mtr-cmdparse.obj `if test -f 'packet/cmdparse.c'; then $(CYGPATH_W) 'packet/cmdparse.c'; else $(CYGPATH_W) '$(srcdir)/packet/cmdparse.c'; fi` portability/mtr-error.o: portability/error.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT portability/mtr-error.o -MD -MP -MF portability/$(DEPDIR)/mtr-error.Tpo -c -o portability/mtr-error.o `test -f 'portability/error.c' || echo '$(srcdir)/'`portability/error.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) portability/$(DEPDIR)/mtr-error.Tpo portability/$(DEPDIR)/mtr-error.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='portability/error.c' object='portability/mtr-error.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o portability/mtr-error.o `test -f 'portability/error.c' || echo '$(srcdir)/'`portability/error.c portability/mtr-error.obj: portability/error.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT portability/mtr-error.obj -MD -MP -MF portability/$(DEPDIR)/mtr-error.Tpo -c -o portability/mtr-error.obj `if test -f 'portability/error.c'; then $(CYGPATH_W) 'portability/error.c'; else $(CYGPATH_W) '$(srcdir)/portability/error.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) portability/$(DEPDIR)/mtr-error.Tpo portability/$(DEPDIR)/mtr-error.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='portability/error.c' object='portability/mtr-error.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o portability/mtr-error.obj `if test -f 'portability/error.c'; then $(CYGPATH_W) 'portability/error.c'; else $(CYGPATH_W) '$(srcdir)/portability/error.c'; fi` portability/mtr-getopt.o: portability/getopt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT portability/mtr-getopt.o -MD -MP -MF portability/$(DEPDIR)/mtr-getopt.Tpo -c -o portability/mtr-getopt.o `test -f 'portability/getopt.c' || echo '$(srcdir)/'`portability/getopt.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) portability/$(DEPDIR)/mtr-getopt.Tpo portability/$(DEPDIR)/mtr-getopt.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='portability/getopt.c' object='portability/mtr-getopt.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o portability/mtr-getopt.o `test -f 'portability/getopt.c' || echo '$(srcdir)/'`portability/getopt.c portability/mtr-getopt.obj: portability/getopt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT portability/mtr-getopt.obj -MD -MP -MF portability/$(DEPDIR)/mtr-getopt.Tpo -c -o portability/mtr-getopt.obj `if test -f 'portability/getopt.c'; then $(CYGPATH_W) 'portability/getopt.c'; else $(CYGPATH_W) '$(srcdir)/portability/getopt.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) portability/$(DEPDIR)/mtr-getopt.Tpo portability/$(DEPDIR)/mtr-getopt.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='portability/getopt.c' object='portability/mtr-getopt.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o portability/mtr-getopt.obj `if test -f 'portability/getopt.c'; then $(CYGPATH_W) 'portability/getopt.c'; else $(CYGPATH_W) '$(srcdir)/portability/getopt.c'; fi` portability/mtr-getopt1.o: portability/getopt1.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT portability/mtr-getopt1.o -MD -MP -MF portability/$(DEPDIR)/mtr-getopt1.Tpo -c -o portability/mtr-getopt1.o `test -f 'portability/getopt1.c' || echo '$(srcdir)/'`portability/getopt1.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) portability/$(DEPDIR)/mtr-getopt1.Tpo portability/$(DEPDIR)/mtr-getopt1.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='portability/getopt1.c' object='portability/mtr-getopt1.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o portability/mtr-getopt1.o `test -f 'portability/getopt1.c' || echo '$(srcdir)/'`portability/getopt1.c portability/mtr-getopt1.obj: portability/getopt1.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT portability/mtr-getopt1.obj -MD -MP -MF portability/$(DEPDIR)/mtr-getopt1.Tpo -c -o portability/mtr-getopt1.obj `if test -f 'portability/getopt1.c'; then $(CYGPATH_W) 'portability/getopt1.c'; else $(CYGPATH_W) '$(srcdir)/portability/getopt1.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) portability/$(DEPDIR)/mtr-getopt1.Tpo portability/$(DEPDIR)/mtr-getopt1.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='portability/getopt1.c' object='portability/mtr-getopt1.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o portability/mtr-getopt1.obj `if test -f 'portability/getopt1.c'; then $(CYGPATH_W) 'portability/getopt1.c'; else $(CYGPATH_W) '$(srcdir)/portability/getopt1.c'; fi` ui/mtr-asn.o: ui/asn.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-asn.o -MD -MP -MF ui/$(DEPDIR)/mtr-asn.Tpo -c -o ui/mtr-asn.o `test -f 'ui/asn.c' || echo '$(srcdir)/'`ui/asn.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-asn.Tpo ui/$(DEPDIR)/mtr-asn.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/asn.c' object='ui/mtr-asn.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-asn.o `test -f 'ui/asn.c' || echo '$(srcdir)/'`ui/asn.c ui/mtr-asn.obj: ui/asn.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-asn.obj -MD -MP -MF ui/$(DEPDIR)/mtr-asn.Tpo -c -o ui/mtr-asn.obj `if test -f 'ui/asn.c'; then $(CYGPATH_W) 'ui/asn.c'; else $(CYGPATH_W) '$(srcdir)/ui/asn.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-asn.Tpo ui/$(DEPDIR)/mtr-asn.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/asn.c' object='ui/mtr-asn.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-asn.obj `if test -f 'ui/asn.c'; then $(CYGPATH_W) 'ui/asn.c'; else $(CYGPATH_W) '$(srcdir)/ui/asn.c'; fi` ui/mtr-curses.o: ui/curses.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-curses.o -MD -MP -MF ui/$(DEPDIR)/mtr-curses.Tpo -c -o ui/mtr-curses.o `test -f 'ui/curses.c' || echo '$(srcdir)/'`ui/curses.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-curses.Tpo ui/$(DEPDIR)/mtr-curses.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/curses.c' object='ui/mtr-curses.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-curses.o `test -f 'ui/curses.c' || echo '$(srcdir)/'`ui/curses.c ui/mtr-curses.obj: ui/curses.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-curses.obj -MD -MP -MF ui/$(DEPDIR)/mtr-curses.Tpo -c -o ui/mtr-curses.obj `if test -f 'ui/curses.c'; then $(CYGPATH_W) 'ui/curses.c'; else $(CYGPATH_W) '$(srcdir)/ui/curses.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-curses.Tpo ui/$(DEPDIR)/mtr-curses.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/curses.c' object='ui/mtr-curses.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-curses.obj `if test -f 'ui/curses.c'; then $(CYGPATH_W) 'ui/curses.c'; else $(CYGPATH_W) '$(srcdir)/ui/curses.c'; fi` ui/mtr-gtk.o: ui/gtk.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-gtk.o -MD -MP -MF ui/$(DEPDIR)/mtr-gtk.Tpo -c -o ui/mtr-gtk.o `test -f 'ui/gtk.c' || echo '$(srcdir)/'`ui/gtk.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-gtk.Tpo ui/$(DEPDIR)/mtr-gtk.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/gtk.c' object='ui/mtr-gtk.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-gtk.o `test -f 'ui/gtk.c' || echo '$(srcdir)/'`ui/gtk.c ui/mtr-gtk.obj: ui/gtk.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -MT ui/mtr-gtk.obj -MD -MP -MF ui/$(DEPDIR)/mtr-gtk.Tpo -c -o ui/mtr-gtk.obj `if test -f 'ui/gtk.c'; then $(CYGPATH_W) 'ui/gtk.c'; else $(CYGPATH_W) '$(srcdir)/ui/gtk.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ui/$(DEPDIR)/mtr-gtk.Tpo ui/$(DEPDIR)/mtr-gtk.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ui/gtk.c' object='ui/mtr-gtk.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mtr_CFLAGS) $(CFLAGS) -c -o ui/mtr-gtk.obj `if test -f 'ui/gtk.c'; then $(CYGPATH_W) 'ui/gtk.c'; else $(CYGPATH_W) '$(srcdir)/ui/gtk.c'; fi` install-man8: $(dist_man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(dist_man_MANS)'; \ test -n "$(man8dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man8dir)" || 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 '/\.8[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,^[^8][0-9a-z]*$$,8,;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)$(man8dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$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)$(man8dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ done; } uninstall-man8: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man8dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir) install-dist_bashcompletionDATA: $(dist_bashcompletion_DATA) @$(NORMAL_INSTALL) @list='$(dist_bashcompletion_DATA)'; test -n "$(bashcompletiondir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bashcompletiondir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bashcompletiondir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(bashcompletiondir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(bashcompletiondir)" || exit $$?; \ done uninstall-dist_bashcompletionDATA: @$(NORMAL_UNINSTALL) @list='$(dist_bashcompletion_DATA)'; test -n "$(bashcompletiondir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(bashcompletiondir)'; $(am__uninstall_files_from_dir) 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" 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-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 -rm -f cscope.out cscope.in.out cscope.po.out cscope.files # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? test/cmdparse.py.log: test/cmdparse.py @p='test/cmdparse.py'; \ b='test/cmdparse.py'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test/param.py.log: test/param.py @p='test/param.py'; \ b='test/param.py'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) test/probe.py.log: test/probe.py @p='test/probe.py'; \ b='test/probe.py'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) 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 -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) | GZIP=$(GZIP_ENV) gzip -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) | GZIP=$(GZIP_ENV) gzip -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*) \ GZIP=$(GZIP_ENV) gzip -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*) \ GZIP=$(GZIP_ENV) gzip -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 $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) config.h installdirs: for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(bashcompletiondir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) 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 packet/$(DEPDIR)/$(am__dirstamp) -rm -f packet/$(am__dirstamp) -rm -f portability/$(DEPDIR)/$(am__dirstamp) -rm -f portability/$(am__dirstamp) -rm -f test/$(DEPDIR)/$(am__dirstamp) -rm -f test/$(am__dirstamp) -rm -f ui/$(DEPDIR)/$(am__dirstamp) -rm -f ui/$(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-am clean-am: clean-checkPROGRAMS clean-generic clean-sbinPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf packet/$(DEPDIR) portability/$(DEPDIR) test/$(DEPDIR) ui/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dist_bashcompletionDATA install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-sbinPROGRAMS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man8 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 $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf packet/$(DEPDIR) portability/$(DEPDIR) test/$(DEPDIR) ui/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-dist_bashcompletionDATA uninstall-man \ uninstall-sbinPROGRAMS uninstall-man: uninstall-man8 .MAKE: all check-am install-am install-exec-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-TESTS \ check-am clean clean-checkPROGRAMS clean-cscope clean-generic \ clean-sbinPROGRAMS cscope cscopelist-am ctags ctags-am dist \ dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ dist-xz dist-zip distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-tags distcleancheck \ distdir distuninstallcheck dvi dvi-am html html-am info \ info-am install install-am install-data install-data-am \ install-dist_bashcompletionDATA install-dvi install-dvi-am \ install-exec install-exec-am install-exec-hook install-html \ install-html-am install-info install-info-am install-man \ install-man8 install-pdf install-pdf-am install-ps \ install-ps-am install-sbinPROGRAMS install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am recheck tags tags-am \ uninstall uninstall-am uninstall-dist_bashcompletionDATA \ uninstall-man uninstall-man8 uninstall-sbinPROGRAMS .PRECIOUS: Makefile $(TEST_FILES) # # We would use % pattern matching here, but that is a GNU make # extension and doesn't work on FreeBSD. # mtr-packet.8: $(srcdir)/man/mtr-packet.8.in $(AM_V_GEN) $(srcdir)/build-aux/mangen.sh "$(VERSION)" \ $(srcdir)/man/mtr-packet.8.in $@ mtr.8: $(srcdir)/man/mtr.8.in $(AM_V_GEN) $(srcdir)/build-aux/mangen.sh "$(VERSION)" \ $(srcdir)/man/mtr.8.in $@ $(PATHFILES): Makefile install-exec-hook: `setcap cap_net_raw+ep $(DESTDIR)$(sbindir)/mtr-packet` \ || chmod u+s $(DESTDIR)$(sbindir)/mtr-packet # Bundle necessary files for a Windows binary distribution @CYGWIN_TRUE@distdir-win: $(dist_windows_aux) mtr.exe mtr-packet.exe @CYGWIN_TRUE@ rm -fr $(distwindir) @CYGWIN_TRUE@ mkdir -p $(distwindir) $(distwindir)/bin $(distwindir)/terminfo @CYGWIN_TRUE@ cp $(dist_windows_aux) -t $(distwindir) @CYGWIN_TRUE@ cp mtr.exe mtr-packet.exe -t $(distwindir)/bin @CYGWIN_TRUE@ ldd mtr.exe | grep -v cygdrive | awk '{ print $$3 }' | xargs cp -t $(distwindir)/bin @CYGWIN_TRUE@ cp `find /usr/share/terminfo -name cygwin | xargs dirname` -r $(distwindir)/terminfo # Zip up a Windows binary distribution @CYGWIN_TRUE@dist-windows-bin: distdir-win @CYGWIN_TRUE@ rm -f $(distwindir).zip @CYGWIN_TRUE@ zip -rq $(distwindir).zip $(distwindir) @CYGWIN_TRUE@ rm -fr $(distwindir) # 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: mtr-0.92/mtr.80000664000175000017500000002604113031773102012157 0ustar wolffwolff.TH MTR 8 "0.87.203-0e5e" "mtr" "System Administration" .SH NAME mtr \- a network diagnostic tool .SH SYNOPSIS .B mtr [\c .BR \-4 |\c .B \-6\c ] [\c .BI \-F \ FILENAME\c ] [\c .B \-\-report\c ] [\c .B \-\-report-wide\c ] [\c .B \-\-xml\c ] [\c .B \-\-gtk\c ] [\c .B \-\-curses\c ] [\c .BI \--displaymode \ MODE\c ] [\c .B \-\-raw\c ] [\c .B \-\-csv\c ] [\c .B \-\-json\c ] [\c .B \-\-split\c ] [\c .B \-\-no-dns\c ] [\c .B \-\-show-ips\c ] [\c .BI \-o \ FIELDS\c ] [\c .BI \-y \ IPINFO\c ] [\c .B \-\-aslookup\c ] [\c .BI \-i \ INTERVAL\c ] [\c .BI \-c \ COUNT\c ] [\c .BI \-s \ PACKETSIZE\c ] [\c .BI \-B \ BITPATTERN\c ] [\c .BI \-G \ GRACEPERIOD\c ] [\c .BI \-Q \ TOS\c ] [\c .B \-\-mpls\c ] [\c .BI \-a \ ADDRESS\c ] [\c .BI \-f \ FIRST\-TTL\c ] [\c .BI \-m \ MAX\-TTL\c ] [\c .BI \-U \ MAX\-UNKNOWN\c ] [\c .B \-\-udp\c ] [\c .B \-\-tcp\c ] [\c .BI \-\-sctp\c ] [\c .BI \-P \ PORT\c ] [\c .BI \-L \ LOCALPORT\c ] [\c .BI \-Z \ TIMEOUT\c ] [\c .BI \-M \ MARK\c ] .I HOSTNAME .SH DESCRIPTION .B mtr combines the functionality of the .B traceroute and .B ping programs in a single network diagnostic tool. .PP As .B mtr starts, it investigates the network connection between the host .B mtr runs on and .BR HOSTNAME by sending packets with purposely low TTLs. It continues to send packets with low TTL, noting the response time of the intervening routers. This allows .B mtr to print the response percentage and response times of the internet route to .BR HOSTNAME . A sudden increase in packet loss or response time is often an indication of a bad (or simply overloaded) link. .PP The results are usually reported as round-trip-response times in milliseconds and the percentage of packetloss. .SH OPTIONS .TP .B \-h\fR, \fB\-\-help Print the summary of command line argument options. .TP .B \-v\fR, \fB\-\-version Print the installed version of mtr. .TP .B \-4 Use IPv4 only. .TP .B \-6 Use IPv6 only. (IPV4 may be used for DNS lookups.) .TP .B \-F \fIFILENAME\fR, \fB\-\-filename \fIFILENAME Reads the list of hostnames from the specified file. .TP .B \-r\fR, \fB\-\-report This option puts .B mtr into .B report mode. When in this mode, .B mtr will run for the number of cycles specified by the .B \-c option, and then print statistics and exit. .TP \c This mode is useful for generating statistics about network quality. Note that each running instance of .B mtr generates a significant amount of network traffic. Using .B mtr to measure the quality of your network may result in decreased network performance. .TP .B \-w\fR, \fB\-\-report\-wide This option puts .B mtr into .B wide report mode. When in this mode, .B mtr will not cut hostnames in the report. .TP .B \-x\fR, \fB\-\-xml Use this option to tell .B mtr to use the xml output format. This format is better suited for automated processing of the measurement results. .TP .B \-t\fR, \fB\-\-curses Use this option to force .B mtr to use the curses based terminal interface (if available). In case the list of hops exceeds the height of your terminal, you can use the .B + and .B - keys to scroll up and down half a page. .B Ctrl\fR-\fPL clears spurious error messages that may overwrite other parts of the display. .TP .B -\-displaymode \fIMODE Use this option to select the initial display mode: 0 (default) selects statistics, 1 selects the stripchart without latency information, and 2 selects the stripchart with latency information. .TP .B \-g\fR, \fB\-\-gtk Use this option to force .B mtr to use the GTK+ based X11 window interface (if available). GTK+ must have been available on the system when .B mtr was built for this to work. See the GTK+ web page at .UR http://\:www.\:gtk.\:org/ .UE for more information about GTK+. .TP .B \-l\fR, \fB\-\-raw Use the raw output format. This format is better suited for archival of the measurement results. It could be parsed to be presented into any of the other display methods. .IP Example of the raw output format: .nf h 0 10.1.1.1 p 0 339 h 1 46.149.16.4 p 1 530 h 2 172.31.1.16 p 2 531 h 3 82.221.168.236 p 3 1523 h 5 195.130.211.8 p 5 1603 h 6 193.4.58.17 p 6 1127 h 7 193.4.58.17 d 7 www.isnic.is .fi .TP .B \-C\fR, \fB\-\-csv Use the Comma-Separated-Value (CSV) output format. (Note: The separator is actually a semi-colon ';'.) .IP Example of the CSV output format: .nf MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;1;r-76520-PROD.greenqloud.internal;288 MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;2;46.149.16.4;2086 MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;3;172.31.1.16;600 MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;4;82.221.168.236;1163 MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;5;???;0 MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;6;rix-k2-gw.isnic.is;1654 MTR.0.86+git:16e39fc0;1435562787;OK;nic.is;7;www.isnic.is;1036 .fi .TP .B \-j\fR, \fB\-\-json Use this option to tell .B mtr to use the JSON output format. This format is better suited for automated processing of the measurement results. .TP .B \-p\fR, \fB\-\-split Use this option to set .B mtr to spit out a format that is suitable for a split-user interface. .TP .B \-n\fR, \fB\-\-no\-dns Use this option to force .B mtr to display numeric IP numbers and not try to resolve the host names. .TP .B \-b\fR, \fB\-\-show\-ips Use this option to tell .B mtr to display both the host names and numeric IP numbers. In split mode this adds an extra field to the output. In report mode, there is usually too little space to add the IPs, and they will be truncated. Use the wide report (-w) mode to see the IPs in report mode. .TP .B \-o \fIFIELDS\fR, \fB\-\-order \fIFIELDS Use this option to specify which fields to display and in which order. You may use one or more space characters to separate fields. .br Available fields: .TS center allbox tab(%); ll. L%Loss ratio D%Dropped packets R%Received packets S%Sent Packets N%Newest RTT(ms) B%Min/Best RTT(ms) A%Average RTT(ms) W%Max/Worst RTT(ms) V%Standard Deviation G%Geometric Mean J%Current Jitter M%Jitter Mean/Avg. X%Worst Jitter I%Interarrival Jitter .TE .br Example: -o "LSD NBAW X" .TP .B \-y \fIn\fR, \fB\-\-ipinfo \fIn Displays information about each IP hop. Valid values for \fIn\fR are: .TS tab(%); ll. 0%Display AS number (equivalent to \fB-z\fR) 1%Display IP prefix 2%Display country code of the origin AS 3%Display RIR (ripencc, arin, ...) 4%Display the allocation date of the IP prefix .TE .br It is possible to cycle between these fields at runtime (using the \fBy\fR key). .TP .B \-z\fR, \fB\-\-aslookup Displays the Autonomous System (AS) number alongside each hop. Equivalent to \fB\-\-ipinfo 0\fR. .IP Example (columns to the right not shown for clarity): .nf 1. AS??? r-76520-PROD.greenqloud.internal 2. AS51969 46.149.16.4 3. AS??? 172.31.1.16 4. AS30818 82.221.168.236 5. ??? 6. AS??? rix-k2-gw.isnic.is 7. AS1850 www.isnic.is .fi .TP .B \-i \fISECONDS\fR, \fB\-\-interval \fISECONDS Use this option to specify the positive number of seconds between ICMP ECHO requests. The default value for this parameter is one second. The root user may choose values between zero and one. .TP .B \-c \fICOUNT\fR, \fB\-\-report\-cycles \fICOUNT Use this option to set the number of pings sent to determine both the machines on the network and the reliability of those machines. Each cycle lasts one second. .TP .B \-s \fIPACKETSIZE\fR, \fB\-\-psize \fIPACKETSIZE This option sets the packet size used for probing. It is in bytes, inclusive IP and ICMP headers. If set to a negative number, every iteration will use a different, random packet size up to that number. .TP .B \-B \fINUM\fR, \fB\-\-bitpattern \fINUM Specifies bit pattern to use in payload. Should be within range 0 - 255. If .I NUM is greater than 255, a random pattern is used. .TP .B \-G \fISECONDS\fR, \fB\-\-gracetime \fISECONDS Use this option to specify the positive number of seconds to wait for responses after the final request. The default value is five seconds. .TP .B \-Q \fINUM\fR, \fB\-\-tos \fINUM Specifies value for type of service field in IP header. Should be within range 0 - 255. .TP .B \-e\fR, \fB\-\-mpls Use this option to tell .B mtr to display information from ICMP extensions for MPLS (RFC 4950) that are encoded in the response packets. .TP .B \-a \fIADDRESS\fR, \fB\-\-address \fIADDRESS Use this option to bind the outgoing socket to .IR ADDRESS , so that all packets will be sent with .I ADDRESS as source address. NOTE that this option doesn't apply to DNS requests (which could be and could not be what you want). .TP .B \-f \fINUM\fR, \fB\-\-first-ttl \fINUM Specifies with what TTL to start. Defaults to 1. .TP .B \-m \fINUM\fR, \fB\-\-max-ttl \fINUM Specifies the maximum number of hops (max time-to-live value) traceroute will probe. Default is 30. .TP .B \-U \fINUM\fR, \fB\-\-max-unknown \fINUM Specifies the maximum unknown host. Default is 5. .TP .B \-u\fR, \fB\-\-udp Use UDP datagrams instead of ICMP ECHO. .TP .B \-T\fR, \fB\-\-tcp Use TCP SYN packets instead of ICMP ECHO. .I PACKETSIZE is ignored, since SYN packets can not contain data. .TP .B \-S\fR, \fB\-\-sctp Use Stream Control Transmission Protocol packets instead of ICMP ECHO. .TP .B \-P \fIPORT\fR, \fB\-\-port \fIPORT The target port number for TCP/SCTP/UDP traces. .TP .B \-L \fILOCALPORT\fR, \fB\-\-localport \fILOCALPORT The source port number for UDP traces. .TP .B \-Z \fISECONDS\fR, \fB\-\-timeout \fISECONDS The number of seconds to keep probe sockets open before giving up on the connection. Using large values for this, especially combined with a short interval, will use up a lot of file descriptors. .TP .B \-M \fIMARK\fR, \fB\-\-mark \fIMARK Set the mark for each packet sent through this socket similar to the netfilter MARK target but socket-based. .I MARK is 32 unsigned integer. See .BR socket (7) for full description of this socket option. .SH ENVIRONMENT .B mtr recognizes a few environment variables. .TP .B MTR_OPTIONS This environment variable allows to specify options, as if they were passed on the command line. It is parsed before reading the actual command line options, so that options specified in .B MTR_OPTIONS are overridden by command-line options. Example: .BI MTR_OPTIONS ="-4\ -c\ 1" .B mtr .I \-6\ localhost would send one probe (because of .I -c\ 1\c ) towards .B ::1 (because of .IR -6 , which overrides the .I -4 passed in .B MTR_OPTIONS\c ). .TP .B MTR_PACKET A path to the .I mtr-packet executable, to be used for sending and receiving network probes. If .B MTR_PACKET is unset, the .B PATH will be used to search for an .I mtr-packet executable. .TP .B DISPLAY Specifies an X11 server for the GTK+ frontend. .SH BUGS Some modern routers give a lower priority to ICMP ECHO packets than to other network traffic. Consequently, the reliability of these routers reported by .B mtr will be significantly lower than the actual reliability of these routers. .SH CONTACT INFORMATION .PP For the latest version, see the mtr web page at .UR http://\:www.\:bitwizard.\:nl/\:mtr/ .UE .PP For patches, bug reports, or feature requests, please open an issue on GitHub at: .UR https://\:github\:.com/\:traviscross/\:mtr .UE . .SH "SEE ALSO" .BR mtr-packet (8), .BR traceroute (8), .BR ping (8), .BR socket (7), TCP/IP Illustrated (Stevens, ISBN 0201633469). mtr-0.92/version.h.tmp0000664000175000017500000000136412755047103013731 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define MTR_VERSION "0.87" mtr-0.92/img/0000775000175000017500000000000012776730076012057 5ustar wolffwolffmtr-0.92/img/Makefile0000664000175000017500000002514412755047066013522 0ustar wolffwolff# Makefile.in generated by automake 1.14.1 from Makefile.am. # img/Makefile. Generated from Makefile.in by configure. # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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)/mtr pkgincludedir = $(includedir)/mtr pkglibdir = $(libdir)/mtr pkglibexecdir = $(libexecdir)/mtr 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 = : subdir = img DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 = SOURCES = DIST_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) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = ${SHELL} /home/wolff/mtr/missing aclocal-1.14 AMTAR = $${TAR-tar} AM_DEFAULT_VERBOSITY = 1 AUTOCONF = ${SHELL} /home/wolff/mtr/missing autoconf AUTOHEADER = ${SHELL} /home/wolff/mtr/missing autoheader AUTOMAKE = ${SHELL} /home/wolff/mtr/missing automake-1.14 AWK = gawk CC = gcc CCDEPMODE = depmode=gcc3 CFLAGS = -g -O2 -Wall -Wno-pointer-sign CPP = gcc -E CPPFLAGS = CURSES_OBJ = curses.o CYGPATH_W = echo DEFS = -DHAVE_CONFIG_H DEPDIR = .deps ECHO_C = ECHO_N = -n ECHO_T = EGREP = /bin/grep -E EXEEXT = GREP = /bin/grep GTK_OBJ = INSTALL = /usr/bin/install -c INSTALL_DATA = ${INSTALL} -m 644 INSTALL_PROGRAM = ${INSTALL} INSTALL_SCRIPT = ${INSTALL} INSTALL_STRIP_PROGRAM = $(install_sh) -c -s LDFLAGS = LIBOBJS = LIBS = -lm -lncurses LTLIBOBJS = MAKEINFO = ${SHELL} /home/wolff/mtr/missing makeinfo MKDIR_P = /bin/mkdir -p OBJEXT = o PACKAGE = mtr PACKAGE_BUGREPORT = PACKAGE_NAME = mtr PACKAGE_STRING = mtr 0.87 PACKAGE_TARNAME = mtr PACKAGE_URL = PACKAGE_VERSION = 0.87 PATH_SEPARATOR = : RESOLV_LIBS = -lresolv SET_MAKE = SHELL = /bin/bash STRIP = VERSION = 0.87 abs_builddir = /home/wolff/mtr/img abs_srcdir = /home/wolff/mtr/img abs_top_builddir = /home/wolff/mtr abs_top_srcdir = /home/wolff/mtr ac_ct_CC = gcc am__include = include am__leading_dot = . am__quote = am__tar = $${TAR-tar} chof - "$$tardir" am__untar = $${TAR-tar} xf - bindir = ${exec_prefix}/bin build_alias = builddir = . datadir = ${datarootdir} datarootdir = ${prefix}/share docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} dvidir = ${docdir} exec_prefix = ${prefix} host_alias = htmldir = ${docdir} includedir = ${prefix}/include infodir = ${datarootdir}/info install_sh = ${SHELL} /home/wolff/mtr/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} sbindir = ${exec_prefix}/sbin sharedstatedir = ${prefix}/com srcdir = . sysconfdir = ${prefix}/etc target_alias = top_build_prefix = ../ top_builddir = .. top_srcdir = .. EXTRA_DIST = mtr_icon.xpm all: all-am .SUFFIXES: $(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 img/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign img/Makefile .PRECIOUS: 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): tags TAGS: ctags CTAGS: cscope cscopelist: 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 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) 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 mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic 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-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am distclean distclean-generic 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-generic pdf \ pdf-am ps ps-am tags-am uninstall uninstall-am # 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: mtr-0.92/img/mtr_icon.xpm0000664000175000017500000001545512776730076014431 0ustar wolffwolff/* XPM */ static const char * mtr_icon[] = { "48 48 131 2", " c #000000", ". c #020204", "+ c #3E7E3C", "@ c #62BA64", "# c #4E9E4C", "$ c #628664", "% c #6EDA6C", "& c #7A9E7C", "* c #468E44", "= c #6ACA6C", "- c #224224", "; c #56AE54", "> c #326234", ", c #567E54", "' c #7ABA7C", ") c #3A723C", "! c #629E64", "~ c #428644", "{ c #6E926C", "] c #7AEA7C", "^ c #4A964C", "/ c #62C264", "( c #52A654", "_ c #4A7E4C", ": c #82AE84", "< c #366A34", "[ c #5AB65C", "} c #4A764C", "| c #6AD26C", "1 c #8EC68C", "2 c #7A9A7C", "3 c #7AE27C", "4 c #82A684", "5 c #568E54", "6 c #568654", "7 c #3E7A3C", "8 c #6AC26C", "9 c #3E6A3C", "0 c #468244", "a c #56A254", "b c #4E8E4C", "c c #5EAE5C", "d c #86C684", "e c #427244", "f c #62A664", "g c #769A74", "h c #82F284", "i c #5A9A5C", "j c #5AA65C", "k c #428244", "l c #66BE64", "m c #6A8E6C", "n c #76DA74", "o c #7E9E7C", "p c #2A522C", "q c #5E825C", "r c #82BE84", "s c #669E64", "t c #6E966C", "u c #529A54", "v c #62C664", "w c #4A824C", "x c #366E34", "y c #72D674", "z c #427E3C", "A c #5EBE5C", "B c #52A254", "C c #628A64", "D c #4A924C", "E c #6ACE6C", "F c #5AB25C", "G c #326634", "H c #568254", "I c #7ABE7C", "J c #3A763C", "K c #468A44", "L c #7EEE7C", "M c #4E9A4C", "N c #56AA54", "O c #86B684", "P c #62B664", "Q c #162A14", "R c #529E54", "S c #72DA74", "T c #76A274", "U c #4A8E4C", "V c #264A24", "W c #5AAE5C", "X c #5EA25C", "Y c #468644", "Z c #729274", "` c #7EEA7C", " . c #4E964C", ".. c #66C264", "+. c #56A654", "@. c #4E7E4C", "#. c #8AB28C", "$. c #3A6A3C", "%. c #5EB65C", "&. c #527A54", "*. c #6ED26C", "=. c #92C694", "-. c #7E9A7C", ";. c #7AE67C", ">. c #86AA84", ",. c #5E865C", "'. c #6AC66C", "). c #3E6E3C", "!. c #5AA25C", "~. c #4E924C", "{. c #5EB25C", "]. c #467244", "^. c #86F284", "/. c #5AAA5C", "(. c #76DE74", "_. c #829E84", ":. c #325E34", "<. c #66A264", "[. c #729674", "}. c #66C664", "|. c #4E824C", "1. c #3A6E3C", "2. c #76D674", "3. c #427E44", "4. c #62BE64", "5. c #668A64", "6. c #6ECE6C", "7. c #366634", "8. c #5A825C", "9. c #7EBE7C", "0. c #3E763C", "G 7.G G G G G 7.G < z . .* k 1.G G G G G G 0.K x 7.7.7.7.7.< J Y D M D ) 7.7.7.7.7.7.< 7.7.7.7.", "7.G 7.> > > 7.G ) D M K 7 < > > > > > > > > + * < G G G G G G 7.G x k * M K x G G G G G G G G G ", "G G 7.G > > < ~ M D + G > > G > > 7.7.7.7.> 7 D x 7.7.7.7.7.G 7.7.G < ) ~ D M 7 7.7.7.7.7.7.7.7.", "7.7.G > 7.< * M ~ x > G > G > > 7.> > > > G 7 * 1.G G G G G 7.G G 7.G G G J * M ~ < G G G G G G ", "> G G > x D M k < G > G > > G > > G G G > 7.7 * x 7.7.7.7.G 7.7.G 7.7.7.7.G x ~ # Y < 7.7.7.7.7.", "G > > x ^ .0.G G G 7.> > > > > G > > > 7.> 7 U 1.G G G G 7.G G 7.G G G G 7.G < k # K < G G G G ", "G G < .^ J G G 7.G 7.> G > > > > 7.7.> 7.7.7 * x 7.7.7.G 7.7.G 7.7.7.7.G 7.G G 7.+ B ~ < 7.7.7.", "> < D M 7 G > > > G > G > > G > 7.> > G > > + U 1.G G G 7.G G 7.G G G G 7.G 7.7.G < k B + < G G ", "G k # k < 7.7.G > G > > G > > > > G x k .R F A N R U 7 x 7.G 7.7.7.7.G 7.G G 7.G G < K # J $.8.", ") ( K < > > G G 7.G G > > > G G + M +.B M D B W ^ ^ # ( +.^ ) G G G G 7.G 7.7.G 7.7.7.x u ! & o ", "^ .x > > > > G 7.7.G > > > 0. .+.M K + ) < + D ) < J k * R +.D x 7.G 7.G G 7.G G G 7.e T =.& H ", "+.+ < G G G 7.G > G G > G ~ ( B ~ ) G > G > 7 U < 7.7.G < J * B B 7 7.G 7.7.G 7.7.9 5.o Z s a ) ", "D x > > > > > G > G G < K ( D 0.> G 7.> G 7.+ * < G 7.7.G G < + # ( + G G 7.G $.,.2 [.$ ).0.( k ", "7 7.G G G G 7.G G > 7.K +.K x > G > > G > > 7 D < 7.G G 7.7.G 7.) M +.7 7.< &.[.2 C &.7.7.7.* B ", "x 7.> > > > > 7.7.G k +.* < > > > G > 7.G G 7 * < 7.7.G G 7.G G G ) M B &.[.o m &.7.G 7.G 7.) %.", "7.G 7.7.7.G 7.G G x B ^ ) > G > 7.> 7.> > > + D 7.G G 7.7.G 7.7.7.< w r #.{ , 9 7.7.7.G 7.G < ( ", "> G G > 7.G > 7.7.* ( 7 G > > > > > G 7.1.z B F D 7 < G 7.G G G $.q o : I _ < > G G 7.G 7.G 7.~ ", "7.7.> G > 7.7.> x +.* 7.> > G > G G < k # # +.[ B N ( k G 7.$.&.2 2 C |.B D < 7.7.7.G 7.G 7.G < ", "> 7.> G > G G > ~ +.+ > > > > > > < K R K + K M 3.K B W K } Z -.m &.< < Y W ) G G 7.G 7.G 7.G 7.", "> G G > > > 7.G # ^ ) > G > G > 7.~ # + < > 7 * < G J j d 4 { , $.G 7.G 7 F + 7.7.G 7.G 7.G 7.G ", "> > > G G > 7.7.N * 7.> > > > > J D Y > G 7.3.D < ).$ 4 1 ' e 7.7.G G G ) # D < G G 7.G 7.G 7.7.", "> 7.G > > G > x +.Y G > G > G > Y ~.x G > > 7 ~.8.-.2 5.i A 7 G G 7.7.7.< D # x 7.7.G 7.G 7.G G ", "< < x x < x x + ; * x x x x x ) ^ .1.) 1.) 5 r o t 6 0.K A D J ) ) ) J 7 .F k 7 7 7 7 J 0.0.x ", "D D * * D U U # A ( * * * K * * N W U U * K X 9.<.D K K R ..N U * * * * U ( A D K K K K U * K ) ", "7 z z 7 7 z 7 K {.M 7 7 7 0.0.7 # B J 7 7 7 U R 0.7 7 7 D / D 0.0.7 0.J 7 .F + 0.J 0.J 0.J 0.< ", "G > > > G > G < N K 7.> > G G > ~ D 1.G > > 3.U G G G G * A J G G G G 7.x D # x G 7.G 7.G 7.G G ", "G G G > G > G < ( * 7.> > > > > J ^ K G G > + D 7.7.7.7 N ( < 7.7.7.G G ) B * < G 7.G 7.G 7.7.G ", "G G > > > 7.G G # .) G > > G > > k u 0 7.G z U G G 7 ( F + < G G G 7.7.7 W + < 7.G 7.G 7.G G 7.", "> 7.G 7.> > > 7.~ B + > > > G G > x ~ # .+ ~ .7 D ; ; k G 7.7.7.G G G K W x G 7.G 7.G 7.7.G 7.", "7.G 7.> G 7.7.G < ( D < G > > > > > < z D # %.A +.B .7 < K = G G 7.7.J B D < 7.G 7.G 7.G G 7.x ", "G G G > > > > G G K ( 7 > > > > > G > G 1.+ R N K 7 x G ` (./.7.G G < K ; J G 7.G 7.G 7.7.G 7.Y ", "7.G G > > G G G G x B M ) > > G G > G G > > + D G G 7.7.;.E 4.G 7.7.7 N K < 7.G 7.G 7.G G 7.< ; ", "1.> G G > > > ` ] %.+ L 3 (.S S +.> /.L ;.(.S y 7.G 6.3 6.= = y ;...B # ` ] @ *.;.S B 7.G G J A ", "z G > > G 7.7.% = '.n ~.K %.= = = y *.u .4.= = {.7.c /.= = ..u M M B J y = E 6.!.b z G 7.< D W ", "M ) G > > G G y = ..7.. . +.@ '.= @ V . . 1.}.= {.. G 7.6.= B . . . . 7.y = ..> . . . . G ) [ D ", "[ + G G G > 7.S = a . . . . 4.E = z . . . G y = @ . . G (.6.a . . . . G y = .. . . . . < ^ W J ", "N B ) G G G 7.y = .. . . 7.}.6.'.0.. . . G (.= %.. . ~ y = B . . . 7.G *.'.0 . . . G 7.7 [ K < ", "+ [ D < > > G % = R . . > > }.6.}.0.. . +.+.3 = {.. . B (.E W . . G G 7.y = K . . G 7.x +.( J G ", "< D {.Y 7.> 7.y = u . . > > ..6.'.0.. . K U (.= %.. . + y = +.. . 7.G 7.y }.Y . . G < ^ F z 7.7.", "> x B ; + G > y = ( . . G > }.6.}.0.. . > G (.= {.. . G (.= {.. . G 7.G y = k . . < * [ U < G G ", "> G J +.N + G S '.R . . > G }.6.}.0.. . G G (.= [ . . G *.= }.J . G 7.G *.= ~ . . ~ %.^ x 7.7.7.", "G > G 7 +.N z y E B . . G > ..6.'.0.. . > > 3 = {.. . 7.'.= = = (.3 p 7.y '.0 . . {.# ) 7.G G G ", "G > G G 7 ( ; @ N ~.. . > > 4.W +.1.. . G 7.= /.B . . G > {.l 4.%.R G 7.@ /.+ . . M ) G 7.7.7.7.", "> 7.> > G 0.# %.^ . . . > > > > > . . > > > + D . . . 7.7.7.- - Q . . G < . . . . ) G 7.G G G G ", "G G 7.> 7.7.) ^ F . . < G > > > G . . 7.G > 3.D 7.. G G G 7.7.. . . . x D F . . < 7.G 7.7.7.7.7.", "> 7.G G > G G < ~ ( [ B + < > G > > > > > 7.+ U G 7.7.7.7.G G 7.G x K W [ R + < G G 7.G G G G G ", "> > > G > > > > 7.J D +.[ ; K x G 7.G 7.> 7.) z G G G G 7.7.< 0. .F F B ~ 1.G 7.7.G 7.7.7.7.7.7.", "G 7.7.> > G 7.G > 7.< M E | +.7 > > > > G > x ) 7.> 7.7.G G < k F % / ~ G G 7.G G 7.G G G G G G "}; mtr-0.92/img/Makefile.in0000664000175000017500000002515212755047062014122 0ustar wolffwolff# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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 = : subdir = img DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 = SOURCES = DIST_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) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_OBJ = @CURSES_OBJ@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ GTK_OBJ = @GTK_OBJ@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ 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@ RESOLV_LIBS = @RESOLV_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ 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_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ 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@ 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@ EXTRA_DIST = mtr_icon.xpm all: all-am .SUFFIXES: $(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 img/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign img/Makefile .PRECIOUS: 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): tags TAGS: ctags CTAGS: cscope cscopelist: 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 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) 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 mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic 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-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am distclean distclean-generic 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-generic pdf \ pdf-am ps ps-am tags-am uninstall uninstall-am # 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: mtr-0.92/version.h0000664000175000017500000000140112755047104013123 0ustar wolffwolff/* mtr -- a network diagnostic tool Copyright (C) 1997,1998 Matt Kimball This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define MTR_VERSION "0.87+git:9217f4f8" mtr-0.92/TODO0000664000175000017500000001115412441555317011765 0ustar wolffwolff Hi everyone, This is the "todo" file for mtr. I just realized that some people might think that this is all in MY queue to implement. That is not true: This is the "for everybody" todo list. Feel free to pick a "project" and implement something off this list. Students: Feel free to take up one of these as a programming exercise for one of your courses. Everybody: If you want to start on something, contact me first, so that the effort isn't wasted by someone who finishes just a tad earlier. I'll happily provide "coaching" to anyone who wants to implement something on this list. That way we get the design of these things the way I like them. This should result in a better maintainable mtr. Oh, Feel free to provide suggestions for this list. -- REW ---------------------------------------------------------------------- - Stuff to implement: - Allow mtr to log the return packets, for later analysis. Done: 0.25 . Todo: allow the user interface(s) to work while still logging to a file. Write a "logfile displaying" mode to mtr. - Request timestamping at the remote site. Andreas Fasbender has an algorithm that will allow us to convert these measurements into one-way measurements, not just round-trip. - allow "keyboard navigation" in the GTK version. - Keep all packets and make the "best" and "worst" columns show the xx-th percentile.... - Can the reports generated also include any secondary servers? In the interactive mode, any new servers that are found in the traceroute are added to the list, but it seems to only include one set of servers when using the -r option. - Being able to expand the "column width" of the hosts listed would be nice, too. - Bugs to fix? - Do something useful if host couldn't be resolved. -- Done. - Revert to curses mode even if DISPLAY is set, but a problem prevents us from running in X11 mode. --> The problem is that gtk_init simply calls exit for us if it finds a problem. Tricky! Suggestions welcome. --> Call "gtk_check_init" when available. (i.e. new enough (1.2?) GTK version). - Nice to have: - stop sending packets when a new host is getting entered. - Show state ("looking up host") while doing the DNS lookup for a new host. - to have a choice of icmp, tcp, and udp pings. -- Matt Martini - Autoconf 2.13 has a neat function that can be used to find the res_init function: AC_SEARCH_LIBS(res_init, bind resolv, , AC_MSG_ERROR(No resolver library found)) At the moment (march 1999) autoconf 2.13 is still too new to require everyone to upgrade. About a year from now we can put this in.... - Implement rfc2317 mechanism to do reverse lookups for networks that have DNS delegations on non-octet boundaries. -- Daniel Bergstrom (noa@melody.se) - The longer MTR runs, the less meaningful the packet loss statistic. Or more meaningful, depending on your point of view. Perhaps MTR should use a circular buffer of some configurable number of results, and calculate the loss against that. -- Jacob Elder - It would be nice if the window size wasn't fixed. If I'm only 5 hops from the host I'm monitoring, MTR wastes a lot of screen real estate. -- Jacob Elder - Colors in the curses version. -- Amix - If we run a mtr to monitor a connection it would be nice if the time at which mtr was started is print somewhere. -- Sebastian Ganschow ------------------------------------------------------------------------ Things that shouldn't be on the TODO list because they're done. ;-) - Allow a toggle between hostname/IP number display. (for example a click on the hostname could revert to ip number display in gtk version. curses: "n" key toggles hostnames/ipnumbers?) - Allow mtr to also send larger packets. This will enable us to get a feel for the speed of the links we're traversing. (Van Jacobson was working on this His tool was slow, mtr will rock with this feature.... :-) (Anybody have the statistics experience to tell me how to do the data analysis?) -- DONE. Thanks to Olav Kvittem ... - The "don't probe all hosts at once" strategy can be improved a bit. It should not probe more than 10 unknown hosts, but the counter need not be reset at the start of the "round". This way if you probe slowly (relative to the RTT time to the end host), it can probe all hosts in the first "round". -- DONE. - Read environment variable "MTR_DEFAULTS" as a commandline before parsing the commandline. -- DONE. (ok it's MTR_OPTIONS.) mtr-0.92/SECURITY0000664000175000017500000000457113075124176012473 0ustar wolffwolffSECURITY ISSUES RELATED TO MTR mtr invokes a sub-process, mtr-packet, which requires extra privileges to send custom packets, and there are security implications from granting this. There are several different ways to provide the privileges: 1. Add limited privileges on systems that support this. (Preferred.) 2. Run mtr as the root user. 3. Make mtr-packet a setuid-root binary. Details: 1. Add limited privileges on systems that support this. Some operating systems allow binaries to be run with only the subset of security privileges that are actually needed. Linux: On Linux, privileges are known as capabilities. The only additional capability that mtr-packet needs is cap_net_raw. To give this capability to the mtr-packet binary, run the following command as root: # setcap cap_net_raw+ep mtr-packet 2. Run mtr as the root user. You can limit mtr usage to the root user by not putting a setuid bit on the mtr-packet binary. In that case, the security implications are minimal. 3. Make mtr-packet a setuid-root binary. The mtr-packet binary can be made setuid-root, which is what "make install" does by default. When mtr-packet is installed as suid-root, some concern over security is justified. mtr-packet does the following two things after it is launched: * mtr-packet open sockets for sending raw packets and for receiving ICMP packets. * mtr-packet drops root privileges by setting the effective uid to match uid or the user calling mtr. * If capabilities support is available, mtr-packet drops all privileged capabilities. See main() in packet.c and init_net_state_privileged() in probe_unix.c for the details of this process. This should limit the possibilities of using mtr to breach system security. The worst case scenario is as follows: Due to some oversight in the mtr-packet code, a malicious user is able to overrun one of mtr-packets's internal buffers with binary code that is eventually executed. The malicious user is still not able to read from or write to any system files other than those normally accessible by the user running mtr. The only privileges gained are access to the raw socket, which would allow the malicious user to listen to all ICMP packets arriving at the system, and to send forged packets with arbitrary contents. If you have further questions or comments about security issues, please see the README file for details on how to submit them. mtr-0.92/build-aux/0000775000175000017500000000000013034463046013161 5ustar wolffwolffmtr-0.92/build-aux/git-version-gen0000775000175000017500000001753412755047116016143 0ustar wolffwolff#!/bin/sh # Print a version string. scriptversion=2016-05-08.18; # UTC # Copyright (C) 2007-2016 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 . # This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/. # It may be run two ways: # - from a git repository in which the "git describe" command below # produces useful output (thus requiring at least one signed tag) # - from a non-git-repo directory containing a .tarball-version file, which # presumes this script is invoked like "./git-version-gen .tarball-version". # In order to use intra-version strings in your project, you will need two # separate generated version string files: # # .tarball-version - present only in a distribution tarball, and not in # a checked-out repository. Created with contents that were learned at # the last time autoconf was run, and used by git-version-gen. Must not # be present in either $(srcdir) or $(builddir) for git-version-gen to # give accurate answers during normal development with a checked out tree, # but must be present in a tarball when there is no version control system. # Therefore, it cannot be used in any dependencies. GNUmakefile has # hooks to force a reconfigure at distribution time to get the value # correct, without penalizing normal development with extra reconfigures. # # .version - present in a checked-out repository and in a distribution # tarball. Usable in dependencies, particularly for files that don't # want to depend on config.h but do want to track version changes. # Delete this file prior to any autoconf run where you want to rebuild # files to pick up a version string change; and leave it stale to # minimize rebuild time after unrelated changes to configure sources. # # As with any generated file in a VC'd directory, you should add # /.version to .gitignore, so that you don't accidentally commit it. # .tarball-version is never generated in a VC'd directory, so needn't # be listed there. # # Use the following line in your configure.ac, so that $(VERSION) will # automatically be up-to-date each time configure is run (and note that # since configure.ac no longer includes a version string, Makefile rules # should not depend on configure.ac for version updates). # # AC_INIT([GNU project], # m4_esyscmd([build-aux/git-version-gen .tarball-version]), # [bug-project@example]) # # Then use the following lines in your Makefile.am, so that .version # will be present for dependencies, and so that .version and # .tarball-version will exist in distribution tarballs. # # EXTRA_DIST = $(top_srcdir)/.version # BUILT_SOURCES = $(top_srcdir)/.version # $(top_srcdir)/.version: # echo $(VERSION) > $@-t && mv $@-t $@ # dist-hook: # echo $(VERSION) > $(distdir)/.tarball-version me=$0 version="git-version-gen $scriptversion Copyright 2011 Free Software Foundation, Inc. There is NO warranty. You may redistribute this software under the terms of the GNU General Public License. For more information about these matters, see the files named COPYING." usage="\ Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT] Print a version string. Options: --prefix PREFIX prefix of git tags (default 'v') --fallback VERSION fallback version to use if \"git --version\" fails --help display this help and exit --version output version information and exit Running without arguments will suffice in most cases." prefix=v fallback= while test $# -gt 0; do case $1 in --help) echo "$usage"; exit 0;; --version) echo "$version"; exit 0;; --prefix) shift; prefix=${1?};; --fallback) shift; fallback=${1?};; -*) echo "$0: Unknown option '$1'." >&2 echo "$0: Try '--help' for more information." >&2 exit 1;; *) if test "x$tarball_version_file" = x; then tarball_version_file="$1" elif test "x$tag_sed_script" = x; then tag_sed_script="$1" else echo "$0: extra non-option argument '$1'." >&2 exit 1 fi;; esac shift done if test "x$tarball_version_file" = x; then echo "$usage" exit 1 fi tag_sed_script="${tag_sed_script:-s/x/x/}" nl=' ' # Avoid meddling by environment variable of the same name. v= v_from_git= # First see if there is a tarball-only version file. # then try "git describe", then default. if test -f $tarball_version_file then v=`cat $tarball_version_file` || v= case $v in *$nl*) v= ;; # reject multi-line output [0-9]*) ;; *) v= ;; esac test "x$v" = x \ && echo "$0: WARNING: $tarball_version_file is missing or damaged" 1>&2 fi if test "x$v" != x then : # use $v # Otherwise, if there is at least one git commit involving the working # directory, and "git describe" output looks sensible, use that to # derive a version string. elif test "`git log -1 --pretty=format:x . 2>&1`" = x \ && v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \ || git describe --abbrev=4 HEAD 2>/dev/null` \ && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \ && case $v in $prefix[0-9]*) ;; *) (exit 1) ;; esac then # Is this a new git that lists number of commits since the last # tag or the previous older version that did not? # Newer: v6.10-77-g0f8faeb # Older: v6.10-g0f8faeb case $v in *-*-*) : git describe is okay three part flavor ;; *-*) : git describe is older two part flavor # Recreate the number of commits and rewrite such that the # result is the same as if we were using the newer version # of git describe. vtag=`echo "$v" | sed 's/-.*//'` commit_list=`git rev-list "$vtag"..HEAD 2>/dev/null` \ || { commit_list=failed; echo "$0: WARNING: git rev-list failed" 1>&2; } numcommits=`echo "$commit_list" | wc -l` v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`; test "$commit_list" = failed && v=UNKNOWN ;; esac # Change the first '-' to a '.', so version-comparing tools work properly. # Remove the "g" in git describe's output string, to save a byte. v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`; v_from_git=1 elif test "x$fallback" = x || git --version >/dev/null 2>&1; then v=UNKNOWN else v=$fallback fi v=`echo "$v" |sed "s/^$prefix//"` # Test whether to append the "-dirty" suffix only if the version # string we're using came from git. I.e., skip the test if it's "UNKNOWN" # or if it came from .tarball-version. if test "x$v_from_git" != x; then # Don't declare a version "dirty" merely because a time stamp has changed. git update-index --refresh > /dev/null 2>&1 dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty= case "$dirty" in '') ;; *) # Append the suffix only if there isn't one already. case $v in *-dirty) ;; *) v="$v-dirty" ;; esac ;; esac fi # Omit the trailing newline, so that m4_esyscmd can use the result directly. printf %s "$v" # 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: "UTC0" # time-stamp-end: "; # UTC" # End: mtr-0.92/build-aux/compile0000755000175000017500000001624512755007526014553 0ustar wolffwolff#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2013 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: mtr-0.92/build-aux/depcomp0000755000175000017500000005601612755007526014552 0ustar wolffwolff#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2013 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 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. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # 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: mtr-0.92/build-aux/mangen.sh0000775000175000017500000000035413031772644014773 0ustar wolffwolff#!/bin/sh # # Generate the man pages. # # We are just here to substitute the @VERSION@ string with our real version. # if [ $# -lt 3 ]; then echo Usage: mangen.sh VERSION IN OUT exit 1 fi sed -e "s|@VERSION[@]|$1|g" $2 >$3 mtr-0.92/build-aux/config.guess0000755000175000017500000012475313017754130015511 0ustar wolffwolff#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2015 Free Software Foundation, Inc. timestamp='2015-08-20' # 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: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -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-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." 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'` ;; 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. case "${UNAME_MACHINE_ARCH}" in arm*|earm*|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 ;; *: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 ;; 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 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; 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:BSD:*) 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) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac 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*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 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 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-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 '[A-Z]' '[a-z]'``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 ;; 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; } ;; 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 ;; 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:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} 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.*:* | i*86:SYSTEM_V: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 configury 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 ;; 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 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 ;; *: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 ;; esac cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp 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` /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-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: mtr-0.92/build-aux/config.sub0000755000175000017500000010646013017754131015150 0ustar wolffwolff#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2015 Free Software Foundation, Inc. timestamp='2015-08-20' # 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: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # 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 $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -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-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." 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* | \ 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/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -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 | 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 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | 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 \ | we32k \ | 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 | z8k) ;; 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-* | 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-* \ | 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-* \ | 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-unknown 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* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; 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 ;; hppa-next) os=-nextstep3 ;; 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 ;; i386-vsta | 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 ;; m88k-omron*) basic_machine=m88k-omron ;; 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 ;; 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 | ppc-le | powerpc-little) 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 | ppc64-le | powerpc64-little) 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 ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | 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 ;; 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 ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; 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 ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; 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 ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; 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 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First 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* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # 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 | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -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 ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -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 ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -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 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-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 ;; *-next) os=-nextstep3 ;; *-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-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: mtr-0.92/build-aux/install-sh0000755000175000017500000003325512755007526015201 0ustar wolffwolff#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-11-20.07; # 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. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # 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_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' 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 no_target_directory= 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 *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done 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 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 -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob 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` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob 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: mtr-0.92/build-aux/missing0000755000175000017500000001533012755007526014566 0ustar wolffwolff#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2013 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: mtr-0.92/build-aux/test-driver0000755000175000017500000001104013017754131015350 0ustar wolffwolff#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2013-07-13.22; # UTC # Copyright (C) 2011-2014 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 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 # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <$log_file 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then tweaked_estatus=1 else tweaked_estatus=$estatus fi case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report the test outcome and exit status in the logs, so that one can # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). echo "$res $test_name (exit status: $estatus)" >>$log_file # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # 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: mtr-0.92/build-aux/mkinstalldirs0000755000175000017500000000370412755315176016002 0ustar wolffwolff#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain errstatus=0 dirmode="" usage="\ Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" 1>&2 exit 0 ;; -m) # -m PERM arg shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } dirmode=$1 shift ;; --) # stop option processing shift break ;; -*) # unknown option echo "$usage" 1>&2 exit 1 ;; *) # first non-opt arg break ;; esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac case $dirmode in '') if mkdir -p -- . 2>/dev/null; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" fi ;; *) if mkdir -m "$dirmode" -p -- . 2>/dev/null; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" fi ;; esac for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case $pathcomp in -*) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr="" chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp="$pathcomp/" done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 # End: # mkinstalldirs ends here mtr-0.92/build-aux/mtr.bat0000775000175000017500000000220313034463046014453 0ustar wolffwolff@echo off rem rem mtr -- a network diagnostic tool rem Copyright (C) 2016 Matt Kimball rem rem This program is free software; you can redistribute it and/or modify rem it under the terms of the GNU General Public License version 2 as rem published by the Free Software Foundation. rem rem This program is distributed in the hope that it will be useful, rem but WITHOUT ANY WARRANTY; without even the implied warranty of rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the rem GNU General Public License for more details. rem rem You should have received a copy of the GNU General Public License rem along with this program; if not, write to the Free Software rem Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. rem rem Assume the path of this batch file is the mtr installation location set "MTR_DIR=%~dp0" set "MTR_BIN=%MTR_DIR%\bin" rem ncurses needs to locate the cygwin terminfo file set "TERMINFO=%MTR_DIR%\terminfo" rem mtr needs to know the location to the packet generator set "MTR_PACKET=%MTR_BIN%\mtr-packet.exe" rem Pass along commandline arguments "%MTR_BIN%\mtr" %* mtr-0.92/BSDCOPYING0000664000175000017500000000307313031772644012662 0ustar wolffwolffPortions of this software have the following copyright. -- Copyright (c) 1991, 1993 The Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 4. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.