From 32e8e45702b2b32638a3307146583e4d54e0089a Mon Sep 17 00:00:00 2001 From: "Michael C. Toren" Date: Thu, 8 Dec 2005 20:08:07 +0000 Subject: [PATCH] [ Automated import by raw2svndump ] --- ChangeLog | 30 +- Makefile.am | 2 +- Makefile.in | 73 +- README | 2 +- VERSION | 2 +- aclocal.m4 | 821 +----- autom4te.cache/output.0 | 6153 +++++++++++++++++++++++++++++++++++++++ autom4te.cache/requests | 94 + autom4te.cache/traces.0 | 278 ++ capture.c | 472 +++ capture.h | 40 + config.h.in | 12 +- configure | 2090 ++++++------- configure.ac | 146 +- datalink.c | 339 +++ datalink.h | 40 + debian/copyright | 2 +- main.c | 544 ++++ probe.c | 408 +++ probe.h | 57 + tcptra-testsuite.pl | 117 + tcptraceroute.c | 2011 ------------- tcptraceroute.h | 90 + util.c | 311 ++ util.h | 55 + 25 files changed, 10277 insertions(+), 3912 deletions(-) create mode 100644 autom4te.cache/output.0 create mode 100644 autom4te.cache/requests create mode 100644 autom4te.cache/traces.0 create mode 100644 capture.c create mode 100644 capture.h create mode 100644 datalink.c create mode 100644 datalink.h create mode 100644 main.c create mode 100644 probe.c create mode 100644 probe.h create mode 100755 tcptra-testsuite.pl delete mode 100644 tcptraceroute.c create mode 100644 tcptraceroute.h create mode 100644 util.c create mode 100644 util.h diff --git a/ChangeLog b/ChangeLog index c5c0f4d..9d031c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +Version 1.5beta6 (2005-01-03) + + New --dnat, --no-dnat (default), and --no-dnat-strict command line + arguments. --dnat enabled Destination NAT detection, which works by + comparing the quoted IP address in an ICMP payload with the + destination a probe packet was addressed to. + + Numeric IP address in parenthesis is now only displayed if the content + in the parenthesis is different than the non-parenthesized content, + making the output less busy. + + The SYN ISN (Initial Sequence Number) now set to a random 32bit value; + previously had always been zero. + + Added missing htons() call around the arguments to getservbyport(), + which resulted in the destination port service name not being correctly + reported on some architectures, by Dmitry Karasik + + Improved the configure.ac so that it is less likely to link against + unnecessary libraries by "Dmitry V. Levin" + + --no-select is now the default under NetBSD, based on a report and data + collected by Ed Ravin . + + Split the tcptraceroute.c file into main.c, datalink.c, probe.c, + capture.c, util.c, and a number of include files, which should make + things much more manageable. + Version 1.5beta5 (2003-07-02) Now functions properly with libpcap when using an interface without a @@ -7,7 +35,7 @@ Version 1.5beta5 (2003-07-02) Improved autoconf handling of the --with-libpcap= command line argument, by Richard van den Berg . - Moved the tcptraceroute man page from section 1 to section 8 now that + Moved the tcptraceroute man page to section 1 from section 8 now that tcptraceroute is installed in /usr/bin by default, as suggested by James Ralston . diff --git a/Makefile.am b/Makefile.am index 678b957..bbd7994 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ bin_PROGRAMS = tcptraceroute -tcptraceroute_SOURCES = tcptraceroute.c +tcptraceroute_SOURCES = main.c datalink.c util.c probe.c capture.c man_MANS = tcptraceroute.1 docdir = $(datadir)/doc/tcptraceroute diff --git a/Makefile.in b/Makefile.in index ec2b8c4..fee280a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -64,15 +64,12 @@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ CC = @CC@ -HAVE_LIB = @HAVE_LIB@ -LIB = @LIB@ -LTLIB = @LTLIB@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ VERSION = @VERSION@ bin_PROGRAMS = tcptraceroute -tcptraceroute_SOURCES = tcptraceroute.c +tcptraceroute_SOURCES = main.c datalink.c util.c probe.c capture.c man_MANS = tcptraceroute.1 docdir = $(datadir)/doc/tcptraceroute @@ -91,7 +88,7 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I. CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ -tcptraceroute_OBJECTS = tcptraceroute.o +tcptraceroute_OBJECTS = main.o datalink.o util.o probe.o capture.o tcptraceroute_LDADD = $(LDADD) tcptraceroute_DEPENDENCIES = tcptraceroute_LDFLAGS = @@ -114,6 +111,8 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP_ENV = --best +DEP_FILES = .deps/capture.P .deps/datalink.P .deps/main.P .deps/probe.P \ +.deps/util.P SOURCES = $(tcptraceroute_SOURCES) OBJECTS = $(tcptraceroute_OBJECTS) @@ -121,9 +120,9 @@ all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .o .s $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile + cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) cd $(top_builddir) \ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status @@ -188,9 +187,6 @@ uninstall-binPROGRAMS: rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ done -.c.o: - $(COMPILE) -c $< - .s.o: $(COMPILE) -c $< @@ -336,6 +332,11 @@ distdir: $(DISTFILES) -rm -rf $(distdir) mkdir $(distdir) -chmod 777 $(distdir) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ @@ -346,6 +347,38 @@ distdir: $(DISTFILES) || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp info-am: info: info-am dvi-am: @@ -387,25 +420,27 @@ distclean-generic: maintainer-clean-generic: mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \ - mostlyclean-compile mostlyclean-tags \ + mostlyclean-compile mostlyclean-tags mostlyclean-depend \ mostlyclean-generic mostlyclean: mostlyclean-am clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \ - clean-generic mostlyclean-am + clean-depend clean-generic mostlyclean-am clean: clean-am distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \ - distclean-tags distclean-generic clean-am + distclean-tags distclean-depend distclean-generic \ + clean-am distclean: distclean-am -rm -f config.status maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \ maintainer-clean-compile maintainer-clean-tags \ - maintainer-clean-generic distclean-am + maintainer-clean-depend maintainer-clean-generic \ + distclean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." @@ -418,10 +453,12 @@ maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile install-man1 uninstall-man1 install-man \ uninstall-man uninstall-docDATA install-docDATA tags mostlyclean-tags \ -distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ -dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \ -install-exec-am install-exec install-data-am install-data install-am \ -install uninstall-am uninstall all-redirect all-am all installdirs \ +distclean-tags clean-tags maintainer-clean-tags distdir \ +mostlyclean-depend distclean-depend clean-depend \ +maintainer-clean-depend info-am info dvi-am dvi check check-am \ +installcheck-am installcheck all-recursive-am install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-redirect all-am all installdirs \ mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean diff --git a/README b/README index eeda99e..bd1374a 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ tcptraceroute -- A traceroute implementation using TCP packets -Copyright (c) 2001, 2002, 2003 Michael C. Toren +Copyright (c) 2001-2005 Michael C. Toren Updates are available from diff --git a/VERSION b/VERSION index 893932c..8764bfb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5beta5 +1.5beta6 diff --git a/aclocal.m4 b/aclocal.m4 index e5c7002..af170a3 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -dnl aclocal.m4t generated automatically by aclocal 1.4-p4 +dnl aclocal.m4 generated automatically by aclocal 1.4-p4 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -10,825 +10,6 @@ dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. -# lib-prefix.m4 serial 2 (gettext-0.12) -dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and -dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't -dnl require excessive bracketing. -ifdef([AC_HELP_STRING], -[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], -[AC_DEFUN([AC_L][IB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) - -dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed -dnl to access previously installed libraries. The basic assumption is that -dnl a user will want packages to use other packages he previously installed -dnl with the same --prefix option. -dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate -dnl libraries, but is otherwise very convenient. -AC_DEFUN([AC_LIB_PREFIX], -[ - AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib-prefix], -[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib - --without-lib-prefix don't search for libraries in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi -]) - if test $use_additional = yes; then - dnl Potentially add $additional_includedir to $CPPFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's already present in $CPPFLAGS, - dnl 3. if it's /usr/local/include and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - for x in $CPPFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $CPPFLAGS. - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" - fi - fi - fi - fi - dnl Potentially add $additional_libdir to $LDFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's already present in $LDFLAGS, - dnl 3. if it's /usr/local/lib and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - for x in $LDFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LDFLAGS. - LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" - fi - fi - fi - fi - fi -]) - -dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, -dnl acl_final_exec_prefix, containing the values to which $prefix and -dnl $exec_prefix will expand at the end of the configure script. -AC_DEFUN([AC_LIB_PREPARE_PREFIX], -[ - dnl Unfortunately, prefix and exec_prefix get only finally determined - dnl at the end of configure. - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the -dnl variables prefix and exec_prefix bound to the values they will have -dnl at the end of the configure script. -AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], -[ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - $1 - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" -]) - -# lib-link.m4 serial 4 (gettext-0.12) -dnl Copyright (C) 2001-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl From Bruno Haible. - -dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and -dnl augments the CPPFLAGS variable. -AC_DEFUN([AC_LIB_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - ac_cv_lib[]Name[]_libs="$LIB[]NAME" - ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" - ac_cv_lib[]Name[]_cppflags="$INC[]NAME" - ]) - LIB[]NAME="$ac_cv_lib[]Name[]_libs" - LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" - INC[]NAME="$ac_cv_lib[]Name[]_cppflags" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the - dnl results of this search when this library appears as a dependency. - HAVE_LIB[]NAME=yes - undefine([Name]) - undefine([NAME]) -]) - -dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) -dnl searches for libname and the libraries corresponding to explicit and -dnl implicit dependencies, together with the specified include files and -dnl the ability to compile and link the specified testcode. If found, it -dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and -dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and -dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs -dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. -AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - define([Name],[translit([$1],[./-], [___])]) - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - - dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - - dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, - dnl because if the user has installed lib[]Name and not disabled its use - dnl via --without-lib[]Name-prefix, he wants to use it. - ac_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - - AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ - ac_save_LIBS="$LIBS" - LIBS="$LIBS $LIB[]NAME" - AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) - LIBS="$ac_save_LIBS" - ]) - if test "$ac_cv_lib[]Name" = yes; then - HAVE_LIB[]NAME=yes - AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) - AC_MSG_CHECKING([how to link with lib[]$1]) - AC_MSG_RESULT([$LIB[]NAME]) - else - HAVE_LIB[]NAME=no - dnl If $LIB[]NAME didn't lead to a usable library, we don't need - dnl $INC[]NAME either. - CPPFLAGS="$ac_save_CPPFLAGS" - LIB[]NAME= - LTLIB[]NAME= - fi - AC_SUBST([HAVE_LIB]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - undefine([Name]) - undefine([NAME]) -]) - -dnl Determine the platform dependent parameters needed to use rpath: -dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, -dnl hardcode_direct, hardcode_minus_L. -AC_DEFUN([AC_LIB_RPATH], -[ - AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS - AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld - AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host - AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir - AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - ]) - wl="$acl_cv_wl" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" - dnl Determine whether the user wants rpath handling at all. - AC_ARG_ENABLE(rpath, - [ --disable-rpath do not hardcode runtime library paths], - :, enable_rpath=yes) -]) - -dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. -AC_DEFUN([AC_LIB_LINKFLAGS_BODY], -[ - define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib$1-prefix], -[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib - --without-lib$1-prefix don't search for lib$1 in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/lib" - fi - fi -]) - dnl Search the library and its dependencies in $additional_libdir and - dnl $LDFLAGS. Using breadth-first-seach. - LIB[]NAME= - LTLIB[]NAME= - INC[]NAME= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='$1 $2' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - dnl See if it was already located by an earlier AC_LIB_LINKFLAGS - dnl or AC_LIB_HAVE_LINKFLAGS call. - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" - else - dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined - dnl that this library doesn't exist. So just drop it. - : - fi - else - dnl Search the library lib$name in $additional_libdir and $LDFLAGS - dnl and the already constructed $LIBNAME/$LTLIBNAME. - found_dir= - found_la= - found_so= - found_a= - if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then - found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - dnl Found the library. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - dnl Linking with a shared library. We attempt to hardcode its - dnl directory into the executable's runpath, unless it's the - dnl standard /usr/lib. - if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then - dnl No hardcoding is needed. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - dnl The hardcoding into $LIBNAME is system dependent. - if test "$hardcode_direct" = yes; then - dnl Using DIR/libNAME.so during linking hardcodes DIR into the - dnl resulting binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - dnl Rely on "-L$found_dir". - dnl But don't add it if it's already contained in the LDFLAGS - dnl or the already constructed $LIBNAME - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" - fi - if test "$hardcode_minus_L" != no; then - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH - dnl here, because this doesn't fit in flags passed to the - dnl compiler. So give up. No hardcoding. This affects only - dnl very old systems. - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - dnl Linking with a static library. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" - else - dnl We shouldn't come here, but anyway it's good to have a - dnl fallback. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" - fi - fi - dnl Assume the include files are nearby. - additional_includedir= - case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - dnl Potentially add $additional_includedir to $INCNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's /usr/local/include and we are using GCC on Linux, - dnl 3. if it's already present in $CPPFLAGS or the already - dnl constructed $INCNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INC[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $INCNAME. - INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - dnl Look for dependencies. - if test -n "$found_la"; then - dnl Read the .la file. It defines the variables - dnl dlname, library_names, old_library, dependency_libs, current, - dnl age, revision, installed, dlopen, dlpreopen, libdir. - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - dnl We use only dependency_libs. - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's /usr/local/lib and we are using GCC on Linux, - dnl 3. if it's already present in $LDFLAGS or the already - dnl constructed $LIBNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/lib"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - dnl Handle this in the next round. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - dnl Handle this in the next round. Throw away the .la's - dnl directory; it is already contained in a preceding -L - dnl option. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - dnl Most likely an immediate library name. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" - ;; - esac - done - fi - else - dnl Didn't find the library; assume it is in the system directories - dnl known to the linker and runtime loader. (All the system - dnl directories known to the linker should also be known to the - dnl runtime loader, otherwise the system is severely misconfigured.) - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user must - dnl pass all path elements in one option. We can arrange that for a - dnl single library, but not when more than one $LIBNAMEs are used. - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" - done - dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - else - dnl The -rpath options are cumulative. - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - dnl When using libtool, the option that works for both libraries and - dnl executables is -R. The -R options are cumulative. - for found_dir in $ltrpathdirs; do - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" - done - fi -]) - -dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, -dnl unless already present in VAR. -dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes -dnl contains two or three consecutive elements that belong together. -AC_DEFUN([AC_LIB_APPENDTOVAR], -[ - for element in [$2]; do - haveit= - for x in $[$1]; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - [$1]="${[$1]}${[$1]:+ }$element" - fi - done -]) - -# lib-ld.m4 serial 2 (gettext-0.12) -dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program -dnl that contains a configuration script generated by Autoconf, under -dnl the same distribution terms as the rest of that program. - -dnl Subroutines of libtool.m4, -dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision -dnl with libtool.m4. - -dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. -AC_DEFUN([AC_LIB_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - acl_cv_prog_gnu_ld=yes -else - acl_cv_prog_gnu_ld=no -fi]) -with_gnu_ld=$acl_cv_prog_gnu_ld -]) - -dnl From libtool-1.4. Sets the variable LD. -AC_DEFUN([AC_LIB_PROG_LD], -[AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -# Prepare PATH_SEPARATOR. -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]* | [A-Za-z]:[\\/]*)] - [re_direlt='/[^/][^/]*/\.\./'] - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(acl_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$acl_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_LIB_PROG_LD_GNU -]) - # Do all the work for Automake. 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. diff --git a/autom4te.cache/output.0 b/autom4te.cache/output.0 new file mode 100644 index 0000000..6eff37d --- /dev/null +++ b/autom4te.cache/output.0 @@ -0,0 +1,6153 @@ +@%:@! /bin/sh +@%:@ Guess values for system-dependent variables and create Makefiles. +@%:@ Generated by GNU Autoconf 2.53. +@%:@ +@%:@ Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +@%:@ Free Software Foundation, Inc. +@%:@ This configure script is free software; the Free Software Foundation +@%:@ gives unlimited permission to copy, distribute and modify it. + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + + +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# NLS nuisances. +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } + + +# Name of the executable. +as_me=`(basename "$0") 2>/dev/null || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + +# PATH needs CR, and LINENO needs CR and PATH. +# 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 + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + 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 + + ;; + 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 + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="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="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="tcptraceroute" +ac_unique_file="main.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# 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. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +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 + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -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 | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$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 ;; + + -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 ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + 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 ;; + + -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_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=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 ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + 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'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +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 + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# 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 its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + 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 + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# 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 this package 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 \`..'] + +_ACEOF + + cat <<_ACEOF +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] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --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] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_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] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-noselect-default + default to not using select(2) + --enable-track-default=PORT|ID + default to tracking probes by PORT or ID + --enable-default-port=N default destination port + --enable-static compile staticly, if using gcc + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + + --with-libpcap=DIR use libpcap in DIR + --with-libnet=DIR use libnet in DIR + +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 + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style 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 + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +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 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.53. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +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` +hostinfo = `(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=. + echo "PATH: $as_dir" +done + +} >&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. +# Also quote any args containing shell meta-characters. +ac_configure_args= +ac_sep= +for ac_arg +do + case $ac_arg in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n ) continue ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# 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: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + cat <<\_ASBOX +@%:@@%:@ ---------------- @%:@@%:@ +@%:@@%:@ Cache variables. @%:@@%:@ +@%:@@%:@ ---------------- @%:@@%:@ +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + if test -s confdefs.h; then + cat <<\_ASBOX +@%:@@%:@ ----------- @%:@@%:@ +@%:@@%:@ confdefs.h. @%:@@%:@ +@%:@@%:@ ----------- @%:@@%:@ +_ASBOX + echo + sed "/^$/d" confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core core.* *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +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 `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +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 + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6 +if test "${ac_cv_target+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_target_alias=$target_alias +test "x$ac_cv_target_alias" = "x" && + ac_cv_target_alias=$ac_cv_host_alias +ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6 +target=$ac_cv_target +target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- +# 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" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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/* | \ + /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_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 + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +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. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$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' + +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftestfile +# 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 ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $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". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +rm -f conftest* +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +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 $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="${MAKE}"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +PACKAGE=tcptraceroute + +VERSION=`cat VERSION` + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define VERSION "$VERSION" +_ACEOF + + + +missing_dir=`cd $ac_aux_dir && pwd` +echo "$as_me:$LINENO: checking for working aclocal" >&5 +echo $ECHO_N "checking for working aclocal... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$as_me:$LINENO: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$as_me:$LINENO: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:$LINENO: checking for working autoconf" >&5 +echo $ECHO_N "checking for working autoconf... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$as_me:$LINENO: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$as_me:$LINENO: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:$LINENO: checking for working automake" >&5 +echo $ECHO_N "checking for working automake... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$as_me:$LINENO: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$as_me:$LINENO: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:$LINENO: checking for working autoheader" >&5 +echo $ECHO_N "checking for working autoheader... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$as_me:$LINENO: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$as_me:$LINENO: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:$LINENO: checking for working makeinfo" >&5 +echo $ECHO_N "checking for working makeinfo... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$as_me:$LINENO: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$as_me:$LINENO: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + + + + +ac_config_headers="$ac_config_headers config.h" + +ac_config_commands="$ac_config_commands default-1" + + +# Checks for programs. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}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 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +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 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +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 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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_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" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 + set dummy "$as_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + 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 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# 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. +echo "$as_me:$LINENO: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb | *.xSYM ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$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 +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +@%:@ifndef __cplusplus + choke me +@%:@endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +@%:@include +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +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 +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +@%:@include + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +@%:@include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$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. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +@%:@include + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +@%:@include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +if test $ac_cv_c_compiler_gnu = yes; then + echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 +echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 +if test "${ac_cv_prog_gcc_traditional+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_pattern="Autoconf.*'x'" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +Autoconf TIOCGETP +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +else + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +Autoconf TCGETA +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 +echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + +if test "$GCC" = yes ; then + CFLAGS="$CFLAGS -Wall" +fi +# 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" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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/* | \ + /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_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 + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +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. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$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' + + +# Checks for libraries. +echo "$as_me:$LINENO: checking for gethostbyname" >&5 +echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* 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_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +f = gethostbyname; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 +if test $ac_cv_func_gethostbyname = yes; then + : +else + +echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 +echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_nsl_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_nsl_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 +if test $ac_cv_lib_nsl_gethostbyname = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_LIBNSL 1 +_ACEOF + + LIBS="-lnsl $LIBS" + +fi + +fi + +echo "$as_me:$LINENO: checking for socket" >&5 +echo $ECHO_N "checking for socket... $ECHO_C" >&6 +if test "${ac_cv_func_socket+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char socket (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char socket (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* 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_socket) || defined (__stub___socket) +choke me +#else +f = socket; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_socket=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_socket=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_socket" >&5 +echo "${ECHO_T}$ac_cv_func_socket" >&6 +if test $ac_cv_func_socket = yes; then + : +else + +echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 +echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_socket+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char socket (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +socket (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_socket=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_socket_socket=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6 +if test $ac_cv_lib_socket_socket = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_LIBSOCKET 1 +_ACEOF + + LIBS="-lsocket $LIBS" + +fi + +fi + +echo "$as_me:$LINENO: checking for connect" >&5 +echo $ECHO_N "checking for connect... $ECHO_C" >&6 +if test "${ac_cv_func_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char connect (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* 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_connect) || defined (__stub___connect) +choke me +#else +f = connect; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_connect=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_connect=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 +echo "${ECHO_T}$ac_cv_func_connect" >&6 +if test $ac_cv_func_connect = yes; then + : +else + +echo "$as_me:$LINENO: checking for connect in -linet" >&5 +echo $ECHO_N "checking for connect in -linet... $ECHO_C" >&6 +if test "${ac_cv_lib_inet_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-linet $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +connect (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_inet_connect=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_inet_connect=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_inet_connect" >&5 +echo "${ECHO_T}$ac_cv_lib_inet_connect" >&6 +if test $ac_cv_lib_inet_connect = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_LIBINET 1 +_ACEOF + + LIBS="-linet $LIBS" + +fi + +fi + +echo "$as_me:$LINENO: checking for inet_aton" >&5 +echo $ECHO_N "checking for inet_aton... $ECHO_C" >&6 +if test "${ac_cv_func_inet_aton+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char inet_aton (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char inet_aton (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* 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_inet_aton) || defined (__stub___inet_aton) +choke me +#else +f = inet_aton; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_inet_aton=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_inet_aton=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_inet_aton" >&5 +echo "${ECHO_T}$ac_cv_func_inet_aton" >&6 +if test $ac_cv_func_inet_aton = yes; then + : +else + +echo "$as_me:$LINENO: checking for inet_aton in -lresolv" >&5 +echo $ECHO_N "checking for inet_aton in -lresolv... $ECHO_C" >&6 +if test "${ac_cv_lib_resolv_inet_aton+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lresolv $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char inet_aton (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +inet_aton (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_resolv_inet_aton=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_resolv_inet_aton=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_inet_aton" >&5 +echo "${ECHO_T}$ac_cv_lib_resolv_inet_aton" >&6 +if test $ac_cv_lib_resolv_inet_aton = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_LIBRESOLV 1 +_ACEOF + + LIBS="-lresolv $LIBS" + +fi + +fi + + + +# Check whether --with-pcap or --without-pcap was given. +if test "${with_pcap+set}" = set; then + withval="$with_pcap" + + { { echo "$as_me:$LINENO: error: Please use \"--with-libpcap=DIR\", not \"--with-pcap=DIR\"" >&5 +echo "$as_me: error: Please use \"--with-libpcap=DIR\", not \"--with-pcap=DIR\"" >&2;} + { (exit 1); exit 1; }; } + +fi; + + +# Check whether --with-libpcap or --without-libpcap was given. +if test "${with_libpcap+set}" = set; then + withval="$with_libpcap" + + LIBPCAPCC="" + LIBPCAPLD="" + + test -f "$withval/pcap.h" && LIBPCAPCC="$LIBPCAPCC -I$withval" + test -d "$withval/bpf" && LIBPCAPCC="$LIBPCAPCC -I$withval/bpf" + test -f "$withval/include/pcap.h" && LIBPCAPCC="$LIBPCAPCC -I$withval/include" + + test -f "$withval/pcap.a" && LIBPCAPLD="$LIBPCAPLD -L$withval" + test -f "$withval/libpcap.a" && LIBPCAPLD="$LIBPCAPLD -L$withval" + test -f "$withval/lib/pcap.a" && LIBPCAPLD="$LIBPCAPLD -L$withval/lib" + test -f "$withval/lib/libpcap.a" && LIBPCAPLD="$LIBPCAPLD -L$withval/lib" + + if test -z "$LIBPCAPCC" -o -z "$LIBPCAPLD" + then + { { echo "$as_me:$LINENO: error: No valid libpcap library found in $withval" >&5 +echo "$as_me: error: No valid libpcap library found in $withval" >&2;} + { (exit 1); exit 1; }; } + else + CPPFLAGS="$CPPFLAGS $LIBPCAPCC" + LDFLAGS="$LDFLAGS $LIBPCAPLD" + { echo "$as_me:$LINENO: using libpcap in $withval" >&5 +echo "$as_me: using libpcap in $withval" >&6;} + fi + +fi; + +LIBNET_CONFIG="libnet-config" # relative, using $PATH + +# Check whether --with-libnet or --without-libnet was given. +if test "${with_libnet+set}" = set; then + withval="$with_libnet" + + LIBNETCC="" + LIBNETLD="" + + test -x "$withval/bin/libnet-config" && LIBNET_CONFIG="$withval/bin/libnet-config" + test -x "$withval/libnet-config" && LIBNET_CONFIG="$withval/libnet-config" + + test -f "$withval/libnet.h" && LIBNETCC="$LIBNETCC -I$withval" + test -f "$withval/include/libnet.h" && LIBNETCC="$LIBNETCC -I$withval/include" + + test -f "$withval/libnet.a" && LIBNETLD="$LIBNETLD -L$withval" + test -f "$withval/lib/libnet.a" && LIBNETLD="$LIBNETLD -L$withval/lib" + + if test -z "$LIBNETCC" -o -z "$LIBNETLD" + then + { { echo "$as_me:$LINENO: error: No valid libnet library found in $withval" >&5 +echo "$as_me: error: No valid libnet library found in $withval" >&2;} + { (exit 1); exit 1; }; } + else + CPPFLAGS="$CPPFLAGS $LIBNETCC" + LDFLAGS="$LDFLAGS $LIBNETLD" + { echo "$as_me:$LINENO: using libnet in $withval" >&5 +echo "$as_me: using libnet in $withval" >&6;} + fi + +fi; + + +echo "$as_me:$LINENO: checking for pcap_open_live in -lpcap" >&5 +echo $ECHO_N "checking for pcap_open_live in -lpcap... $ECHO_C" >&6 +if test "${ac_cv_lib_pcap_pcap_open_live+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcap $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pcap_open_live (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +pcap_open_live (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pcap_pcap_open_live=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_pcap_pcap_open_live=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pcap_pcap_open_live" >&5 +echo "${ECHO_T}$ac_cv_lib_pcap_pcap_open_live" >&6 +if test $ac_cv_lib_pcap_pcap_open_live = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_LIBPCAP 1 +_ACEOF + + LIBS="-lpcap $LIBS" + +else + { { echo "$as_me:$LINENO: error: cannot find libpcap" >&5 +echo "$as_me: error: cannot find libpcap" >&2;} + { (exit 1); exit 1; }; } +fi + + +# Libnet underwent a major API change in between version 1.0.2a and 1.1.0. +# The code below sets the preprocessor symbol LIBNET_API_VERSION to 100 if a +# pre-1.1.0 version of libnet is being used, and to 110 if version 1.1.0 or +# greater is being used. +# +# It would've been simpler to just have a HAVE_LIBNET_110 symbol or the like, +# but this way, if there are more incompatible API changes in the future, the +# values assigned to LIBNET_API_VERSION can be updated accordingly. + + +echo "$as_me:$LINENO: checking for main in -lnet" >&5 +echo $ECHO_N "checking for main in -lnet... $ECHO_C" >&6 +if test "${ac_cv_lib_net_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnet $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_net_main=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_net_main=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_net_main" >&5 +echo "${ECHO_T}$ac_cv_lib_net_main" >&6 +if test $ac_cv_lib_net_main = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_LIBNET 1 +_ACEOF + + LIBS="-lnet $LIBS" + +else + { { echo "$as_me:$LINENO: error: cannot find libnet" >&5 +echo "$as_me: error: cannot find libnet" >&2;} + { (exit 1); exit 1; }; } +fi + +echo "$as_me:$LINENO: checking for libnet_init_packet in -lnet" >&5 +echo $ECHO_N "checking for libnet_init_packet in -lnet... $ECHO_C" >&6 +if test "${ac_cv_lib_net_libnet_init_packet+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnet $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char libnet_init_packet (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +libnet_init_packet (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_net_libnet_init_packet=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_net_libnet_init_packet=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_net_libnet_init_packet" >&5 +echo "${ECHO_T}$ac_cv_lib_net_libnet_init_packet" >&6 +if test $ac_cv_lib_net_libnet_init_packet = yes; then + + +cat >>confdefs.h <<\_ACEOF +@%:@define LIBNET_API_VERSION 100 +_ACEOF + + { echo "$as_me:$LINENO: libnet version: < 1.1.0" >&5 +echo "$as_me: libnet version: < 1.1.0" >&6;} + CPPFLAGS="$CPPFLAGS `$LIBNET_CONFIG --defines`" + CPPFLAGS="$CPPFLAGS `$LIBNET_CONFIG --cflags`" + +else + + echo "$as_me:$LINENO: checking for libnet_init in -lnet" >&5 +echo $ECHO_N "checking for libnet_init in -lnet... $ECHO_C" >&6 +if test "${ac_cv_lib_net_libnet_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnet $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char libnet_init (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +libnet_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_net_libnet_init=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_net_libnet_init=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_net_libnet_init" >&5 +echo "${ECHO_T}$ac_cv_lib_net_libnet_init" >&6 +if test $ac_cv_lib_net_libnet_init = yes; then + + +cat >>confdefs.h <<\_ACEOF +@%:@define LIBNET_API_VERSION 110 +_ACEOF + + { echo "$as_me:$LINENO: libnet version: >= 1.1.0" >&5 +echo "$as_me: libnet version: >= 1.1.0" >&6;} + +else + + { { echo "$as_me:$LINENO: error: could not identify the version of libnet" >&5 +echo "$as_me: error: could not identify the version of libnet" >&2;} + { (exit 1); exit 1; }; } + +fi + + +fi + + +# Checks for header files. +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#include +#include + +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "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 >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#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)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +@%:@define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default + +@%:@include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + + + + + +for ac_header in arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +@%:@include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +@%:@include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +# Checks for typedefs, structures, and compiler characteristics. +echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 +if test "${ac_cv_header_time+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include +#include +#include + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_time=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_time=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6 +if test $ac_cv_header_time = yes; then + +cat >>confdefs.h <<\_ACEOF +@%:@define TIME_WITH_SYS_TIME 1 +_ACEOF + +fi + + +# Check to see if socket.sa_len exists. Adapted from the configure.in of _Unix +# Network Programming_ second edition example code, by W. Richard Stevens. +echo "$as_me:$LINENO: checking for sockaddr.sa_len" >&5 +echo $ECHO_N "checking for sockaddr.sa_len... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#include +#include + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + unsigned int i = sizeof(((struct sockaddr *)0)->sa_len) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_SOCKADDR_SA_LEN 1 +_ACEOF + + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +echo "$as_me:$LINENO: checking for struct sockaddr.sa_len" >&5 +echo $ECHO_N "checking for struct sockaddr.sa_len... $ECHO_C" >&6 +if test "${ac_cv_member_struct_sockaddr_sa_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + #include + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static struct sockaddr ac_aggr; +if (ac_aggr.sa_len) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_member_struct_sockaddr_sa_len=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_member_struct_sockaddr_sa_len=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_member_struct_sockaddr_sa_len" >&5 +echo "${ECHO_T}$ac_cv_member_struct_sockaddr_sa_len" >&6 +if test $ac_cv_member_struct_sockaddr_sa_len = yes; then + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_SOCKADDR_SA_LEN 1 +_ACEOF + +fi + + +# Checks for library functions. + +for ac_header in stdlib.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +@%:@include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +@%:@include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +echo "$as_me:$LINENO: checking for working malloc" >&5 +echo $ECHO_N "checking for working malloc... $ECHO_C" >&6 +if test "${ac_cv_func_malloc_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_malloc_works=no +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#if STDC_HEADERS || HAVE_STDLIB_H +# include +#else +char *malloc (); +#endif + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (malloc (0) ? 0 : 1); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_malloc_works=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_func_malloc_works=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_malloc_works" >&5 +echo "${ECHO_T}$ac_cv_func_malloc_works" >&6 +if test $ac_cv_func_malloc_works = yes; then + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_MALLOC 1 +_ACEOF + +fi + +# AC_FUNC_REALLOC # our util.c:xrealloc() function deals with the + # realloc(0,0) case, and AC_FUNC_REALLOC doesn't + # appear to break on HP/UX systems. + + +for ac_header in sys/select.h sys/socket.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +@%:@include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_header_compiler=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +@%:@include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc in + yes:no ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; + no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +echo "$as_me:$LINENO: checking types of arguments for select" >&5 +echo $ECHO_N "checking types of arguments for select... $ECHO_C" >&6 +if test "${ac_cv_func_select_args+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + for ac_arg234 in 'fd_set *' 'int *' 'void *'; do + for ac_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do + for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_includes_default +#if HAVE_SYS_SELECT_H +# include +#endif +#if HAVE_SYS_SOCKET_H +# include +#endif + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +extern int select ($ac_arg1, + $ac_arg234, $ac_arg234, $ac_arg234, + $ac_arg5); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3 +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done + done +done +# Provide a safe default value. +: ${ac_cv_func_select_args='int,int *,struct timeval *'} + +fi +echo "$as_me:$LINENO: result: $ac_cv_func_select_args" >&5 +echo "${ECHO_T}$ac_cv_func_select_args" >&6 +ac_save_IFS=$IFS; IFS=',' +set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'` +IFS=$ac_save_IFS +shift + +cat >>confdefs.h <<_ACEOF +@%:@define SELECT_TYPE_ARG1 $1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define SELECT_TYPE_ARG234 ($2) +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define SELECT_TYPE_ARG5 ($3) +_ACEOF + +rm -f conftest* + + +for ac_func in vprintf +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +echo "$as_me:$LINENO: checking for _doprnt" >&5 +echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6 +if test "${ac_cv_func__doprnt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char _doprnt (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char _doprnt (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* 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__doprnt) || defined (__stub____doprnt) +choke me +#else +f = _doprnt; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func__doprnt=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func__doprnt=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 +echo "${ECHO_T}$ac_cv_func__doprnt" >&6 +if test $ac_cv_func__doprnt = yes; then + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_DOPRNT 1 +_ACEOF + +fi + +fi +done + + + + + + + +for ac_func in gettimeofday memset select socket strchr +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +# Is this Solaris? +echo "$as_me:$LINENO: checking for Solaris" >&5 +echo $ECHO_N "checking for Solaris... $ECHO_C" >&6 +if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + +#if defined (__SVR4) && defined (__sun) + exit(0); +#else + exit(-1); +#endif + + ; + return 0; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_SOLARIS 1 +_ACEOF + + HAVE_SOLARIS=yes + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +# Is this BSDI? +echo "$as_me:$LINENO: checking for BSDI" >&5 +echo $ECHO_N "checking for BSDI... $ECHO_C" >&6 +if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + +#if defined (__bsdi__) + exit(0); +#else + exit(-1); +#endif + + ; + return 0; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_BSDI 1 +_ACEOF + + HAVE_BSDI=yes + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +# Is this NetBSD? +echo "$as_me:$LINENO: checking for NetBSD" >&5 +echo $ECHO_N "checking for NetBSD... $ECHO_C" >&6 +if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + +#if defined (__NetBSD__) + exit(0); +#else + exit(-1); +#endif + + ; + return 0; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_NETBSD 1 +_ACEOF + + HAVE_NETBSD=yes + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +# Is this MacOS X? +echo "$as_me:$LINENO: checking for MacOS X" >&5 +echo $ECHO_N "checking for MacOS X... $ECHO_C" >&6 +if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + +#if defined (__APPLE__) && defined (__MACH__) + exit(0); +#else + exit(-1); +#endif + + ; + return 0; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +@%:@define HAVE_MACOSX 1 +_ACEOF + + HAVE_MACOSX=yes + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +# Handle --enable-noselect-default +# Check whether --enable-noselect-default or --disable-noselect-default was given. +if test "${enable_noselect_default+set}" = set; then + enableval="$enable_noselect_default" + + NOSELECT_DEFAULT=$enable_noselect_default + +else + + if test "$HAVE_MACOSX" = "yes"; then + NOSELECT_DEFAULT=yes + elif test "$HAVE_BSDI" = "yes"; then + NOSELECT_DEFAULT=yes + elif test "$HAVE_NETBSD" = "yes"; then + NOSELECT_DEFAULT=yes + else + NOSELECT_DEFAULT=no + fi + +fi; +if test "$NOSELECT_DEFAULT" = "yes"; then + +cat >>confdefs.h <<\_ACEOF +@%:@define NOSELECT_DEFAULT 1 +_ACEOF + +fi + +# Handle --enable-track-default=IP|PORT +# Check whether --enable-track-default or --disable-track-default was given. +if test "${enable_track_default+set}" = set; then + enableval="$enable_track_default" + + if test "$enable_track_default" = "id" -o "$enable_track_default" = "ID"; then + TRACK_DEFAULT=id + elif test "$enable_track_default" = "port" -o "$enable_track_default" = "PORT"; then + TRACK_DEFAULT=port + else + { { echo "$as_me:$LINENO: error: valid arguments for --enable-track-default are PORT or ID" >&5 +echo "$as_me: error: valid arguments for --enable-track-default are PORT or ID" >&2;} + { (exit 1); exit 1; }; } + fi + +else + + if test "$HAVE_SOLARIS" = "yes"; then + TRACK_DEFAULT=port + else + TRACK_DEFAULT=id + fi + +fi; +if test "$TRACK_DEFAULT" = "port"; then + +cat >>confdefs.h <<\_ACEOF +@%:@define TRACK_PORT_DEFAULT 1 +_ACEOF + +fi + +# Handle --enable-default-port=N +# Check whether --enable-default-port or --disable-default-port was given. +if test "${enable_default_port+set}" = set; then + enableval="$enable_default_port" + + case $enable_default_port in + [0-9][0-9][0-9][0-9][0-9]|[0-9][0-9][0-9][0-9]|[0-9][0-9][0-9]|[0-9][0-9]|[0-9]) + DEFAULT_PORT=$enable_default_port + ;; + *) + echo "default port: $enable_default_port" + { { echo "$as_me:$LINENO: error: numeric argument required for --enable-default-port" >&5 +echo "$as_me: error: numeric argument required for --enable-default-port" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + +else + + DEFAULT_PORT=80 + +fi; + +cat >>confdefs.h <<_ACEOF +@%:@define DEFAULT_PORT $DEFAULT_PORT +_ACEOF + + +# If using gcc, --enable-static will compile staticly +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + + if test "$GCC" = yes ; then + CFLAGS="$CFLAGS -static" + else + { { echo "$as_me:$LINENO: error: Sorry, I only know how to compile staticly for gcc" >&5 +echo "$as_me: error: Sorry, I only know how to compile staticly for gcc" >&2;} + { (exit 1); exit 1; }; } + fi + +fi; + +echo "Target OS is $target_os" + + +cat >>confdefs.h <<_ACEOF +@%:@define TARGET "$target" +_ACEOF + +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 overriden 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, don't put newlines in cache variables' values. +# 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. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *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 \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + 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}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $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 +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# NLS nuisances. +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } + + +# Name of the executable. +as_me=`(basename "$0") 2>/dev/null || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + +# PATH needs CR, and LINENO needs CR and PATH. +# 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 + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conftest.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + 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 + + ;; + 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 + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="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="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX +@%:@@%:@ Running $as_me. @%:@@%:@ +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.53. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.53, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" + exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + + + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + 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 + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@target@,$target,;t t +s,@target_cpu@,$target_cpu,;t t +s,@target_vendor@,$target_vendor,;t t +s,@target_os@,$target_os,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || + mkdir "$as_incr_dir" || + { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +done; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # 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. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;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,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #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. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # egrep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # 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. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || + mkdir "$as_incr_dir" || + { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +done; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + default-1 ) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# 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=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || 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 || { (exit 1); exit 1; } +fi + diff --git a/autom4te.cache/requests b/autom4te.cache/requests new file mode 100644 index 0000000..ec9aee7 --- /dev/null +++ b/autom4te.cache/requests @@ -0,0 +1,94 @@ +# This file was created by autom4te. +# It contains the lists of macros which have been traced. +# It can be safely removed. + +@request = ( + bless( [ + '0', + 1, + [ + '/usr/share/autoconf' + ], + [ + '--reload-state=/usr/share/autoconf/autoconf/autoconf.m4f', + 'aclocal.m4', + 'configure.ac' + ], + { + 'AC_HEADER_STAT' => 1, + 'AC_FUNC_STRFTIME' => 1, + 'AC_PROG_RANLIB' => 1, + 'AC_FUNC_WAIT3' => 1, + 'AC_FUNC_SETPGRP' => 1, + 'AC_HEADER_TIME' => 1, + 'AC_FUNC_SETVBUF_REVERSED' => 1, + 'AC_HEADER_SYS_WAIT' => 1, + 'AC_TYPE_UID_T' => 1, + 'AM_CONDITIONAL' => 1, + 'AC_CHECK_LIB' => 1, + 'AC_PROG_LN_S' => 1, + 'AC_FUNC_MEMCMP' => 1, + 'AC_FUNC_FORK' => 1, + 'AC_FUNC_GETGROUPS' => 1, + 'AC_HEADER_MAJOR' => 1, + 'AC_FUNC_STRTOD' => 1, + 'AC_HEADER_DIRENT' => 1, + 'AC_FUNC_UTIME_NULL' => 1, + 'AC_CONFIG_FILES' => 1, + 'AC_FUNC_ALLOCA' => 1, + 'AC_C_CONST' => 1, + 'include' => 1, + 'AC_FUNC_OBSTACK' => 1, + 'AC_FUNC_LSTAT' => 1, + 'AC_STRUCT_TIMEZONE' => 1, + 'AC_FUNC_GETPGRP' => 1, + 'AC_DEFINE_TRACE_LITERAL' => 1, + 'AC_CHECK_HEADERS' => 1, + 'AC_TYPE_MODE_T' => 1, + 'AC_CHECK_TYPES' => 1, + 'AC_PROG_YACC' => 1, + 'AC_TYPE_PID_T' => 1, + 'AC_FUNC_STRERROR_R' => 1, + 'AC_STRUCT_ST_BLOCKS' => 1, + 'AC_PROG_GCC_TRADITIONAL' => 1, + 'AC_TYPE_SIGNAL' => 1, + 'AM_PROG_LIBTOOL' => 1, + 'AC_FUNC_FNMATCH' => 1, + 'AC_PROG_CPP' => 1, + 'AC_FUNC_STAT' => 1, + 'AC_PROG_INSTALL' => 1, + 'AM_GNU_GETTEXT' => 1, + 'AC_FUNC_STRCOLL' => 1, + 'AC_LIBSOURCE' => 1, + 'AC_C_INLINE' => 1, + 'AC_FUNC_CHOWN' => 1, + 'AC_PROG_LEX' => 1, + 'AH_OUTPUT' => 1, + 'AC_HEADER_STDC' => 1, + 'AC_FUNC_GETLOADAVG' => 1, + 'AC_CHECK_FUNCS' => 1, + 'AC_TYPE_SIZE_T' => 1, + 'AC_DECL_SYS_SIGLIST' => 1, + 'AC_FUNC_MKTIME' => 1, + 'AC_PROG_MAKE_SET' => 1, + 'AC_PROG_CXX' => 1, + 'm4_pattern_allow' => 1, + 'm4_include' => 1, + 'm4_pattern_forbid' => 1, + 'AC_PROG_AWK' => 1, + 'AC_FUNC_VPRINTF' => 1, + 'AC_CONFIG_HEADERS' => 1, + 'AC_PATH_X' => 1, + 'AC_TYPE_OFF_T' => 1, + 'AC_FUNC_MALLOC' => 1, + 'AC_FUNC_ERROR_AT_LINE' => 1, + 'AC_FUNC_FSEEKO' => 1, + 'AC_FUNC_MMAP' => 1, + 'AC_STRUCT_TM' => 1, + 'AC_SUBST' => 1, + 'AC_PROG_LIBTOOL' => 1, + 'AC_PROG_CC' => 1 + } + ], 'Request' ) + ); + diff --git a/autom4te.cache/traces.0 b/autom4te.cache/traces.0 new file mode 100644 index 0000000..795d4c6 --- /dev/null +++ b/autom4te.cache/traces.0 @@ -0,0 +1,278 @@ +m4trace:configure.ac:8: -1- m4_pattern_forbid([^_?A[CHUM]_]) +m4trace:configure.ac:8: -1- m4_pattern_forbid([_AC_]) +m4trace:configure.ac:8: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs. LIBOBJS']) +m4trace:configure.ac:8: -1- m4_pattern_allow([^AS_FLAGS$]) +m4trace:configure.ac:8: -1- m4_pattern_forbid([^_?m4_]) +m4trace:configure.ac:8: -1- m4_pattern_forbid([^dnl$]) +m4trace:configure.ac:8: -1- m4_pattern_forbid([^_?AS_]) +m4trace:configure.ac:8: -1- AC_SUBST([SHELL], [${CONFIG_SHELL-/bin/sh}]) +m4trace:configure.ac:8: -1- AC_SUBST([PATH_SEPARATOR]) +m4trace:configure.ac:8: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])]) +m4trace:configure.ac:8: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])]) +m4trace:configure.ac:8: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])]) +m4trace:configure.ac:8: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])]) +m4trace:configure.ac:8: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])]) +m4trace:configure.ac:8: -1- AC_SUBST([exec_prefix], [NONE]) +m4trace:configure.ac:8: -1- AC_SUBST([prefix], [NONE]) +m4trace:configure.ac:8: -1- AC_SUBST([program_transform_name], [s,x,x,]) +m4trace:configure.ac:8: -1- AC_SUBST([bindir], ['${exec_prefix}/bin']) +m4trace:configure.ac:8: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin']) +m4trace:configure.ac:8: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec']) +m4trace:configure.ac:8: -1- AC_SUBST([datadir], ['${prefix}/share']) +m4trace:configure.ac:8: -1- AC_SUBST([sysconfdir], ['${prefix}/etc']) +m4trace:configure.ac:8: -1- AC_SUBST([sharedstatedir], ['${prefix}/com']) +m4trace:configure.ac:8: -1- AC_SUBST([localstatedir], ['${prefix}/var']) +m4trace:configure.ac:8: -1- AC_SUBST([libdir], ['${exec_prefix}/lib']) +m4trace:configure.ac:8: -1- AC_SUBST([includedir], ['${prefix}/include']) +m4trace:configure.ac:8: -1- AC_SUBST([oldincludedir], ['/usr/include']) +m4trace:configure.ac:8: -1- AC_SUBST([infodir], ['${prefix}/info']) +m4trace:configure.ac:8: -1- AC_SUBST([mandir], ['${prefix}/man']) +m4trace:configure.ac:8: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME]) +m4trace:configure.ac:8: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */ +#undef PACKAGE_NAME]) +m4trace:configure.ac:8: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME]) +m4trace:configure.ac:8: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME]) +m4trace:configure.ac:8: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION]) +m4trace:configure.ac:8: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */ +#undef PACKAGE_VERSION]) +m4trace:configure.ac:8: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING]) +m4trace:configure.ac:8: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING]) +m4trace:configure.ac:8: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT]) +m4trace:configure.ac:8: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT]) +m4trace:configure.ac:8: -1- AC_SUBST([build_alias]) +m4trace:configure.ac:8: -1- AC_SUBST([host_alias]) +m4trace:configure.ac:8: -1- AC_SUBST([target_alias]) +m4trace:configure.ac:8: -1- AC_SUBST([DEFS]) +m4trace:configure.ac:8: -1- AC_SUBST([ECHO_C]) +m4trace:configure.ac:8: -1- AC_SUBST([ECHO_N]) +m4trace:configure.ac:8: -1- AC_SUBST([ECHO_T]) +m4trace:configure.ac:8: -1- AC_SUBST([LIBS]) +m4trace:configure.ac:9: -1- AC_SUBST([build], [$ac_cv_build]) +m4trace:configure.ac:9: -1- AC_SUBST([build_cpu], [`echo $ac_cv_build | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\1/'`]) +m4trace:configure.ac:9: -1- AC_SUBST([build_vendor], [`echo $ac_cv_build | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\2/'`]) +m4trace:configure.ac:9: -1- AC_SUBST([build_os], [`echo $ac_cv_build | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\3/'`]) +m4trace:configure.ac:9: -1- AC_SUBST([host], [$ac_cv_host]) +m4trace:configure.ac:9: -1- AC_SUBST([host_cpu], [`echo $ac_cv_host | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\1/'`]) +m4trace:configure.ac:9: -1- AC_SUBST([host_vendor], [`echo $ac_cv_host | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\2/'`]) +m4trace:configure.ac:9: -1- AC_SUBST([host_os], [`echo $ac_cv_host | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\3/'`]) +m4trace:configure.ac:9: -1- AC_SUBST([target], [$ac_cv_target]) +m4trace:configure.ac:9: -1- AC_SUBST([target_cpu], [`echo $ac_cv_target | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\1/'`]) +m4trace:configure.ac:9: -1- AC_SUBST([target_vendor], [`echo $ac_cv_target | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\2/'`]) +m4trace:configure.ac:9: -1- AC_SUBST([target_os], [`echo $ac_cv_target | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\3/'`]) +m4trace:configure.ac:10: -1- AC_PROG_INSTALL +m4trace:configure.ac:10: -1- AC_SUBST([INSTALL_PROGRAM]) +m4trace:configure.ac:10: -1- AC_SUBST([INSTALL_SCRIPT]) +m4trace:configure.ac:10: -1- AC_SUBST([INSTALL_DATA]) +m4trace:configure.ac:10: -1- AC_SUBST([PACKAGE]) +m4trace:configure.ac:10: -1- AC_SUBST([VERSION]) +m4trace:configure.ac:10: -2- AC_DEFINE_TRACE_LITERAL([PACKAGE]) +m4trace:configure.ac:10: -2- AH_OUTPUT([PACKAGE], [/* Name of package */ +#undef PACKAGE]) +m4trace:configure.ac:10: -2- AC_DEFINE_TRACE_LITERAL([VERSION]) +m4trace:configure.ac:10: -2- AH_OUTPUT([VERSION], [/* Version number of package */ +#undef VERSION]) +m4trace:configure.ac:10: -1- AC_SUBST([ACLOCAL]) +m4trace:configure.ac:10: -1- AC_SUBST([AUTOCONF]) +m4trace:configure.ac:10: -1- AC_SUBST([AUTOMAKE]) +m4trace:configure.ac:10: -1- AC_SUBST([AUTOHEADER]) +m4trace:configure.ac:10: -1- AC_SUBST([MAKEINFO]) +m4trace:configure.ac:10: -1- AC_PROG_MAKE_SET +m4trace:configure.ac:10: -1- AC_SUBST([SET_MAKE]) +m4trace:configure.ac:12: -1- AC_CONFIG_HEADERS([config.h]) +m4trace:configure.ac:15: -1- AC_PROG_CC +m4trace:configure.ac:15: -1- AC_SUBST([CC]) +m4trace:configure.ac:15: -1- AC_SUBST([CFLAGS]) +m4trace:configure.ac:15: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.ac:15: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.ac:15: -1- AC_SUBST([CC]) +m4trace:configure.ac:15: -1- AC_SUBST([ac_ct_CC]) +m4trace:configure.ac:15: -1- AC_SUBST([CC]) +m4trace:configure.ac:15: -1- AC_SUBST([ac_ct_CC]) +m4trace:configure.ac:15: -1- AC_SUBST([CC]) +m4trace:configure.ac:15: -1- AC_SUBST([CC]) +m4trace:configure.ac:15: -1- AC_SUBST([ac_ct_CC]) +m4trace:configure.ac:15: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext]) +m4trace:configure.ac:15: -1- AC_SUBST([OBJEXT], [$ac_cv_objext]) +m4trace:configure.ac:16: -1- AC_PROG_GCC_TRADITIONAL +m4trace:configure.ac:16: -1- AC_PROG_CPP +m4trace:configure.ac:16: -1- AC_SUBST([CPP]) +m4trace:configure.ac:16: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.ac:16: -1- AC_SUBST([CPP]) +m4trace:configure.ac:20: -1- AC_PROG_INSTALL +m4trace:configure.ac:20: -1- AC_SUBST([INSTALL_PROGRAM]) +m4trace:configure.ac:20: -1- AC_SUBST([INSTALL_SCRIPT]) +m4trace:configure.ac:20: -1- AC_SUBST([INSTALL_DATA]) +m4trace:configure.ac:23: -1- AC_CHECK_LIB([nsl], [gethostbyname]) +m4trace:configure.ac:23: -1- AH_OUTPUT([HAVE_LIBNSL], [/* Define to 1 if you have the \`nsl' library (-lnsl). */ +#undef HAVE_LIBNSL]) +m4trace:configure.ac:23: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBNSL]) +m4trace:configure.ac:24: -1- AC_CHECK_LIB([socket], [socket]) +m4trace:configure.ac:24: -1- AH_OUTPUT([HAVE_LIBSOCKET], [/* Define to 1 if you have the \`socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET]) +m4trace:configure.ac:24: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBSOCKET]) +m4trace:configure.ac:25: -1- AC_CHECK_LIB([inet], [connect]) +m4trace:configure.ac:25: -1- AH_OUTPUT([HAVE_LIBINET], [/* Define to 1 if you have the \`inet' library (-linet). */ +#undef HAVE_LIBINET]) +m4trace:configure.ac:25: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBINET]) +m4trace:configure.ac:26: -1- AC_CHECK_LIB([resolv], [inet_aton]) +m4trace:configure.ac:26: -1- AH_OUTPUT([HAVE_LIBRESOLV], [/* Define to 1 if you have the \`resolv' library (-lresolv). */ +#undef HAVE_LIBRESOLV]) +m4trace:configure.ac:26: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBRESOLV]) +m4trace:configure.ac:83: -1- AC_CHECK_LIB([pcap], [pcap_open_live], [], [AC_MSG_ERROR([cannot find libpcap])]) +m4trace:configure.ac:83: -1- AH_OUTPUT([HAVE_LIBPCAP], [/* Define to 1 if you have the \`pcap' library (-lpcap). */ +#undef HAVE_LIBPCAP]) +m4trace:configure.ac:83: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBPCAP]) +m4trace:configure.ac:94: -1- AC_CHECK_LIB([net], [main], [], [AC_MSG_ERROR([cannot find libnet])]) +m4trace:configure.ac:94: -1- AH_OUTPUT([HAVE_LIBNET], [/* Define to 1 if you have the \`net' library (-lnet). */ +#undef HAVE_LIBNET]) +m4trace:configure.ac:94: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBNET]) +m4trace:configure.ac:109: -1- AC_CHECK_LIB([net], [libnet_init_packet], [ + AC_DEFINE(LIBNET_API_VERSION, 100, [libnet API version]) + AC_MSG_NOTICE([libnet version: < 1.1.0]) + CPPFLAGS="$CPPFLAGS `$LIBNET_CONFIG --defines`" + CPPFLAGS="$CPPFLAGS `$LIBNET_CONFIG --cflags`" + ], [ + AC_CHECK_LIB(net, libnet_init, + [ + AC_DEFINE(LIBNET_API_VERSION, 110, [libnet API version]) + AC_MSG_NOTICE([libnet version: >= 1.1.0]) + ], [ + AC_MSG_ERROR([could not identify the version of libnet]) + ]) + ]) +m4trace:configure.ac:109: -1- AC_DEFINE_TRACE_LITERAL([LIBNET_API_VERSION]) +m4trace:configure.ac:109: -1- AH_OUTPUT([LIBNET_API_VERSION], [/* libnet API version */ +#undef LIBNET_API_VERSION]) +m4trace:configure.ac:109: -1- AC_CHECK_LIB([net], [libnet_init], [ + AC_DEFINE(LIBNET_API_VERSION, 110, [libnet API version]) + AC_MSG_NOTICE([libnet version: >= 1.1.0]) + ], [ + AC_MSG_ERROR([could not identify the version of libnet]) + ]) +m4trace:configure.ac:109: -1- AC_DEFINE_TRACE_LITERAL([LIBNET_API_VERSION]) +m4trace:configure.ac:109: -1- AH_OUTPUT([LIBNET_API_VERSION], [/* libnet API version */ +#undef LIBNET_API_VERSION]) +m4trace:configure.ac:112: -1- AC_HEADER_STDC +m4trace:configure.ac:112: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS]) +m4trace:configure.ac:112: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS]) +m4trace:configure.ac:113: -1- AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h unistd.h]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_ARPA_INET_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_FCNTL_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_NETDB_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_NETINET_IN_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_SYS_IOCTL_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_SYS_SOCKET_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H]) +m4trace:configure.ac:113: -1- AC_CHECK_HEADERS([sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h], [], [], [$ac_includes_default]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H]) +m4trace:configure.ac:113: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H]) +m4trace:configure.ac:116: -1- AC_HEADER_TIME +m4trace:configure.ac:116: -1- AC_DEFINE_TRACE_LITERAL([TIME_WITH_SYS_TIME]) +m4trace:configure.ac:116: -1- AH_OUTPUT([TIME_WITH_SYS_TIME], [/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME]) +m4trace:configure.ac:132: -1- AC_DEFINE_TRACE_LITERAL([HAVE_SOCKADDR_SA_LEN]) +m4trace:configure.ac:132: -1- AH_OUTPUT([HAVE_SOCKADDR_SA_LEN], [/* Has socket.sa_len */ +#undef HAVE_SOCKADDR_SA_LEN]) +m4trace:configure.ac:138: -1- AC_DEFINE_TRACE_LITERAL([HAVE_SOCKADDR_SA_LEN]) +m4trace:configure.ac:138: -1- AH_OUTPUT([HAVE_SOCKADDR_SA_LEN], [/* Has socket.sa_len */ +#undef HAVE_SOCKADDR_SA_LEN]) +m4trace:configure.ac:141: -1- AC_FUNC_MALLOC +m4trace:configure.ac:141: -1- AC_CHECK_HEADERS([stdlib.h]) +m4trace:configure.ac:141: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H]) +m4trace:configure.ac:141: -1- AC_DEFINE_TRACE_LITERAL([HAVE_MALLOC]) +m4trace:configure.ac:141: -1- AH_OUTPUT([HAVE_MALLOC], [/* Define to 1 if your system has a working \`malloc' function. */ +#undef HAVE_MALLOC]) +m4trace:configure.ac:145: -1- AC_CHECK_HEADERS([sys/select.h sys/socket.h]) +m4trace:configure.ac:145: -1- AH_OUTPUT([HAVE_SYS_SELECT_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H]) +m4trace:configure.ac:145: -1- AH_OUTPUT([HAVE_SYS_SOCKET_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H]) +m4trace:configure.ac:145: -1- AC_DEFINE_TRACE_LITERAL([SELECT_TYPE_ARG1]) +m4trace:configure.ac:145: -1- AH_OUTPUT([SELECT_TYPE_ARG1], [/* Define to the type of arg 1 for \`select'. */ +#undef SELECT_TYPE_ARG1]) +m4trace:configure.ac:145: -1- AC_DEFINE_TRACE_LITERAL([SELECT_TYPE_ARG234]) +m4trace:configure.ac:145: -1- AH_OUTPUT([SELECT_TYPE_ARG234], [/* Define to the type of args 2, 3 and 4 for \`select'. */ +#undef SELECT_TYPE_ARG234]) +m4trace:configure.ac:145: -1- AC_DEFINE_TRACE_LITERAL([SELECT_TYPE_ARG5]) +m4trace:configure.ac:145: -1- AH_OUTPUT([SELECT_TYPE_ARG5], [/* Define to the type of arg 5 for \`select'. */ +#undef SELECT_TYPE_ARG5]) +m4trace:configure.ac:146: -1- AC_FUNC_VPRINTF +m4trace:configure.ac:146: -1- AC_CHECK_FUNCS([vprintf], [ +AC_CHECK_FUNC(_doprnt, + [AC_DEFINE(HAVE_DOPRNT, 1, + [Define to 1 if you don't have `vprintf' but do have + `_doprnt.'])])]) +m4trace:configure.ac:146: -1- AH_OUTPUT([HAVE_VPRINTF], [/* Define to 1 if you have the \`vprintf' function. */ +#undef HAVE_VPRINTF]) +m4trace:configure.ac:146: -1- AC_DEFINE_TRACE_LITERAL([HAVE_DOPRNT]) +m4trace:configure.ac:146: -1- AH_OUTPUT([HAVE_DOPRNT], [/* Define to 1 if you don't have \`vprintf' but do have \`_doprnt.' */ +#undef HAVE_DOPRNT]) +m4trace:configure.ac:147: -1- AC_CHECK_FUNCS([gettimeofday memset select socket strchr]) +m4trace:configure.ac:147: -1- AH_OUTPUT([HAVE_GETTIMEOFDAY], [/* Define to 1 if you have the \`gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY]) +m4trace:configure.ac:147: -1- AH_OUTPUT([HAVE_MEMSET], [/* Define to 1 if you have the \`memset' function. */ +#undef HAVE_MEMSET]) +m4trace:configure.ac:147: -1- AH_OUTPUT([HAVE_SELECT], [/* Define to 1 if you have the \`select' function. */ +#undef HAVE_SELECT]) +m4trace:configure.ac:147: -1- AH_OUTPUT([HAVE_SOCKET], [/* Define to 1 if you have the \`socket' function. */ +#undef HAVE_SOCKET]) +m4trace:configure.ac:147: -1- AH_OUTPUT([HAVE_STRCHR], [/* Define to 1 if you have the \`strchr' function. */ +#undef HAVE_STRCHR]) +m4trace:configure.ac:164: -1- AC_DEFINE_TRACE_LITERAL([HAVE_SOLARIS]) +m4trace:configure.ac:164: -1- AH_OUTPUT([HAVE_SOLARIS], [/* Is this a Solaris system? */ +#undef HAVE_SOLARIS]) +m4trace:configure.ac:181: -1- AC_DEFINE_TRACE_LITERAL([HAVE_BSDI]) +m4trace:configure.ac:181: -1- AH_OUTPUT([HAVE_BSDI], [/* Is this a BSDI system? */ +#undef HAVE_BSDI]) +m4trace:configure.ac:198: -1- AC_DEFINE_TRACE_LITERAL([HAVE_NETBSD]) +m4trace:configure.ac:198: -1- AH_OUTPUT([HAVE_NETBSD], [/* Is this a NetBSD system? */ +#undef HAVE_NETBSD]) +m4trace:configure.ac:215: -1- AC_DEFINE_TRACE_LITERAL([HAVE_MACOSX]) +m4trace:configure.ac:215: -1- AH_OUTPUT([HAVE_MACOSX], [/* Is this a MacOS X system? */ +#undef HAVE_MACOSX]) +m4trace:configure.ac:234: -1- AC_DEFINE_TRACE_LITERAL([NOSELECT_DEFAULT]) +m4trace:configure.ac:234: -1- AH_OUTPUT([NOSELECT_DEFAULT], [/* Use select(2) by default? */ +#undef NOSELECT_DEFAULT]) +m4trace:configure.ac:256: -1- AC_DEFINE_TRACE_LITERAL([TRACK_PORT_DEFAULT]) +m4trace:configure.ac:256: -1- AH_OUTPUT([TRACK_PORT_DEFAULT], [/* Track ports by default */ +#undef TRACK_PORT_DEFAULT]) +m4trace:configure.ac:275: -1- AC_DEFINE_TRACE_LITERAL([DEFAULT_PORT]) +m4trace:configure.ac:275: -1- AH_OUTPUT([DEFAULT_PORT], [/* Default destination port */ +#undef DEFAULT_PORT]) +m4trace:configure.ac:290: -1- AC_DEFINE_TRACE_LITERAL([TARGET]) +m4trace:configure.ac:290: -1- AH_OUTPUT([TARGET], [/* Target platform */ +#undef TARGET]) +m4trace:configure.ac:291: -1- AC_CONFIG_FILES([Makefile]) diff --git a/capture.c b/capture.c new file mode 100644 index 0000000..562e774 --- /dev/null +++ b/capture.c @@ -0,0 +1,472 @@ +/* -*- Mode: c; tab-width: 4; indent-tabs-mode: 1; c-basic-offset: 4; -*- */ +/* vim:set ts=4 sw=4 ai nobackup nocindent sm: */ + +/* + * tcptraceroute -- A traceroute implementation using TCP packets + * Copyright (c) 2001-2005 Michael C. Toren + * + * 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. + * + * A copy of the GNU GPL is available as /usr/doc/copyright/GPL on Debian + * systems, or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html + * You can also obtain it by writing to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "tcptraceroute.h" + +pcap_t *pcap; +int pcap_fd; + +/* + * Open the pcap listening device and apply our filter. + */ + +void initcapture(void) +{ + struct bpf_program fcode; + bpf_u_int32 localnet, netmask; + + if (! (pcap = pcap_open_live(device, offset + SNAPLEN, 0, 10, errbuf))) + fatal("pcap_open_live failed: %s", errbuf); + + safe_snprintf(filter, TEXTSIZE, "\n\ + (tcp and src host %s and src port %d and dst host %s)\n\ + or ((icmp[0] == 11 or icmp[0] == 3) and dst host %s)", + iptos(dst_ip), dst_prt, iptos(src_ip), iptos(src_ip)); + + if (o_nofilter) + filter[0] = '\0'; + + debug("pcap filter is: %s\n", o_nofilter ? "(nothing)" : filter); + + if (pcap_lookupnet(device, &localnet, &netmask, errbuf) < 0) + { + warn("pcap_lookupnet failed: %s\n", errbuf); + localnet = 0; + netmask = 0; + } + + if (pcap_compile(pcap, &fcode, filter, 1, netmask) < 0) + fatal("filter compile failed: %s", pcap_geterr(pcap)); + + if (pcap_setfilter(pcap, &fcode) < 0) + fatal("pcap_setfilter failed\n"); + + pcap_fd = pcap_fileno(pcap); + if (fcntl(pcap_fd, F_SETFL, O_NONBLOCK) < 0) + pfatal("fcntl(F_SETFL, O_NONBLOCK) failed"); + + pcap_freecode(&fcode); +} + +/* + * Horrible macro kludge only to be called from capture(), for architectures + * such as sparc that don't permit non-aligned memory access. The idea is to + * malloc new space (which is guaranteed to be properly aligned), copy the + * packet we want to parse there, then cast the packet header struct against + * the new, aligned space. + */ + +#define ALIGN_PACKET(dest, cast, offset) do { \ + static u_char *buf; \ + if (buf == NULL) buf = xrealloc(NULL, SNAPLEN - (offset)); \ + memcpy(buf, packet + (offset), len - (offset)); \ + dest = (struct cast *)buf; \ + } while (0) /* no semi-colon */ + +/* + * Listens for responses to our probe matching the specified proberecord + * structure. Returns 1 if the destination was reached, or 0 if we need + * to increment the TTL some more. + */ + +int capture(proberecord *record) +{ + u_char *packet; + struct pcap_pkthdr packet_hdr; + struct libnet_ipv4_hdr *ip_hdr; + struct timeval start, now, timepassed, timeout_tv, timeleft; + int firstpass, ret, len; + double delta; + fd_set sfd; + + firstpass = 1; + timeout_tv.tv_sec = o_timeout; + timeout_tv.tv_usec = 0; + + if (gettimeofday(&start, NULL) < 0) + pfatal("gettimeofday"); + + for(;;) + { + if (firstpass) + { + firstpass = 0; + timeleft = timeout_tv; + } + else + { + if (gettimeofday(&now, NULL) < 0) + pfatal("gettimeofday"); + + timepassed = tvdiff(&now, &start); + + if (tvsign(&timepassed) < 0) + { + /* Deal with weird clock skew */ + timepassed.tv_sec = 0; + timepassed.tv_usec = 0; + } + + timeleft = tvdiff(&timeout_tv, &timepassed); + + if (tvsign(&timeleft) <= 0) + { + debug("timeout\n"); + return 0; + } + } + + /* + * The libpcap documentation is wrong; pcap_fileno actually + * returns the fd of the live capture device, not the save + * file. References: + * + * http://www.tcpdump.org/lists/workers/2001/01/msg00223.html + * http://www.tcpdump.org/lists/workers/2001/03/msg00107.html + * http://www.tcpdump.org/lists/workers/2001/03/msg00109.html + * http://www.tcpdump.org/lists/workers/2001/03/msg00110.html + */ + + FD_ZERO(&sfd); + FD_SET(pcap_fd, &sfd); + + ret = o_noselect ? 1 : select(pcap_fd + 1, &sfd, NULL, NULL, &timeleft); + + if (ret < 0) + { + fatal("select"); + } + else if (ret == 0) + { + debug("select() timeout\n"); + continue; + } + + if ((packet = (u_char *)pcap_next(pcap, &packet_hdr)) == NULL) + { + debug("null pointer from pcap_next()\n"); + continue; + } + + packet += offset; + len = packet_hdr.caplen - offset; + + debug("received %d byte IP packet from pcap_next()\n", len); + + if (len < LIBNET_IPV4_H) + { + debug("Ignoring partial IP packet\n"); + continue; + } + + if (len > SNAPLEN) + { + debug("Packet received is larger than our snaplen? Ignoring\n", SNAPLEN); + continue; + } + + ALIGN_PACKET(ip_hdr, libnet_ipv4_hdr, 0); + + if (ip_hdr->ip_v != 4) + { + debug("Ignoring non-IPv4 packet\n"); + continue; + } + + if (ip_hdr->ip_hl > 5) + { + debug("Ignoring IP packet with IP options\n"); + continue; + } + + if (ip_hdr->ip_dst.s_addr != src_ip) + { + debug("Ignoring IP packet not addressed to us (%s, not %s)\n", + iptos(ip_hdr->ip_dst.s_addr), iptos(src_ip)); + continue; + } + + delta = (double)(packet_hdr.ts.tv_sec - record->timestamp.tv_sec) * 1000 + + (double)(packet_hdr.ts.tv_usec - record->timestamp.tv_usec) / 1000; + + if (ip_hdr->ip_p == IPPROTO_ICMP) + { + struct libnet_icmpv4_hdr *icmp_hdr; + struct libnet_ipv4_hdr *old_ip_hdr; + struct libnet_tcp_hdr *old_tcp_hdr; + + if (len < LIBNET_IPV4_H + LIBNET_ICMPV4_H + 4) + { + debug("Ignoring partial ICMP packet\n"); + continue; + } + + ALIGN_PACKET(icmp_hdr, libnet_icmpv4_hdr, 0 + LIBNET_IPV4_H); + debug("Received ICMP packet\n"); + + /* + * The IP header, plus eight bytes of it's payload that generated + * the ICMP packet is quoted here, prepended with four bytes of + * padding. + */ + + if (len < LIBNET_IPV4_H + LIBNET_ICMPV4_H + 4 + LIBNET_IPV4_H + 8) + { + debug("Ignoring ICMP with incomplete payload\n"); + continue; + } + + ALIGN_PACKET(old_ip_hdr, libnet_ipv4_hdr, + 0 + LIBNET_IPV4_H + LIBNET_ICMPV4_H + 4); + + /* + * The entire TCP header isn't here, but the source port, + * destination port, and sequence number fields are. + */ + + ALIGN_PACKET(old_tcp_hdr, libnet_tcp_hdr, + 0 + LIBNET_IPV4_H + LIBNET_ICMPV4_H + 4 + LIBNET_IPV4_H); + + if (old_ip_hdr->ip_v != 4) + { + debug("Ignoring ICMP which quotes a non-IPv4 packet\n"); + continue; + } + + if (old_ip_hdr->ip_hl > 5) + { + debug("Ignoring ICMP which quotes an IP packet with IP options\n"); + continue; + } + + if (old_ip_hdr->ip_src.s_addr != src_ip) + { + debug("Ignoring ICMP with incorrect quoted source (%s, not %s)\n", + iptos(old_ip_hdr->ip_src.s_addr), iptos(src_ip)); + continue; + } + + /* These are not the droids you are looking for */ + if (old_ip_hdr->ip_p != IPPROTO_TCP) + { + debug("Ignoring ICMP which doesn't quote a TCP header\n"); + continue; + } + + /* We are free to go about our business */ + if (! o_trackport && (ntohs(old_ip_hdr->ip_id) != record->id)) + { + debug("Ignoring ICMP which doesn't contain the IPID we sent\n"); + continue; + } + + /* Move along, move along */ + if (ntohs(old_tcp_hdr->th_sport) != record->src_prt) + { + debug("Ignoring ICMP which doesn't quote the correct TCP source port\n"); + continue; + } + + if (ntohs(old_tcp_hdr->th_dport) != dst_prt) + { + /* Very strict checking, no DNAT detection */ + if (o_dnat < 0) + { + debug("Ignoring ICMP which doesn't quote the correct TCP destination port\n"); + continue; + } + + /* DNAT detection */ + if (o_dnat > 0) + record->dnat_dport = old_tcp_hdr->th_dport; + } + + if (icmp_hdr->icmp_type == ICMP_UNREACH) + { + char s[TEXTSIZE]; + + switch(icmp_hdr->icmp_code) + { + case ICMP_UNREACH_NET: + safe_strncpy(s, "!N", TEXTSIZE); break; + + case ICMP_UNREACH_HOST: + safe_strncpy(s, "!H", TEXTSIZE); break; + + case ICMP_UNREACH_PROTOCOL: + safe_strncpy(s, "!P", TEXTSIZE); break; + + case ICMP_UNREACH_PORT: + safe_strncpy(s, "!p", TEXTSIZE); break; + + case ICMP_UNREACH_NEEDFRAG: + safe_strncpy(s, "!F", TEXTSIZE); break; + + case ICMP_UNREACH_SRCFAIL: + safe_strncpy(s, "!S", TEXTSIZE); break; + + case ICMP_UNREACH_NET_PROHIB: + case ICMP_UNREACH_FILTER_PROHIB: + safe_strncpy(s, "!A", TEXTSIZE); break; + + case ICMP_UNREACH_HOST_PROHIB: + safe_strncpy(s, "!C", TEXTSIZE); break; + + case ICMP_UNREACH_NET_UNKNOWN: + case ICMP_UNREACH_HOST_UNKNOWN: + safe_strncpy(s, "!U", TEXTSIZE); break; + + case ICMP_UNREACH_ISOLATED: + safe_strncpy(s, "!I", TEXTSIZE); break; + + case ICMP_UNREACH_TOSNET: + case ICMP_UNREACH_TOSHOST: + safe_strncpy(s, "!T", TEXTSIZE); break; + + case ICMP_UNREACH_HOST_PRECEDENCE: + case ICMP_UNREACH_PRECEDENCE_CUTOFF: + default: + safe_snprintf(s, TEXTSIZE, "!<%d>", icmp_hdr->icmp_code); + } + + record->delta = delta; + record->addr = ip_hdr->ip_src.s_addr; + safe_snprintf(record->string, TEXTSIZE, "%%.3f ms %s", s); + return 1; + } + + if (icmp_hdr->icmp_type == ICMP_TIMXCEED) + { + /* If all of the fields of the IP, ICMP, quoted IP, and + * quoted IP payload are consistent with the probe packet we + * sent, yet the quoted destination address is different than + * the address we're trying to reach, it's likely the + * preceding hop was performing DNAT. + */ + + if (old_ip_hdr->ip_dst.s_addr != dst_ip) + { + /* Very strict checking, no DNAT detection */ + if (o_dnat < 0) + { + debug("Ignoring ICMP with incorrect quoted destination (%s, not %s)\n", + iptos(old_ip_hdr->ip_dst.s_addr), iptos(dst_ip)); + continue; + } + + /* DNAT detection */ + if (o_dnat > 0) + record->dnat_ip = old_ip_hdr->ip_dst.s_addr; + } + + record->delta = delta; + record->addr = ip_hdr->ip_src.s_addr; + safe_strncpy(record->string, "%.3f ms", TEXTSIZE); + return 0; + } + + if (icmp_hdr->icmp_type != ICMP_TIMXCEED && + icmp_hdr->icmp_type != ICMP_UNREACH) + { + record->delta = delta; + record->addr = ip_hdr->ip_src.s_addr; + safe_strncpy(record->string, "%.3f ms -- Unexpected ICMP", TEXTSIZE); + return 0; + } + + fatal("Something bad happened\n"); + } + + if (ip_hdr->ip_p == IPPROTO_TCP) + { + struct libnet_tcp_hdr *tcp_hdr; + debug("Received TCP packet\n"); + + if (ip_hdr->ip_src.s_addr != dst_ip) + { + debug("Ignoring TCP from source (%s) different than target (%s)\n", + iptos(ip_hdr->ip_src.s_addr), iptos(dst_ip)); + continue; + } + + if (len < LIBNET_IPV4_H + LIBNET_TCP_H) + { + debug("Ignoring partial TCP packet\n"); + continue; + } + + ALIGN_PACKET(tcp_hdr, libnet_tcp_hdr, 0 + LIBNET_IPV4_H); + + debug("Received TCP packet %s:%d -> %s:%d, flags %s%s%s%s%s%s%s%s%s\n", + iptos(ip_hdr->ip_src.s_addr), ntohs(tcp_hdr->th_sport), + iptos(ip_hdr->ip_dst.s_addr), ntohs(tcp_hdr->th_dport), + tcp_hdr->th_flags & TH_RST ? "RST " : "", + tcp_hdr->th_flags & TH_SYN ? "SYN " : "", + tcp_hdr->th_flags & TH_ACK ? "ACK " : "", + tcp_hdr->th_flags & TH_PUSH ? "PSH " : "", + tcp_hdr->th_flags & TH_FIN ? "FIN " : "", + tcp_hdr->th_flags & TH_URG ? "URG " : "", + tcp_hdr->th_flags & TH_CWR ? "CWR " : "", + tcp_hdr->th_flags & TH_ECN ? "ECN " : "", + tcp_hdr->th_flags ? "" : "(none)"); + + if ((ntohs(tcp_hdr->th_sport) != dst_prt) + || (ntohs(tcp_hdr->th_dport) != record->src_prt)) + { + debug("Ignoring TCP which doesn't match the correct port numbers\n"); + continue; + } + + if (tcp_hdr->th_flags & TH_RST) + safe_strncpy(record->state, "closed", TEXTSIZE); + + else if ((tcp_hdr->th_flags & TH_SYN) + && (tcp_hdr->th_flags & TH_ACK) + && (tcp_hdr->th_flags & TH_ECN)) + safe_strncpy(record->state, "open, ecn", TEXTSIZE); + + else if ((tcp_hdr->th_flags & TH_SYN) + && (tcp_hdr->th_flags & TH_ACK)) + safe_strncpy(record->state, "open", TEXTSIZE); + + else + safe_snprintf(record->state, TEXTSIZE, "unknown,%s%s%s%s%s%s%s%s%s", + tcp_hdr->th_flags & TH_RST ? " RST" : "", + tcp_hdr->th_flags & TH_SYN ? " SYN" : "", + tcp_hdr->th_flags & TH_ACK ? " ACK" : "", + tcp_hdr->th_flags & TH_PUSH ? " PSH" : "", + tcp_hdr->th_flags & TH_FIN ? " FIN" : "", + tcp_hdr->th_flags & TH_URG ? " URG" : "", + tcp_hdr->th_flags & TH_CWR ? " CWR" : "", + tcp_hdr->th_flags & TH_ECN ? " ECN" : "", + tcp_hdr->th_flags ? "" : " no flags"); + + record->delta = delta; + record->addr = ip_hdr->ip_src.s_addr; + safe_strncpy(record->string, "%.3f ms", TEXTSIZE); + return 1; + } + + debug("Ignoring non-ICMP and non-TCP packet\n"); + continue; + } +} diff --git a/capture.h b/capture.h new file mode 100644 index 0000000..54612a7 --- /dev/null +++ b/capture.h @@ -0,0 +1,40 @@ +/* -*- Mode: c; tab-width: 4; indent-tabs-mode: 1; c-basic-offset: 4; -*- */ +/* vim:set ts=4 sw=4 ai nobackup nocindent sm: */ + +/* + * tcptraceroute -- A traceroute implementation using TCP packets + * Copyright (c) 2001-2005 Michael C. Toren + * + * 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. + * + * A copy of the GNU GPL is available as /usr/doc/copyright/GPL on Debian + * systems, or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html + * You can also obtain it by writing to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +extern char pcap_version[]; + +extern pcap_t *pcap; +extern int pcap_fd; + +/* + * How many bytes should we examine on every packet that comes off the + * wire? This doesn't include the link layer which is accounted for + * later. We're looking only for ICMP and TCP packets, so this should + * work. For ICMP, we also examine the quoted IP header, which is why + * there's a *2 there. The +32 is just to be safe. + */ + +#define SNAPLEN (LIBNET_IPV4_H * 2 + \ + (LIBNET_TCP_H > LIBNET_ICMPV4_H ? LIBNET_TCP_H : LIBNET_ICMPV4_H) + 32) + +void initcapture(void); +int capture(proberecord *); diff --git a/config.h.in b/config.h.in index 400da6e..0a9dc4e 100644 --- a/config.h.in +++ b/config.h.in @@ -6,6 +6,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H +/* Is this a BSDI system? */ +#undef HAVE_BSDI + /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT @@ -39,8 +42,7 @@ /* Is this a MacOS X system? */ #undef HAVE_MACOSX -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ +/* Define to 1 if your system has a working `malloc' function. */ #undef HAVE_MALLOC /* Define to 1 if you have the header file. */ @@ -49,6 +51,9 @@ /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET +/* Is this a NetBSD system? */ +#undef HAVE_NETBSD + /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H @@ -150,6 +155,3 @@ /* Version number of package */ #undef VERSION - -/* Define to rpl_malloc if the replacement function should be used. */ -#undef malloc diff --git a/configure b/configure index 7b6eb61..6a13ce2 100755 --- a/configure +++ b/configure @@ -1,11 +1,19 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57. +# Generated by GNU Autoconf 2.53. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + + ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## @@ -14,13 +22,11 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +# NLS nuisances. # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset @@ -28,42 +34,34 @@ else as_unset=false fi - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; 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 +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } # Name of the executable. -as_me=`$as_basename "$0" || +as_me=`(basename "$0") 2>/dev/null || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ @@ -74,7 +72,6 @@ echo X/"$0" | /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` - # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' @@ -85,15 +82,15 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + echo "#! /bin/sh" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi - rm -f conf$$.sh + rm -f conftest.sh fi @@ -141,8 +138,6 @@ do as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} @@ -215,12 +210,6 @@ else fi rm -f conf$$ conf$$.exe conf$$.file -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - as_mkdir_p=false -fi - as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. @@ -237,7 +226,7 @@ as_nl=' IFS=" $as_nl" # CDPATH. -$as_unset CDPATH +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } # Name of the host. @@ -251,7 +240,6 @@ exec 6>&1 # Initializations. # ac_default_prefix=/usr/local -ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= @@ -271,7 +259,7 @@ PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="tcptraceroute" -ac_unique_file="tcptraceroute.c" +ac_unique_file="main.c" # Factoring default headers for most tests. ac_includes_default="\ #include @@ -309,8 +297,6 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP LIBOBJS LTLIBOBJS' -ac_subst_files='' # Initialize some variables set by options. ac_init_help= @@ -734,9 +720,6 @@ if test ! -r $srcdir/$ac_unique_file; then { (exit 1); exit 1; }; } fi fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias @@ -860,6 +843,7 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-libpcap=DIR use libpcap in DIR --with-libnet=DIR use libnet in DIR @@ -911,7 +895,7 @@ esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` @@ -951,7 +935,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.57. Invocation command line was +generated by GNU Autoconf 2.53. Invocation command line was $ $0 $@ @@ -1003,54 +987,27 @@ _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_sep= -ac_must_keep_next=false -for ac_pass in 1 2 +for ac_arg 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=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - esac - done + case $ac_arg in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n ) continue ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + esac + # Get rid of the leading space. done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there @@ -1061,7 +1018,6 @@ trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo - cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## @@ -1084,35 +1040,6 @@ _ASBOX esac; } echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## @@ -1120,7 +1047,7 @@ _ASBOX ## ----------- ## _ASBOX echo - sed "/^$/d" confdefs.h | sort + sed "/^$/d" confdefs.h echo fi test "$ac_signal" != 0 && @@ -1277,7 +1204,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu - ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -1520,15 +1446,15 @@ _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed -echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: - @echo 'ac_maketemp="$(MAKE)"' + @echo 'ac_maketemp="${MAKE}"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` @@ -1650,9 +1576,9 @@ fi - ac_config_headers="$ac_config_headers config.h" +ac_config_headers="$ac_config_headers config.h" - ac_config_commands="$ac_config_commands default-1" +ac_config_commands="$ac_config_commands default-1" # Checks for programs. @@ -1860,7 +1786,9 @@ if test $ac_prog_rejected = yes; then # 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+' '}$@" + set dummy "$as_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" fi fi fi @@ -1965,10 +1893,8 @@ fi fi -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. @@ -1993,12 +1919,14 @@ ac_compiler=`set X $ac_compile; echo $2` cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -2008,7 +1936,7 @@ main () } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" +ac_clean_files="$ac_clean_files a.out a.exe" # 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. @@ -2027,39 +1955,26 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -do - test -f "$ac_file" || continue +for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; - * ) - break;; + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb | *.xSYM ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; esac done else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} +cat conftest.$ac_ext >&5 +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} { (exit 77); exit 77; }; } fi @@ -2086,11 +2001,9 @@ if test "$cross_compiling" != yes; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 +If you meant to cross compile, use \`--host'." >&5 echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} +If you meant to cross compile, use \`--host'." >&2;} { (exit 1); exit 1; }; } fi fi @@ -2098,7 +2011,7 @@ fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 -rm -f a.out a.exe conftest$ac_cv_exeext b.out +rm -f a.out a.exe conftest$ac_cv_exeext ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. @@ -2118,10 +2031,9 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 # 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 +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; @@ -2129,10 +2041,8 @@ for ac_file in conftest.exe conftest conftest.*; do esac done else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;} { (exit 1); exit 1; }; } fi @@ -2150,12 +2060,14 @@ if test "${ac_cv_objext+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -2172,19 +2084,16 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} +cat conftest.$ac_ext >&5 +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;} { (exit 1); exit 1; }; } fi @@ -2201,12 +2110,14 @@ if test "${ac_cv_c_compiler_gnu+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -2233,8 +2144,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -2254,12 +2164,14 @@ if test "${ac_cv_prog_cc_g+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -2283,8 +2195,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -2306,102 +2217,6 @@ else CFLAGS= fi fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} -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 -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide @@ -2424,7 +2239,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ - '' \ + ''\ + '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ @@ -2433,13 +2249,15 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration +#include "confdefs.h" #include +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -2463,19 +2281,20 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 : else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" $ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -2499,8 +2318,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 break else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done @@ -2513,8 +2331,7 @@ fi else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c @@ -2547,28 +2364,18 @@ for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif +#include "confdefs.h" +#include Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -2585,8 +2392,7 @@ if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - + cat conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi @@ -2596,17 +2402,13 @@ rm -f conftest.err conftest.$ac_ext # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -2624,8 +2426,7 @@ if test -z "$ac_cpp_err"; then continue else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - + cat conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break @@ -2654,28 +2455,18 @@ for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif +#include "confdefs.h" +#include Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -2692,8 +2483,7 @@ if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - + cat conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi @@ -2703,17 +2493,13 @@ rm -f conftest.err conftest.$ac_ext # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -2731,8 +2517,7 @@ if test -z "$ac_cpp_err"; then continue else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - + cat conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break @@ -2745,10 +2530,8 @@ rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } fi @@ -2759,21 +2542,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - if test $ac_cv_c_compiler_gnu = yes; then echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 @@ -2783,16 +2551,12 @@ else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then + egrep "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no @@ -2803,16 +2567,12 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then + egrep "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes fi rm -f conftest* @@ -2908,6 +2668,73 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Checks for libraries. +echo "$as_me:$LINENO: checking for gethostbyname" >&5 +echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* 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_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +f = gethostbyname; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 +if test $ac_cv_func_gethostbyname = yes; then + : +else echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 @@ -2918,11 +2745,7 @@ else LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -2931,6 +2754,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -2954,8 +2783,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_cv_lib_nsl_gethostbyname=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 ac_cv_lib_nsl_gethostbyname=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext @@ -2972,22 +2800,19 @@ _ACEOF fi +fi -echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 -echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6 -if test "${ac_cv_lib_socket_socket+set}" = set; then +echo "$as_me:$LINENO: checking for socket" >&5 +echo $ECHO_N "checking for socket... $ECHO_C" >&6 +if test "${ac_cv_func_socket+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $LIBS" -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char socket (); below. */ +#include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -2995,10 +2820,26 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char socket (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { -socket (); +/* 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_socket) || defined (__stub___socket) +choke me +#else +f = socket; +#endif + ; return 0; } @@ -3015,42 +2856,30 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_socket_socket=yes + ac_cv_func_socket=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_socket_socket=no +cat conftest.$ac_ext >&5 +ac_cv_func_socket=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 -echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6 -if test $ac_cv_lib_socket_socket = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBSOCKET 1 -_ACEOF - - LIBS="-lsocket $LIBS" - fi +echo "$as_me:$LINENO: result: $ac_cv_func_socket" >&5 +echo "${ECHO_T}$ac_cv_func_socket" >&6 +if test $ac_cv_func_socket = yes; then + : +else - -echo "$as_me:$LINENO: checking for connect in -linet" >&5 -echo $ECHO_N "checking for connect in -linet... $ECHO_C" >&6 -if test "${ac_cv_lib_inet_connect+set}" = set; then +echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 +echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_socket+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-linet $LIBS" +LIBS="-lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -3058,11 +2887,17 @@ extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char connect (); +char socket (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { -connect (); +socket (); ; return 0; } @@ -3079,12 +2914,145 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_inet_connect=yes + ac_cv_lib_socket_socket=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_inet_connect=no +cat conftest.$ac_ext >&5 +ac_cv_lib_socket_socket=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6 +if test $ac_cv_lib_socket_socket = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSOCKET 1 +_ACEOF + + LIBS="-lsocket $LIBS" + +fi + +fi + +echo "$as_me:$LINENO: checking for connect" >&5 +echo $ECHO_N "checking for connect... $ECHO_C" >&6 +if test "${ac_cv_func_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char connect (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* 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_connect) || defined (__stub___connect) +choke me +#else +f = connect; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_connect=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_connect=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 +echo "${ECHO_T}$ac_cv_func_connect" >&6 +if test $ac_cv_func_connect = yes; then + : +else + +echo "$as_me:$LINENO: checking for connect in -linet" >&5 +echo $ECHO_N "checking for connect in -linet... $ECHO_C" >&6 +if test "${ac_cv_lib_inet_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-linet $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +connect (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_inet_connect=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_inet_connect=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS @@ -3100,6 +3068,75 @@ _ACEOF fi +fi + +echo "$as_me:$LINENO: checking for inet_aton" >&5 +echo $ECHO_N "checking for inet_aton... $ECHO_C" >&6 +if test "${ac_cv_func_inet_aton+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char inet_aton (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char inet_aton (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* 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_inet_aton) || defined (__stub___inet_aton) +choke me +#else +f = inet_aton; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_inet_aton=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_inet_aton=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_inet_aton" >&5 +echo "${ECHO_T}$ac_cv_func_inet_aton" >&6 +if test $ac_cv_func_inet_aton = yes; then + : +else echo "$as_me:$LINENO: checking for inet_aton in -lresolv" >&5 echo $ECHO_N "checking for inet_aton in -lresolv... $ECHO_C" >&6 @@ -3110,11 +3147,7 @@ else LIBS="-lresolv $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -3123,6 +3156,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char inet_aton (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -3146,8 +3185,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_cv_lib_resolv_inet_aton=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 ac_cv_lib_resolv_inet_aton=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext @@ -3164,23 +3202,84 @@ _ACEOF fi +fi + + + +# Check whether --with-pcap or --without-pcap was given. +if test "${with_pcap+set}" = set; then + withval="$with_pcap" + + { { echo "$as_me:$LINENO: error: Please use \"--with-libpcap=DIR\", not \"--with-pcap=DIR\"" >&5 +echo "$as_me: error: Please use \"--with-libpcap=DIR\", not \"--with-pcap=DIR\"" >&2;} + { (exit 1); exit 1; }; } + +fi; # Check whether --with-libpcap or --without-libpcap was given. if test "${with_libpcap+set}" = set; then withval="$with_libpcap" - test -f "$withval/pcap.h" && CPPFLAGS="$CPPFLAGS -I$withval" - test -d "$withval/bpf" && CPPFLAGS="$CPPFLAGS -I$withval/bpf" - test -f "$withval/include/pcap.h" && CPPFLAGS="$CPPFLAGS -I$withval/include" + LIBPCAPCC="" + LIBPCAPLD="" + + test -f "$withval/pcap.h" && LIBPCAPCC="$LIBPCAPCC -I$withval" + test -d "$withval/bpf" && LIBPCAPCC="$LIBPCAPCC -I$withval/bpf" + test -f "$withval/include/pcap.h" && LIBPCAPCC="$LIBPCAPCC -I$withval/include" - test -f "$withval/pcap.a" && LDFLAGS="$LDFLAGS -L$withval" - test -f "$withval/libpcap.a" && LDFLAGS="$LDFLAGS -L$withval" - test -f "$withval/lib/pcap.a" && LDFLAGS="$LDFLAGS -L$withval/lib" - test -f "$withval/lib/libpcap.a" && LDFLAGS="$LDFLAGS -L$withval/lib" + test -f "$withval/pcap.a" && LIBPCAPLD="$LIBPCAPLD -L$withval" + test -f "$withval/libpcap.a" && LIBPCAPLD="$LIBPCAPLD -L$withval" + test -f "$withval/lib/pcap.a" && LIBPCAPLD="$LIBPCAPLD -L$withval/lib" + test -f "$withval/lib/libpcap.a" && LIBPCAPLD="$LIBPCAPLD -L$withval/lib" + + if test -z "$LIBPCAPCC" -o -z "$LIBPCAPLD" + then + { { echo "$as_me:$LINENO: error: No valid libpcap library found in $withval" >&5 +echo "$as_me: error: No valid libpcap library found in $withval" >&2;} + { (exit 1); exit 1; }; } + else + CPPFLAGS="$CPPFLAGS $LIBPCAPCC" + LDFLAGS="$LDFLAGS $LIBPCAPLD" + { echo "$as_me:$LINENO: using libpcap in $withval" >&5 +echo "$as_me: using libpcap in $withval" >&6;} + fi + +fi; + +LIBNET_CONFIG="libnet-config" # relative, using $PATH + +# Check whether --with-libnet or --without-libnet was given. +if test "${with_libnet+set}" = set; then + withval="$with_libnet" + + LIBNETCC="" + LIBNETLD="" + + test -x "$withval/bin/libnet-config" && LIBNET_CONFIG="$withval/bin/libnet-config" + test -x "$withval/libnet-config" && LIBNET_CONFIG="$withval/libnet-config" + + test -f "$withval/libnet.h" && LIBNETCC="$LIBNETCC -I$withval" + test -f "$withval/include/libnet.h" && LIBNETCC="$LIBNETCC -I$withval/include" + + test -f "$withval/libnet.a" && LIBNETLD="$LIBNETLD -L$withval" + test -f "$withval/lib/libnet.a" && LIBNETLD="$LIBNETLD -L$withval/lib" + + if test -z "$LIBNETCC" -o -z "$LIBNETLD" + then + { { echo "$as_me:$LINENO: error: No valid libnet library found in $withval" >&5 +echo "$as_me: error: No valid libnet library found in $withval" >&2;} + { (exit 1); exit 1; }; } + else + CPPFLAGS="$CPPFLAGS $LIBNETCC" + LDFLAGS="$LDFLAGS $LIBNETLD" + { echo "$as_me:$LINENO: using libnet in $withval" >&5 +echo "$as_me: using libnet in $withval" >&6;} + fi fi; + echo "$as_me:$LINENO: checking for pcap_open_live in -lpcap" >&5 echo $ECHO_N "checking for pcap_open_live in -lpcap... $ECHO_C" >&6 if test "${ac_cv_lib_pcap_pcap_open_live+set}" = set; then @@ -3190,11 +3289,7 @@ else LIBS="-lpcap $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -3203,6 +3298,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pcap_open_live (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -3226,8 +3327,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_cv_lib_pcap_pcap_open_live=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 ac_cv_lib_pcap_pcap_open_live=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext @@ -3258,22 +3358,6 @@ fi # but this way, if there are more incompatible API changes in the future, the # values assigned to LIBNET_API_VERSION can be updated accordingly. -LIBNET_CONFIG="libnet-config" # relative, using $PATH - -# Check whether --with-libnet or --without-libnet was given. -if test "${with_libnet+set}" = set; then - withval="$with_libnet" - - test -x "$withval/bin/libnet-config" && LIBNET_CONFIG="$withval/bin/libnet-config" - test -x "$withval/libnet-config" && LIBNET_CONFIG="$withval/libnet-config" - - test -f "$withval/libnet.h" && CPPFLAGS="$CPPFLAGS -I$withval" - test -f "$withval/include/libnet.h" && CPPFLAGS="$CPPFLAGS -I$withval/include" - - test -f "$withval/libnet.a" && LDFLAGS="$LDFLAGS -L$withval" - test -f "$withval/lib/libnet.a" && LDFLAGS="$LDFLAGS -L$withval/lib" - -fi; echo "$as_me:$LINENO: checking for main in -lnet" >&5 echo $ECHO_N "checking for main in -lnet... $ECHO_C" >&6 @@ -3284,13 +3368,15 @@ else LIBS="-lnet $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -3314,8 +3400,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_cv_lib_net_main=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 ac_cv_lib_net_main=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext @@ -3345,11 +3430,7 @@ else LIBS="-lnet $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -3358,6 +3439,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char libnet_init_packet (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -3381,8 +3468,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_cv_lib_net_libnet_init_packet=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 ac_cv_lib_net_libnet_init_packet=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext @@ -3400,6 +3486,7 @@ _ACEOF { echo "$as_me:$LINENO: libnet version: < 1.1.0" >&5 echo "$as_me: libnet version: < 1.1.0" >&6;} CPPFLAGS="$CPPFLAGS `$LIBNET_CONFIG --defines`" + CPPFLAGS="$CPPFLAGS `$LIBNET_CONFIG --cflags`" else @@ -3412,11 +3499,7 @@ else LIBS="-lnet $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus @@ -3425,6 +3508,12 @@ extern "C" /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char libnet_init (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -3448,8 +3537,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_cv_lib_net_libnet_init=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 ac_cv_lib_net_libnet_init=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext @@ -3487,59 +3575,48 @@ if test "${ac_cv_header_stdc+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" #include #include #include #include -int -main () -{ - - ; - return 0; -} _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then + egrep "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no @@ -3552,16 +3629,12 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then + egrep "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no @@ -3577,18 +3650,13 @@ if test $ac_cv_header_stdc = yes; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" #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') \ +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) @@ -3621,12 +3689,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi @@ -3661,11 +3728,7 @@ if eval "test \"\${$as_ac_Header+set}\" = set"; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" $ac_includes_default #include <$ac_header> @@ -3685,8 +3748,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -3729,11 +3791,7 @@ echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" $ac_includes_default #include <$ac_header> _ACEOF @@ -3752,8 +3810,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -3765,17 +3822,13 @@ echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -3792,8 +3845,7 @@ if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - + cat conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext @@ -3806,32 +3858,14 @@ case $ac_header_compiler:$ac_header_preproc in { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 @@ -3862,15 +3896,17 @@ if test "${ac_cv_header_time+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" #include #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -3895,8 +3931,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 ac_cv_header_time=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -3918,15 +3953,17 @@ echo "$as_me:$LINENO: checking for sockaddr.sa_len" >&5 echo $ECHO_N "checking for sockaddr.sa_len... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" #include #include +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -3958,8 +3995,7 @@ _ACEOF else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 @@ -3967,6 +4003,64 @@ echo "${ECHO_T}no" >&6 fi rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: checking for struct sockaddr.sa_len" >&5 +echo $ECHO_N "checking for struct sockaddr.sa_len... $ECHO_C" >&6 +if test "${ac_cv_member_struct_sockaddr_sa_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include + #include + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +static struct sockaddr ac_aggr; +if (ac_aggr.sa_len) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_member_struct_sockaddr_sa_len=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_member_struct_sockaddr_sa_len=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_member_struct_sockaddr_sa_len" >&5 +echo "${ECHO_T}$ac_cv_member_struct_sockaddr_sa_len" >&6 +if test $ac_cv_member_struct_sockaddr_sa_len = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SOCKADDR_SA_LEN 1 +_ACEOF + +fi + + # Checks for library functions. for ac_header in stdlib.h @@ -3986,11 +4080,7 @@ echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" $ac_includes_default #include <$ac_header> _ACEOF @@ -4009,8 +4099,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -4022,17 +4111,13 @@ echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -4049,8 +4134,7 @@ if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - + cat conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext @@ -4063,32 +4147,14 @@ case $ac_header_compiler:$ac_header_preproc in { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 @@ -4110,27 +4176,29 @@ fi done -echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 -echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6 -if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then +echo "$as_me:$LINENO: checking for working malloc" >&5 +echo $ECHO_N "checking for working malloc... $ECHO_C" >&6 +if test "${ac_cv_func_malloc_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - ac_cv_func_malloc_0_nonnull=no + ac_cv_func_malloc_works=no else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" #if STDC_HEADERS || HAVE_STDLIB_H # include #else char *malloc (); #endif +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -4150,43 +4218,29 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_func_malloc_0_nonnull=yes + ac_cv_func_malloc_works=yes else echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_malloc_0_nonnull=no -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 -echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6 -if test $ac_cv_func_malloc_0_nonnull = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_MALLOC 1 -_ACEOF - -else - cat >>confdefs.h <<\_ACEOF -#define HAVE_MALLOC 0 -_ACEOF - - LIBOBJS="$LIBOBJS malloc.$ac_objext" +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +ac_cv_func_malloc_works=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_malloc_works" >&5 +echo "${ECHO_T}$ac_cv_func_malloc_works" >&6 +if test $ac_cv_func_malloc_works = yes; then cat >>confdefs.h <<\_ACEOF -#define malloc rpl_malloc +#define HAVE_MALLOC 1 _ACEOF fi - - -# AC_FUNC_REALLOC # our tcptraceroute.c:xrealloc() function deals with - # the realloc(0,0) case, and AC_FUNC_REALLOC doesn't +# AC_FUNC_REALLOC # our util.c:xrealloc() function deals with the + # realloc(0,0) case, and AC_FUNC_REALLOC doesn't # appear to break on HP/UX systems. @@ -4207,11 +4261,7 @@ echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" $ac_includes_default #include <$ac_header> _ACEOF @@ -4230,8 +4280,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -4243,17 +4292,13 @@ echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err + egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 @@ -4270,8 +4315,7 @@ if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - + cat conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext @@ -4284,32 +4328,14 @@ case $ac_header_compiler:$ac_header_preproc in { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 @@ -4341,11 +4367,7 @@ else for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" $ac_includes_default #if HAVE_SYS_SELECT_H # include @@ -4354,6 +4376,12 @@ $ac_includes_default # include #endif +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -4379,8 +4407,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3 else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done @@ -4424,44 +4451,37 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ -#ifdef __STDC__ -# include -#else -# include -#endif + which can conflict with char $ac_func (); below. */ +#include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" -{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} +f = $ac_func; #endif -int -main () -{ -return f != $ac_func; ; return 0; } @@ -4481,8 +4501,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext @@ -4501,44 +4520,37 @@ if test "${ac_cv_func__doprnt+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char _doprnt (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ -#ifdef __STDC__ -# include -#else -# include -#endif + which can conflict with char _doprnt (); below. */ +#include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" -{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char _doprnt (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ /* 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__doprnt) || defined (__stub____doprnt) choke me #else -char (*f) () = _doprnt; -#endif -#ifdef __cplusplus -} +f = _doprnt; #endif -int -main () -{ -return f != _doprnt; ; return 0; } @@ -4558,8 +4570,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_cv_func__doprnt=yes else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 ac_cv_func__doprnt=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext @@ -4593,44 +4604,37 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ -#ifdef __STDC__ -# include -#else -# include -#endif + which can conflict with char $ac_func (); below. */ +#include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" -{ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} +f = $ac_func; #endif -int -main () -{ -return f != $ac_func; ; return 0; } @@ -4650,8 +4654,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext @@ -4667,29 +4670,24 @@ fi done -# Perform substitutions and produce output files. -#AC_SUBST(AM_CFLAGS) -#AC_SUBST(CPPFLAGS) -#AC_SUBST(NO_MINUS_C_MINUS_O) - # Is this Solaris? echo "$as_me:$LINENO: checking for Solaris" >&5 echo $ECHO_N "checking for Solaris... $ECHO_C" >&6 if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -4729,35 +4727,168 @@ _ACEOF else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +# Is this BSDI? +echo "$as_me:$LINENO: checking for BSDI" >&5 +echo $ECHO_N "checking for BSDI... $ECHO_C" >&6 +if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + +#if defined (__bsdi__) + exit(0); +#else + exit(-1); +#endif + + ; + return 0; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_BSDI 1 +_ACEOF + + HAVE_BSDI=yes + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +# Is this NetBSD? +echo "$as_me:$LINENO: checking for NetBSD" >&5 +echo $ECHO_N "checking for NetBSD... $ECHO_C" >&6 +if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + +#if defined (__NetBSD__) + exit(0); +#else + exit(-1); +#endif + + ; + return 0; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_NETBSD 1 +_ACEOF + + HAVE_NETBSD=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 ( exit $ac_status ) echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi # Is this MacOS X? echo "$as_me:$LINENO: checking for MacOS X" >&5 echo $ECHO_N "checking for MacOS X... $ECHO_C" >&6 if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +#include "confdefs.h" +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif int main () { @@ -4797,15 +4928,14 @@ _ACEOF else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +cat conftest.$ac_ext >&5 ( exit $ac_status ) echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi # Handle --enable-noselect-default @@ -4819,6 +4949,10 @@ else if test "$HAVE_MACOSX" = "yes"; then NOSELECT_DEFAULT=yes + elif test "$HAVE_BSDI" = "yes"; then + NOSELECT_DEFAULT=yes + elif test "$HAVE_NETBSD" = "yes"; then + NOSELECT_DEFAULT=yes else NOSELECT_DEFAULT=no fi @@ -4839,7 +4973,7 @@ if test "${enable_track_default+set}" = set; then if test "$enable_track_default" = "id" -o "$enable_track_default" = "ID"; then TRACK_DEFAULT=id - elif test "$enable_track_default" = "port" -o "$enable_track_default" = "port"; then + elif test "$enable_track_default" = "port" -o "$enable_track_default" = "PORT"; then TRACK_DEFAULT=port else { { echo "$as_me:$LINENO: error: valid arguments for --enable-track-default are PORT or ID" >&5 @@ -4862,12 +4996,6 @@ cat >>confdefs.h <<\_ACEOF #define TRACK_PORT_DEFAULT 1 _ACEOF -else - -cat >>confdefs.h <<\_ACEOF -#define TRACK_PORT_DEFAULT 0 -_ACEOF - fi # Handle --enable-default-port=N @@ -4913,12 +5041,14 @@ echo "$as_me: error: Sorry, I only know how to compile staticly for gcc" >&2;} fi; +echo "Target OS is $target_os" + cat >>confdefs.h <<_ACEOF #define TARGET "$target" _ACEOF - ac_config_files="$ac_config_files Makefile" +ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -4930,7 +5060,7 @@ cat >confcache <<\_ACEOF # 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 +# `ac_cv_env_foo' variables (set or unset) will be overriden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. @@ -4965,7 +5095,7 @@ _ACEOF t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else +if cmp -s $cache_file confcache; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file @@ -4996,21 +5126,6 @@ fi DEFS=-DHAVE_CONFIG_H -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files @@ -5025,12 +5140,11 @@ cat >$CONFIG_STATUS <<_ACEOF # configure, is in config.log if it exists. debug=false -ac_cs_recheck=false -ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF + ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## @@ -5039,13 +5153,11 @@ cat >>$CONFIG_STATUS <<\_ACEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +# NLS nuisances. # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset @@ -5053,42 +5165,34 @@ else as_unset=false fi - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; 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 +(set +x; test -n "`(LANG=C; export LANG) 2>&1`") && + { $as_unset LANG || test "${LANG+set}" != set; } || + { LANG=C; export LANG; } +(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && + { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || + { LC_ALL=C; export LC_ALL; } +(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && + { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || + { LC_TIME=C; export LC_TIME; } +(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && + { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || + { LC_CTYPE=C; export LC_CTYPE; } +(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && + { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || + { LANGUAGE=C; export LANGUAGE; } +(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && + { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || + { LC_COLLATE=C; export LC_COLLATE; } +(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && + { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || + { LC_NUMERIC=C; export LC_NUMERIC; } +(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && + { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || + { LC_MESSAGES=C; export LC_MESSAGES; } # Name of the executable. -as_me=`$as_basename "$0" || +as_me=`(basename "$0") 2>/dev/null || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ @@ -5099,7 +5203,6 @@ echo X/"$0" | /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` - # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' @@ -5110,15 +5213,15 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + echo "#! /bin/sh" >conftest.sh + echo "exit 0" >>conftest.sh + chmod +x conftest.sh + if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi - rm -f conf$$.sh + rm -f conftest.sh fi @@ -5167,8 +5270,6 @@ do as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} @@ -5242,12 +5343,6 @@ else fi rm -f conf$$ conf$$.exe conf$$.file -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - as_mkdir_p=false -fi - as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. @@ -5264,7 +5359,7 @@ as_nl=' IFS=" $as_nl" # CDPATH. -$as_unset CDPATH +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } exec 6>&1 @@ -5281,7 +5376,7 @@ _ASBOX cat >&5 <<_CSEOF This file was extended by $as_me, which was -generated by GNU Autoconf 2.57. Invocation command line was +generated by GNU Autoconf 2.53. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -5321,7 +5416,6 @@ Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit - -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] @@ -5344,7 +5438,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.57, +configured by $0, generated by GNU Autoconf 2.53, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 @@ -5365,25 +5459,25 @@ do --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift ;; + -*);; *) # This is not an option, so the user has probably given explicit # arguments. - ac_option=$1 ac_need_defaults=false;; esac - case $ac_option in + case $1 in # Handling of the options. _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; + echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" + exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) @@ -5398,16 +5492,13 @@ Try \`$0 --help' for more information." >&2;} --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" + shift + CONFIG_FILES="$CONFIG_FILES $1" ac_need_defaults=false;; --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 @@ -5422,20 +5513,6 @@ Try \`$0 --help' for more information." >&2;} 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 -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - _ACEOF cat >>$CONFIG_STATUS <<_ACEOF @@ -5473,9 +5550,6 @@ if $ac_need_defaults; then 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 to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { @@ -5484,17 +5558,17 @@ $debug || } # Create a (secure) tmp directory for tmp files. - +: ${TMPDIR=/tmp} { - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { - tmp=./confstat$$-$RANDOM + tmp=$TMPDIR/cs$$-$RANDOM (umask 077 && mkdir $tmp) } || { - echo "$me: cannot create a temporary directory in ." >&2 + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 { (exit 1); exit 1; } } @@ -5573,9 +5647,6 @@ s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF @@ -5646,30 +5717,25 @@ echo X"$ac_file" | /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || + mkdir "$as_incr_dir" || + { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +done; } ac_builddir=. @@ -5699,7 +5765,7 @@ esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` @@ -5889,7 +5955,7 @@ _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail @@ -5913,7 +5979,7 @@ do mv conftest.tail conftest.defines done rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS +echo ' fi # egrep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size @@ -5953,7 +6019,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else @@ -5969,30 +6035,25 @@ echo X"$ac_file" | /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || + mkdir "$as_incr_dir" || + { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +done; } rm -f $ac_file mv $tmp/config.h $ac_file @@ -6051,7 +6112,7 @@ esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` @@ -6082,11 +6143,8 @@ ac_clean_files=$ac_clean_files_save # 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 + $SHELL $CONFIG_STATUS || 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. diff --git a/configure.ac b/configure.ac index 56db31a..f195ecf 100644 --- a/configure.ac +++ b/configure.ac @@ -8,7 +8,7 @@ AC_PREREQ(2.50) AC_INIT(tcptraceroute) AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE(tcptraceroute, `cat VERSION`) -AC_CONFIG_SRCDIR(tcptraceroute.c) +AC_CONFIG_SRCDIR(main.c) AM_CONFIG_HEADER(config.h) # Checks for programs. @@ -20,23 +20,67 @@ fi AC_PROG_INSTALL # Checks for libraries. -AC_CHECK_LIB(nsl, gethostbyname) -AC_CHECK_LIB(socket, socket) -AC_CHECK_LIB(inet, connect) -AC_CHECK_LIB(resolv, inet_aton) +AC_CHECK_FUNC(gethostbyname, ,[AC_CHECK_LIB(nsl, gethostbyname)]) +AC_CHECK_FUNC(socket, ,[AC_CHECK_LIB(socket, socket)]) +AC_CHECK_FUNC(connect, ,[AC_CHECK_LIB(inet, connect)]) +AC_CHECK_FUNC(inet_aton, ,[AC_CHECK_LIB(resolv, inet_aton)]) + +AC_ARG_WITH(pcap, [], + [ + AC_MSG_ERROR([Please use "--with-libpcap=DIR", not "--with-pcap=DIR"]) + ], + []) AC_ARG_WITH(libpcap, AC_HELP_STRING([--with-libpcap=DIR], [use libpcap in DIR]), [ - test -f "$withval/pcap.h" && CPPFLAGS="$CPPFLAGS -I$withval" - test -d "$withval/bpf" && CPPFLAGS="$CPPFLAGS -I$withval/bpf" - test -f "$withval/include/pcap.h" && CPPFLAGS="$CPPFLAGS -I$withval/include" - - test -f "$withval/pcap.a" && LDFLAGS="$LDFLAGS -L$withval" - test -f "$withval/libpcap.a" && LDFLAGS="$LDFLAGS -L$withval" - test -f "$withval/lib/pcap.a" && LDFLAGS="$LDFLAGS -L$withval/lib" - test -f "$withval/lib/libpcap.a" && LDFLAGS="$LDFLAGS -L$withval/lib" + LIBPCAPCC="" + LIBPCAPLD="" + + test -f "$withval/pcap.h" && LIBPCAPCC="$LIBPCAPCC -I$withval" + test -d "$withval/bpf" && LIBPCAPCC="$LIBPCAPCC -I$withval/bpf" + test -f "$withval/include/pcap.h" && LIBPCAPCC="$LIBPCAPCC -I$withval/include" + + test -f "$withval/pcap.a" && LIBPCAPLD="$LIBPCAPLD -L$withval" + test -f "$withval/libpcap.a" && LIBPCAPLD="$LIBPCAPLD -L$withval" + test -f "$withval/lib/pcap.a" && LIBPCAPLD="$LIBPCAPLD -L$withval/lib" + test -f "$withval/lib/libpcap.a" && LIBPCAPLD="$LIBPCAPLD -L$withval/lib" + + if test -z "$LIBPCAPCC" -o -z "$LIBPCAPLD" + then + AC_MSG_ERROR([No valid libpcap library found in $withval]) + else + CPPFLAGS="$CPPFLAGS $LIBPCAPCC" + LDFLAGS="$LDFLAGS $LIBPCAPLD" + AC_MSG_NOTICE([using libpcap in $withval]) + fi + ], []) + +LIBNET_CONFIG="libnet-config" # relative, using $PATH +AC_ARG_WITH(libnet, AC_HELP_STRING( [--with-libnet=DIR], [use libnet in DIR]), + [ + LIBNETCC="" + LIBNETLD="" + + test -x "$withval/bin/libnet-config" && LIBNET_CONFIG="$withval/bin/libnet-config" + test -x "$withval/libnet-config" && LIBNET_CONFIG="$withval/libnet-config" + + test -f "$withval/libnet.h" && LIBNETCC="$LIBNETCC -I$withval" + test -f "$withval/include/libnet.h" && LIBNETCC="$LIBNETCC -I$withval/include" + + test -f "$withval/libnet.a" && LIBNETLD="$LIBNETLD -L$withval" + test -f "$withval/lib/libnet.a" && LIBNETLD="$LIBNETLD -L$withval/lib" + + if test -z "$LIBNETCC" -o -z "$LIBNETLD" + then + AC_MSG_ERROR([No valid libnet library found in $withval]) + else + CPPFLAGS="$CPPFLAGS $LIBNETCC" + LDFLAGS="$LDFLAGS $LIBNETLD" + AC_MSG_NOTICE([using libnet in $withval]) + fi ], []) -AC_CHECK_LIB(pcap, pcap_open_live, , [AC_MSG_ERROR([cannot find libpcap])]) + +AC_CHECK_LIB(pcap, pcap_open_live, [], [AC_MSG_ERROR([cannot find libpcap])]) # Libnet underwent a major API change in between version 1.0.2a and 1.1.0. # The code below sets the preprocessor symbol LIBNET_API_VERSION to 100 if a @@ -47,24 +91,13 @@ AC_CHECK_LIB(pcap, pcap_open_live, , [AC_MSG_ERROR([cannot find libpcap])]) # but this way, if there are more incompatible API changes in the future, the # values assigned to LIBNET_API_VERSION can be updated accordingly. -LIBNET_CONFIG="libnet-config" # relative, using $PATH -AC_ARG_WITH(libnet, AC_HELP_STRING( [--with-libnet=DIR], [use libnet in DIR]), - [ - test -x "$withval/bin/libnet-config" && LIBNET_CONFIG="$withval/bin/libnet-config" - test -x "$withval/libnet-config" && LIBNET_CONFIG="$withval/libnet-config" - - test -f "$withval/libnet.h" && CPPFLAGS="$CPPFLAGS -I$withval" - test -f "$withval/include/libnet.h" && CPPFLAGS="$CPPFLAGS -I$withval/include" - - test -f "$withval/libnet.a" && LDFLAGS="$LDFLAGS -L$withval" - test -f "$withval/lib/libnet.a" && LDFLAGS="$LDFLAGS -L$withval/lib" - ], []) -AC_CHECK_LIB(net, main, , [AC_MSG_ERROR([cannot find libnet])]) +AC_CHECK_LIB(net, main, [], [AC_MSG_ERROR([cannot find libnet])]) AC_CHECK_LIB(net, libnet_init_packet, [ AC_DEFINE(LIBNET_API_VERSION, 100, [libnet API version]) AC_MSG_NOTICE([libnet version: < 1.1.0]) CPPFLAGS="$CPPFLAGS `$LIBNET_CONFIG --defines`" + CPPFLAGS="$CPPFLAGS `$LIBNET_CONFIG --cflags`" ], [ AC_CHECK_LIB(net, libnet_init, [ @@ -98,20 +131,21 @@ AC_COMPILE_IFELSE( AC_MSG_RESULT(no) ]) +AC_CHECK_MEMBER([struct sockaddr.sa_len], + [AC_DEFINE([HAVE_SOCKADDR_SA_LEN], 1, [Has socket.sa_len])], + [], + [#include + #include ]) + # Checks for library functions. AC_FUNC_MALLOC -# AC_FUNC_REALLOC # our tcptraceroute.c:xrealloc() function deals with - # the realloc(0,0) case, and AC_FUNC_REALLOC doesn't +# AC_FUNC_REALLOC # our util.c:xrealloc() function deals with the + # realloc(0,0) case, and AC_FUNC_REALLOC doesn't # appear to break on HP/UX systems. AC_FUNC_SELECT_ARGTYPES AC_FUNC_VPRINTF AC_CHECK_FUNCS([gettimeofday memset select socket strchr]) -# Perform substitutions and produce output files. -#AC_SUBST(AM_CFLAGS) -#AC_SUBST(CPPFLAGS) -#AC_SUBST(NO_MINUS_C_MINUS_O) - # Is this Solaris? AC_MSG_CHECKING(for Solaris) AC_RUN_IFELSE([AC_LANG_PROGRAM( [], [ @@ -129,6 +163,40 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM( [], [ AC_MSG_RESULT(no) ]) +# Is this BSDI? +AC_MSG_CHECKING(for BSDI) +AC_RUN_IFELSE([AC_LANG_PROGRAM( [], [ +#if defined (__bsdi__) + exit(0); +#else + exit(-1); +#endif + ]) + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_BSDI], 1, [Is this a BSDI system?]) + HAVE_BSDI=yes + ],[ + AC_MSG_RESULT(no) + ]) + +# Is this NetBSD? +AC_MSG_CHECKING(for NetBSD) +AC_RUN_IFELSE([AC_LANG_PROGRAM( [], [ +#if defined (__NetBSD__) + exit(0); +#else + exit(-1); +#endif + ]) + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_NETBSD], 1, [Is this a NetBSD system?]) + HAVE_NETBSD=yes + ],[ + AC_MSG_RESULT(no) + ]) + # Is this MacOS X? AC_MSG_CHECKING(for MacOS X) AC_RUN_IFELSE([AC_LANG_PROGRAM( [], [ @@ -154,6 +222,10 @@ AC_ARG_ENABLE(noselect-default, ], [ if test "$HAVE_MACOSX" = "yes"; then NOSELECT_DEFAULT=yes + elif test "$HAVE_BSDI" = "yes"; then + NOSELECT_DEFAULT=yes + elif test "$HAVE_NETBSD" = "yes"; then + NOSELECT_DEFAULT=yes else NOSELECT_DEFAULT=no fi @@ -168,7 +240,7 @@ AC_ARG_ENABLE(track-default, [ if test "$enable_track_default" = "id" -o "$enable_track_default" = "ID"; then TRACK_DEFAULT=id - elif test "$enable_track_default" = "port" -o "$enable_track_default" = "port"; then + elif test "$enable_track_default" = "port" -o "$enable_track_default" = "PORT"; then TRACK_DEFAULT=port else AC_MSG_ERROR([valid arguments for --enable-track-default are PORT or ID]) @@ -182,8 +254,6 @@ AC_ARG_ENABLE(track-default, ]) if test "$TRACK_DEFAULT" = "port"; then AC_DEFINE(TRACK_PORT_DEFAULT, 1, [Track ports by default]) -else - AC_DEFINE(TRACK_PORT_DEFAULT, 0, [Track ports by default]) fi # Handle --enable-default-port=N @@ -215,6 +285,8 @@ AC_ARG_ENABLE(static, fi ], []) +echo "Target OS is $target_os" + AC_DEFINE_UNQUOTED(TARGET, "$target", [Target platform]) AC_CONFIG_FILES(Makefile) AC_OUTPUT diff --git a/datalink.c b/datalink.c new file mode 100644 index 0000000..dbc310b --- /dev/null +++ b/datalink.c @@ -0,0 +1,339 @@ +/* -*- Mode: c; tab-width: 4; indent-tabs-mode: 1; c-basic-offset: 4; -*- */ +/* vim:set ts=4 sw=4 ai nobackup nocindent sm: */ + +/* + * tcptraceroute -- A traceroute implementation using TCP packets + * Copyright (c) 2001-2005 Michael C. Toren + * + * 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. + * + * A copy of the GNU GPL is available as /usr/doc/copyright/GPL on Debian + * systems, or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html + * You can also obtain it by writing to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "tcptraceroute.h" + +#ifndef SIOCGIFCONF +#include /* Solaris, maybe others? */ +#endif + +#ifndef AF_LINK +#define AF_LINK AF_INET /* BSD defines some AF_INET interfaces as AF_LINK */ +#endif + +struct interface_entry *interfaces; + +/* + * To add support for additional link layers add entries to the following + * table. The numbers below are believed to be correct and were obtained + * by looking through other pcap programs, however tcptraceroute has only + * been well tested on ethernet, PPP, and loopback interfaces. + */ + +struct datalinktype datalinktypes[] = { +/* type offset name */ +#ifdef DLT_RAW + { DLT_RAW, 0, "RAW" }, +#endif +#ifdef DLT_EN10MB + { DLT_EN10MB, 14, "ETHERNET" }, +#endif +#ifdef DLT_PPP + { DLT_PPP, 4, "PPP" }, +#endif +#ifdef DLT_LINUX_SLL + { DLT_LINUX_SLL, 16, "PPP_HDLC" }, +#endif +#ifdef DLT_SLIP + { DLT_SLIP, 16, "SLIP" }, +#endif +#ifdef DLT_PPP_BSDOS + { DLT_PPP_BSDOS, 24, "PPP_BSDOS" }, +#endif +#ifdef DLT_SLIP_BSDOS + { DLT_SLIP_BSDOS, 24, "SLIP_BSDOS" }, +#endif +#ifdef DLT_FDDI + { DLT_FDDI, 21, "FDDI" }, +#endif +#ifdef DLT_IEEE802 + { DLT_IEEE802, 22, "IEEE802" }, +#endif +#ifdef DLT_NULL + { DLT_NULL, 4, "DLT_NULL" }, +#endif +#ifdef DLT_LOOP + { DLT_LOOP, 4, "DLT_LOOP" }, +#endif +#ifdef DLT_PPP_ETHER + { DLT_PPP_ETHER, 12, "PPP_ETHER" }, +#endif + + /* Does anyone know correct values for these? */ +#ifdef DLT_ATM_RFC1483 + { DLT_ATM_RFC1483, -1, "ATM_RFC1483" }, +#endif +#ifdef DLT_EN3MB + { DLT_EN3MB, -1, "EN3MB" }, +#endif +#ifdef DLT_AX25 + { DLT_AX25, -1, "AX25" }, +#endif +#ifdef DLT_PRONET + { DLT_PRONET, -1, "PRONET" }, +#endif +#ifdef DLT_CHAOS + { DLT_CHAOS, -1, "CHAOS" }, +#endif +#ifdef DLT_ARCNET + { DLT_ARCNET, -1, "ARCNET" }, +#endif + + /* End of the road */ + { -1, -1, NULL } +}; + + +int datalinkoffset(int type) +{ + int i; + + for (i = 0; datalinktypes[i].name; i++) + if (datalinktypes[i].type == type) + return datalinktypes[i].offset; + + return -1; +} + +char *datalinkname(int type) +{ + static char name[TEXTSIZE]; + int i; + + for (i = 0; datalinktypes[i].name; i++) + if (datalinktypes[i].type == type) + return datalinktypes[i].name; + + safe_snprintf(name, TEXTSIZE, "#%d", type); + return name; +} + +/* + * Fetches the interface list, storing it in struct interface_entry interfaces. + */ + +void getinterfaces(void) +{ + struct interface_entry *p; + struct ifconf ifc; + struct ifreq *ifrp, ifr; + int numreqs, i, s; + u_long addr; + int salen; + char *x; + + debug("entering getinterfaces()\n"); + + if (o_nogetinterfaces) + { + debug("Not fetching the interface list\n"); + return; + } + + if (interfaces) + fatal("Double call to getinterfaces()\n"); + + ifc.ifc_buf = NULL; + p = NULL; + + numreqs = 32; + + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) + fatal("socket error"); + + debug("ifreq buffer set to %d\n", numreqs); + + for (;;) + { + ifc.ifc_len = sizeof(struct ifreq) * numreqs; + ifc.ifc_buf = xrealloc(ifc.ifc_buf, ifc.ifc_len); + + if (ioctl(s, SIOCGIFCONF, &ifc) < 0) + pfatal("ioctl"); + + /* This "+ sizeof(struct ifreq) + 64" crap seems to be an (Open?)BSDism. */ + if ( (ifc.ifc_len + sizeof(struct ifreq) + 64) >= (sizeof(struct ifreq) * numreqs) ) + { + /* Assume it overflowed and try again */ + numreqs += 32; + if (numreqs > 20000) + break; /* Too big! */ + debug("ifreq buffer grown to %d\n", numreqs); + continue; + } + + break; + } + + debug("Successfully retrieved interface list\n"); + +#ifdef HAVE_SOCKADDR_SA_LEN + debug("Using HAVE_SOCKADDR_SA_LEN method for finding addresses.\n"); +#endif + + for (x = ifc.ifc_buf; x < (ifc.ifc_buf + ifc.ifc_len); x += salen) + { + ifrp = (struct ifreq *)x; + + memset(&ifr, 0, sizeof(struct ifreq)); + strcpy(ifr.ifr_name, ifrp->ifr_name); + +#ifdef HAVE_SOCKADDR_SA_LEN + + salen = sizeof(ifrp->ifr_name) + ifrp->ifr_addr.sa_len; + if (salen < sizeof(*ifrp)) + salen = sizeof(*ifrp); + + addr = ((struct sockaddr_in *)&ifrp->ifr_addr)->sin_addr.s_addr; + if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) + pfatal("ioctl(SIOCGIFFLAGS)"); + +#else /* HAVE_SOCKADDR_SA_LEN */ + + salen = sizeof(*ifrp); + + if (ioctl(s, SIOCGIFADDR, &ifr) < 0) + { + debug("ioctl(SIOCGIFADDR) on unconfigured interface %s failed; skipping\n", + sprintable(ifr.ifr_name)); + continue; + } + addr = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr; + +#endif /* HAVE_SOCKADDR_SA_LEN else */ + +#ifdef AF_INET6 + if (ifrp->ifr_addr.sa_family == AF_INET6) + { + debug("Ignoring AF_INET6 address on interface %s\n", + sprintable(ifr.ifr_name)); + continue; + } +#endif + + if (ifrp->ifr_addr.sa_family != AF_INET && + ifrp->ifr_addr.sa_family != AF_LINK) + { + debug("Ignoring non-AF_INET address on interface %s\n", + sprintable(ifr.ifr_name)); + continue; + } + + if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) + pfatal("ioctl(SIOCGIFFLAGS)"); + if ((ifr.ifr_flags & IFF_UP) == 0) + { + debug("Ignoring down interface %s\n", + sprintable(ifr.ifr_name)); + continue; + } + + /* Deal with virtual hosts */ + for (i = 0; ifr.ifr_name[i]; i++) + if (ifr.ifr_name[i] == ':') + ifr.ifr_name[i] = '\0'; + + /* Grow another node on the linked list... */ + if (!p) + p = interfaces = xrealloc(NULL, sizeof(struct interface_entry)); + else + p = p->next = xrealloc(NULL, sizeof(struct interface_entry)); + + p->next = NULL; + + /* ... and fill it in */ + p->addr = addr; + p->name = xrealloc(NULL, strlen(ifr.ifr_name) + 1); + strcpy(p->name, ifr.ifr_name); + + debug("Discovered interface %s with address %s\n", + sprintable(p->name), iptos(p->addr)); + } + + free(ifc.ifc_buf); + debug("leaving getinterfaces()\n"); +} + +/* + * Determines the source address that should be used to reach the + * given destination address. + */ + +u_long findsrc(u_long dest) +{ + struct sockaddr_in sinsrc, sindest; + int s, size; + + if ((s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) + pfatal("socket error"); + + memset(&sinsrc, 0, sizeof(struct sockaddr_in)); + memset(&sindest, 0, sizeof(struct sockaddr_in)); + + sindest.sin_family = AF_INET; + sindest.sin_addr.s_addr = dest; + sindest.sin_port = htons(53); /* can be anything but zero */ + + if (connect(s, (struct sockaddr *)&sindest, sizeof(sindest)) < 0) + pfatal("connect"); + + size = sizeof(sinsrc); + if (getsockname(s, (struct sockaddr *)&sinsrc, &size) < 0) + pfatal("getsockname"); + + close(s); + debug("Determined source address of %s to reach %s\n", + iptos(sinsrc.sin_addr.s_addr), iptos(dest)); + return sinsrc.sin_addr.s_addr; +} + +/* + * Find an appropriate device to use given the specified source address. + * However, if we find an interface matching the global dst_ip address, set + * the source address we're looking for to 127.0.0.1 in an attempt to select + * the loopback. Ofcourse, this entirely depends on the fact that a loopback + * interface exists with an address of 127.0.0.1. + */ + +char *finddev(u_long with_src) +{ + struct interface_entry *p; + char *device = NULL; + + debug("entering finddev()\n"); + + /* First, see if we're trying to trace to ourself */ + for (p = interfaces; p; p = p->next) + if (p->addr == dst_ip) + { + debug("Destination matches local address of interface %s;\n\tattempting to find loopback interface, o_nofilter set\n", p->name); + with_src = hosttoip("127.0.0.1", LIBNET_DONT_RESOLVE); + o_nofilter = 1; + } + + for (p = interfaces; p; p = p->next) + if (p->addr == with_src) + device = p->name; + + debug("finddev() returning %s\n", device); + return device; +} diff --git a/datalink.h b/datalink.h new file mode 100644 index 0000000..eea96cf --- /dev/null +++ b/datalink.h @@ -0,0 +1,40 @@ +/* -*- Mode: c; tab-width: 4; indent-tabs-mode: 1; c-basic-offset: 4; -*- */ +/* vim:set ts=4 sw=4 ai nobackup nocindent sm: */ + +/* + * tcptraceroute -- A traceroute implementation using TCP packets + * Copyright (c) 2001-2005 Michael C. Toren + * + * 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. + * + * A copy of the GNU GPL is available as /usr/doc/copyright/GPL on Debian + * systems, or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html + * You can also obtain it by writing to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +/* array of supported datalink types */ +extern struct datalinktype { + int type, offset; + char *name; +} datalinktypes[]; + +/* interface linked list, built by getinterfaces() */ +extern struct interface_entry { + char *name; + u_long addr; + struct interface_entry *next; +} *interfaces; + +int datalinkoffset(int); +char *datalinkname(int); +void getinterfaces(void); +u_long findsrc(u_long); +char *finddev(u_long); diff --git a/debian/copyright b/debian/copyright index 71bbf12..0b7bea8 100644 --- a/debian/copyright +++ b/debian/copyright @@ -4,7 +4,7 @@ http://michael.toren.net/code/tcptraceroute/ Copyright: -Copyright (c) 2001, 2002, 2003 Michael C. Toren +Copyright (c) 2001-2005 Michael C. Toren 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 diff --git a/main.c b/main.c new file mode 100644 index 0000000..32dc4df --- /dev/null +++ b/main.c @@ -0,0 +1,544 @@ +/* -*- Mode: c; tab-width: 4; indent-tabs-mode: 1; c-basic-offset: 4; -*- */ +/* vim:set ts=4 sw=4 ai nobackup nocindent sm: */ + +/* + * tcptraceroute -- A traceroute implementation using TCP packets + * Copyright (c) 2001-2005 Michael C. Toren + * + * 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. + * + * A copy of the GNU GPL is available as /usr/doc/copyright/GPL on Debian + * systems, or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html + * You can also obtain it by writing to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "tcptraceroute.h" + +/* globals */ +u_long dst_ip, src_ip, isn; +u_short src_prt, dst_prt; +char *device, *name, *dst, *src; +char dst_name[TEXTSIZE], dst_prt_name[TEXTSIZE], filter[TEXTSIZE]; +int datalink, offset; +int o_minttl, o_maxttl, o_timeout, o_debug, o_numeric, o_pktlen, + o_nqueries, o_dontfrag, o_tos, o_forceport, o_syn, o_ack, o_ecn, + o_nofilter, o_nogetinterfaces, o_noselect, o_trackport, o_dnat, + o_isn; + +char errbuf [PCAP_ERRBUF_SIZE > LIBNET_ERRBUF_SIZE ? + PCAP_ERRBUF_SIZE : LIBNET_ERRBUF_SIZE]; + +/* + * Check command line arguments for sanity, and fill in the blanks. + */ + +void defaults(void) +{ + struct servent *serv; + u_long recommended_src; + + getinterfaces(); + + if ((dst_ip = hosttoip(dst, LIBNET_RESOLVE)) == 0xFFFFFFFF) + fatal("Bad destination address: %s\n", dst); + + recommended_src = findsrc(dst_ip); + + if (src) + { + if ((src_ip = hosttoip(src, LIBNET_RESOLVE)) == 0xFFFFFFFF) + fatal("Bad source address: %s\n", src); + } + else + { + src_ip = recommended_src; + } + + if (device == NULL) + /* not specified on command line */ + device = finddev(recommended_src); + + if (device == NULL) + { + /* couldn't find an appropriate interface */ + warn("Could not determine appropriate device; resorting to pcap_lookupdev()\n"); + device = pcap_lookupdev(errbuf); + } + + if (device == NULL) + fatal("Could not determine device via pcap_lookupdev(): %\n", errbuf); + + if ((pcap = pcap_open_live(device, 0, 0, 0, errbuf)) == NULL) + fatal("error opening device %s: %s\n", device, errbuf); + + datalink = pcap_datalink(pcap); + offset = datalinkoffset(datalink); + + if (offset < 0) + fatal("Sorry, media type of device %s (%s) is not supported\n", + device, datalinkname(datalink)); + + pcap_close(pcap); + + if (src_prt && o_trackport) + { + warn("--track-id implied by specifying the local source port\n"); + o_trackport = 0; + } + + if (! o_trackport) + { +#ifdef HAVE_SOLARIS + warn("--track-id is unlikely to work on Solaris\n"); +#endif + + if (! o_forceport) + src_prt = allocateport(src_prt); + + if (src_prt == 0) + fatal("Sorry, requested local port is already in use. Use -P, instead of -p, to override.\n"); + } + + if (o_minttl <= 0 || o_maxttl <= 0) + fatal("TTL must be greater than 0\n"); + + if (o_minttl >= 256 || o_maxttl >= 256) + fatal("TTL must be less than 256\n"); + + if (o_minttl > o_maxttl) + fatal("Minimum TTL (%d) must be less than maximum TTL (%d)\n", + o_minttl, o_maxttl); + + if (o_nqueries <= 0) + fatal("Number of queries must be at least 1\n"); + + if (o_timeout <= 0) + fatal("Timeout must be at least 1\n"); + + if (o_pktlen < LIBNET_TCP_H + LIBNET_IPV4_H) + { + if (o_pktlen != 0) + warn("Increasing packet length to %d bytes\n", LIBNET_TCP_H + LIBNET_IPV4_H); + o_pktlen = 0; + } + else + o_pktlen -= (LIBNET_TCP_H + LIBNET_IPV4_H); + +#if (LIBNET_API_VERSION < 110) + if ((sockfd = libnet_open_raw_sock(IPPROTO_RAW)) < 0) + pfatal("socket allocation"); +#endif + +#if (LIBNET_API_VERSION < 110) + libnet_seed_prand(); +#else + libnet_seed_prand(libnet_context); +#endif + + if (strcmp(dst, iptos(dst_ip)) == 0) + safe_snprintf(dst_name, TEXTSIZE, "%s", dst); + else + safe_snprintf(dst_name, TEXTSIZE, "%s (%s)", dst, iptos(dst_ip)); + + if ((serv = getservbyport(htons(dst_prt), "tcp")) == NULL) + safe_snprintf(dst_prt_name, TEXTSIZE, "%d", dst_prt); + else + safe_snprintf(dst_prt_name, TEXTSIZE, "%d (%s)", dst_prt, serv->s_name); + + if (! (o_syn|o_ack)) + { + debug("Setting o_syn, in absence of either o_syn or o_ack\n"); + o_syn = 1; + } + + if (! o_isn) + isn = libnet_get_prand(LIBNET_PRu32); + + debugoptions(); + + fprintf(stderr, "Selected device %s, address %s", device, iptos(src_ip)); + if (! o_trackport) fprintf(stderr, ", port %d", src_prt); + fprintf(stderr, " for outgoing packets\n"); +} + +int trace(void) +{ + int ttl, q, done; + proberecord *record; + + fprintf(stderr, "Tracing the path to %s on TCP port %s, %d hops max", + dst_name, dst_prt_name, o_maxttl); + if (o_pktlen) + fprintf(stderr, ", %d byte packets", o_pktlen + LIBNET_TCP_H + LIBNET_IPV4_H); + fprintf(stderr, "\n"); + + for (ttl = o_minttl, done = 0; !done && ttl <= o_maxttl; ttl++) + { + for (q = 1; q <= o_nqueries; q++) + { + record = newproberecord(); + probe(record, ttl, q); + + debug("Sent probe %d of %d for hop %d, IP ID %d, source port %d, %s%s%s\n", + q, o_nqueries, ttl, record->id, record->src_prt, + o_syn ? "SYN " : "", + o_ack ? "ACK " : "", + o_ecn ? "CWR ECN " : ""); + + if (capture(record)) + done = 1; + + showprobe(record); + freeproberecord(record); + } + } + + if (!done) + fprintf(stderr, "Destination not reached\n"); + + return !done; +} + +/* + * Verify a command line argument is numeric; only to be called from main(). + */ + +int checknumericarg(void) +{ + if (! isnumeric(optarg)) + fatal("Numeric argument required for -%c\n", optopt); + + return atoi(optarg); +} + +/* + * A kludge to help us process long command line arguments, only to be called + * using the CHECKLONG() macro, and only from main(). If the given word + * matches the current word being processed, it's removed from the argument + * list, and returns 1. + */ + +#define CHECKLONG(word) ( checklong_real(word, &i, &argc, &argv) ) +int checklong_real(char *word, int *i, int *argc, char ***argv) +{ + int j; + + if (strcmp((*argv)[*i], word) != 0) + return 0; + + /* shift */ + for (j = *i; (*argv)[j]; j++) + (*argv)[j] = (*argv)[j+1]; + + (*argc)--; + (*i)--; + + return 1; +} + +int main(int argc, char **argv) +{ + char *optstring, *s; + int op, i, exitcode; + + src_ip = 0; + src_prt = 0; + dst_prt = DEFAULT_PORT; + src = NULL; + device = NULL; + interfaces = NULL; + + o_minttl = 1; + o_maxttl = 30; + o_debug = 0; + o_numeric = 0; + o_nqueries = 3; + o_forceport = 0; + o_pktlen = 0; + o_tos = 0; + o_ecn = 0; + o_syn = 0; + o_ack = 0; + o_dontfrag = 0; + o_timeout = 3; + o_nofilter = 0; + o_nogetinterfaces = 0; + o_dnat = 0; + o_isn = 0; + +#ifdef NOSELECT_DEFAULT + o_noselect = 1; +#else + o_noselect = 0; +#endif + +#ifdef TRACK_PORT_DEFAULT + o_trackport = 1; +#else + o_trackport = 0; +#endif + + /* strip out path from argv[0] */ + for (name = s = argv[0]; s[0]; s++) + if (s[0] == '/' && s[1]) + name = &s[1]; + + /* First loop through and extract long command line arguments ... */ + + for(i = 1; argv[i]; i++) + { + if (CHECKLONG("--help")) + usage(); + + if (CHECKLONG("--version")) + about(); + + /* undocumented, for debugging only */ + if (CHECKLONG("--no-filter")) + { + o_nofilter = 1; + debug("o_nofilter set\n"); + continue; + } + + /* undocumented, for debugging only */ + if (CHECKLONG("--no-getinterfaces")) + { + o_nogetinterfaces = 1; + debug("o_nogetinterfaces set\n"); + continue; + } + + /* undocumented, for debugging only */ + if (CHECKLONG("--no-select")) + { + o_noselect = 1; + debug("o_noselect set\n"); + continue; + } + + /* undocumented, for debugging only */ + if (CHECKLONG("--select")) + { + o_noselect = 0; + debug("o_noselect disabled\n"); + continue; + } + + if (CHECKLONG("--track-id") || + CHECKLONG("--track-ipid")) + { + o_trackport = 0; + debug("o_trackport disabled\n"); + continue; + } + + if (CHECKLONG("--track-port")) + { + o_trackport = 1; + debug("o_trackport set\n"); + continue; + } + + if (CHECKLONG("--dnat")) + { + o_dnat = 1; + debug("o_dnat set\n"); + continue; + } + + if (CHECKLONG("--no-dnat")) + { + o_dnat = 0; + debug("o_dnat unset\n"); + continue; + } + + if (CHECKLONG("--no-dnat-strict")) + { + o_dnat = -1; + debug("o_dnat set to -1\n"); + continue; + } + + /* One day, when our command line argument processing is improved, + * and we CHECKLONG() can take optional or required arguments... */ + /* + if (CHECKLONG("--isn")) + { + o_isn = 1; + isn = // XXX + debug("o_dnat set to -1\n"); + continue; + } + */ + + if (strcmp(argv[i], "--") == 0) + break; + + if (argv[i][0] == '-' && argv[i][1] == '-') + { + fprintf(stderr, "Unknown command line argument: %s\n", argv[i]); + usage(); + } + } + + /* ... then handoff to getopt() */ + + opterr = 0; + optstring = "hvdnNi:l:f:Fm:P:p:q:w:s:t:SAE"; + + while ((op = getopt(argc, argv, optstring)) != -1) + switch(op) + { + case 'h': + usage(); + + case 'v': + about(); + + case 'd': + o_debug++; + debug("%s %s, %s\n", PACKAGE, VERSION, TARGET); + debug("Compiled with libpcap %s, libnet %s (API %d)\n", + pcap_version, LIBNET_VERSION, LIBNET_API_VERSION); + break; + + case 'n': + o_numeric = 1; + debug("o_numeric set to 1\n"); + break; + + case 'N': + o_numeric = -1; + debug("o_numeric set to -1\n"); + break; + + case 'i': /* ARG */ + device = optarg; + debug("device set to %s\n", device); + break; + + case 'l': /* ARG */ + o_pktlen = checknumericarg(); + debug("o_pktlen set to %d\n", o_pktlen); + break; + + case 'f': /* ARG */ + o_minttl = checknumericarg(); + debug("o_minttl set to %d\n", o_minttl); + break; + + case 'F': + o_dontfrag = 1; + debug("o_dontfrag set\n"); + break; + + case 'm': /* ARG */ + o_maxttl = checknumericarg(); + debug("o_maxttl set to %d\n", o_maxttl); + break; + + case 'P': /* ARG */ + o_forceport = 1; + case 'p': /* ARG */ + if (getuid()) fatal("Sorry, must be root to use -p\n"); + src_prt = checknumericarg(); + debug("src_prt set to %d\n", src_prt); + break; + + case 'q': /* ARG */ + o_nqueries = checknumericarg(); + debug("o_nqueries set to %d\n", o_nqueries); + break; + + case 'w': /* ARG */ + o_timeout = checknumericarg(); + debug("o_timeout set to %d\n", o_timeout); + break; + + case 's': /* ARG */ + if (getuid()) fatal("Sorry, must be root to use -s\n"); + src = optarg; + break; + + case 't': /* ARG */ + o_tos = checknumericarg(); + debug("o_tos set to %d\n", o_tos); + break; + + case 'S': + o_syn = 1; + debug("o_syn set\n"); + break; + + case 'A': + o_ack = 1; + debug("o_ack set\n"); + break; + + case 'E': + o_ecn = 1; + debug("o_ecn set\n"); + break; + + case '?': + default: + if (optopt != ':' && strchr(optstring, optopt)) + fatal("Argument required for -%c\n", optopt); + fprintf(stderr, "Unknown command line argument: -%c\n", optopt); + usage(); + } + + argc -= optind; + argv += optind; + + switch(argc - 1) + { + case 2: + o_pktlen = atoi(argv[2]); + + case 1: + if (isnumeric(argv[1])) + { + dst_prt = atoi(argv[1]); + } + else + { + struct servent *serv; + + if ((serv = getservbyname(argv[1], "tcp")) == NULL) + fatal("Unknown port: %s\n", argv[1]); + + dst_prt = ntohs(serv->s_port); + } + + case 0: + dst = argv[0]; + break; + + default: + usage(); + } + + if (getuid() & geteuid()) + fatal("Got root?\n"); + + initlibnet(); + defaults(); + initcapture(); + setuid(getuid()); + exitcode = trace(); +#if (LIBNET_API_VERSION >= 110) + libnet_destroy(libnet_context); +#endif + return exitcode; +} diff --git a/probe.c b/probe.c new file mode 100644 index 0000000..4663910 --- /dev/null +++ b/probe.c @@ -0,0 +1,408 @@ +/* -*- Mode: c; tab-width: 4; indent-tabs-mode: 1; c-basic-offset: 4; -*- */ +/* vim:set ts=4 sw=4 ai nobackup nocindent sm: */ + +/* + * tcptraceroute -- A traceroute implementation using TCP packets + * Copyright (c) 2001-2005 Michael C. Toren + * + * 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. + * + * A copy of the GNU GPL is available as /usr/doc/copyright/GPL on Debian + * systems, or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html + * You can also obtain it by writing to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "tcptraceroute.h" + +#if (LIBNET_API_VERSION < 110) + int sockfd; +#else + libnet_t *libnet_context; +#endif + +/* + * Initialize the libnet library context. + */ + +void initlibnet(void) +{ +#if (LIBNET_API_VERSION >= 110) + libnet_context = libnet_init(LIBNET_RAW4, NULL, errbuf); + if (libnet_context == NULL) + fatal("libnet_init() failed: %s\n", errbuf); +#else + /* Nothing to do for libnet-1.0 */ +#endif + return; +} + +/* + * Allocates memory for a new proberecord structure. + */ + +proberecord *newproberecord(void) +{ + proberecord *record; + + record = xrealloc(NULL, sizeof(proberecord)); + record->state = xrealloc(NULL, TEXTSIZE); + record->string = xrealloc(NULL, TEXTSIZE); + return record; +} + +/* + * Destroys a proberecord structure, carefully, as not to leak memory. + */ + +void freeproberecord(proberecord *record) +{ + if (record->string) + free(record->string); + + if (record->state) + free(record->state); + + free(record); +} + +/* + * Request a local unused TCP port from the kernel using bind(2) + */ + +u_short allocateport(u_short requested) +{ + struct sockaddr_in in; + int s, insize; + + if ((s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) + pfatal("socket error"); + + insize = sizeof(in); + memset(&in, 0, insize); + + in.sin_family = AF_INET; + in.sin_port = htons(requested); + + if ((bind(s, (struct sockaddr *)&in, insize)) < 0) + return 0; + + if ((getsockname(s, (struct sockaddr *)&in, &insize)) < 0) + pfatal("getsockname"); + + close(s); + return ntohs(in.sin_port); +} + +/* + * Allocate an IP ID from our pool of unallocated ID's. A cache is kept of + * the last ALLOCATEID_CACHE_SIZE allocations, so we can check for duplicates. + */ + +u_short allocateid(void) +{ + static u_short ids[ALLOCATEID_CACHE_SIZE]; + static int n; + int i, j; + + if ((n = n % ALLOCATEID_CACHE_SIZE) == 0) + { + debug("Generating a new batch of %d IP ID's\n", ALLOCATEID_CACHE_SIZE); + + for(i = 0; i < ALLOCATEID_CACHE_SIZE; i++) + { + for(ids[i] = libnet_get_prand(LIBNET_PRu16), j = i + 1; j < ALLOCATEID_CACHE_SIZE + i; j++) + if (ids[i] == ids[j % ALLOCATEID_CACHE_SIZE]) + ids[i] = libnet_get_prand(LIBNET_PRu16), j = i + 1; + } + } + + return ids[n++]; +} + +/* + * Sends out a TCP SYN packet with the specified TTL, and returns a + * proberecord structure describing the packet sent, so we know what + * to listen for later. A new IP ID is generated for each probe, and + * a new source port if o_trackport is specified. + */ + +void probe(proberecord *record, int ttl, int q) +{ + static u_char *payload; + int i, size, ret; + +#if (LIBNET_API_VERSION < 110) + static u_char *buf; +#else + static libnet_ptag_t ip_tag, tcp_tag, data_tag; +#endif + + size = LIBNET_IPV4_H + LIBNET_TCP_H + o_pktlen; + +#if (LIBNET_API_VERSION < 110) + if (!buf) + { + debug("Initializing packet buffer of %d bytes\n", size); + buf = xrealloc(buf, size); + } + + else + memset(buf, 0, size); +#endif + + /* Initialize the packet payload */ + if (o_pktlen && !payload) + { + debug("Initializing payload of %d bytes\n", o_pktlen); + payload = xrealloc(payload, o_pktlen); + + for(i = 0; i < o_pktlen; i++) + payload[i] = i % ('~' - '!') + '!'; + + debug("Payload: %s\n", sprintable((char *)payload)); + } + + /* Set some values of the probe record */ + record->q = q; + record->ttl = ttl; + record->addr = INADDR_ANY; + record->dnat_ip = INADDR_ANY; + record->src_prt = src_prt; + record->id = allocateid(); + record->delta = 0; + + if (o_trackport) + { + record->src_prt = allocateport(0); + if (record->src_prt == 0) + pfatal("Could not allocate local port: bind"); + } + + if (gettimeofday(&(record->timestamp), NULL) < 0) + pfatal("gettimeofday"); + + /* Build the packet, and send it off into the cold, cruel world */ + +#if (LIBNET_API_VERSION < 110) + libnet_build_ip( + LIBNET_TCP_H+o_pktlen, /* len */ + o_tos, /* tos */ + record->id, /* id */ + o_dontfrag ? IP_DF : 0, /* frag */ + ttl, /* ttl */ + IPPROTO_TCP, /* proto */ + src_ip, /* saddr */ + dst_ip, /* daddr */ + NULL, /* data */ + 0, /* datasize? */ + buf); /* buffer */ + + libnet_build_tcp( + record->src_prt, /* source port */ + dst_prt, /* dest port */ + isn, /* seq number */ + 0, /* ack number */ + + (o_syn ? TH_SYN : 0) | + (o_ack ? TH_ACK : 0) | + (o_ecn ? TH_CWR|TH_ECN : 0), /* control */ + + 0, /* window */ + 0, /* urgent? */ + payload, /* data */ + o_pktlen, /* datasize */ + buf + LIBNET_IPV4_H); /* buffer */ + + libnet_do_checksum(buf, IPPROTO_TCP, LIBNET_TCP_H + o_pktlen); + + /* Write */ + if ((ret = libnet_write_ip(sockfd, buf, size)) < size) + fatal("libnet_write_ip failed? Attempted to write %d bytes, only wrote %d\n", + size, ret); +#else + + /* Add the payload */ + data_tag = libnet_build_data(payload, o_pktlen, libnet_context, data_tag); + + if (data_tag < 0) + fatal("Can't add payload: %s\n", libnet_geterror(libnet_context)); + + /* Add the TCP header */ + tcp_tag = libnet_build_tcp( + record->src_prt, /* source port */ + dst_prt, /* dest port */ + isn, /* seq number */ + 0, /* ack number */ + + (o_syn ? TH_SYN : 0) | + (o_ack ? TH_ACK : 0) | + (o_ecn ? TH_CWR|TH_ECN : 0), /* control */ + + 0, /* window */ + 0, /* checksum TBD */ + 0, /* urgent? */ + LIBNET_TCP_H + o_pktlen, /* TCP PDU size */ + NULL, /* data */ + 0, /* datasize */ + libnet_context, /* libnet context */ + tcp_tag); /* libnet protocol tag */ + + if (tcp_tag < 0) + fatal("Can't build TCP header: %s\n", libnet_geterror(libnet_context)); + + /* Add the IP header */ + ip_tag = libnet_build_ipv4( + size, /* total packet len */ + o_tos, /* tos */ + record->id, /* id */ + o_dontfrag ? IP_DF : 0, /* frag */ + ttl, /* ttl */ + IPPROTO_TCP, /* proto */ + 0, /* checksum TBD */ + src_ip, /* saddr */ + dst_ip, /* daddr */ + NULL, /* data */ + 0, /* datasize? */ + libnet_context, /* libnet context */ + ip_tag); /* libnet protocol tag */ + + if (ip_tag < 0) + fatal("Can't build IP header: %s\n", libnet_geterror(libnet_context)); + + /* Write */ + if ((ret = libnet_write(libnet_context)) < size) + fatal("libnet_write failed? Attempted to write %d bytes, only wrote %d\n", + size, ret); +#endif +} + +/* + * A mess of a function, but it works. The aim is to be as compatible as + * possible with traceroute(8), with the one exception that if for the same hop + * we receive a response from two different hosts, display the second host on a + * new line, as Cisco does. This drastically improves readability when tracing + * through links which have per-packet, round-robin load balancing. + */ + +void showprobe(proberecord *record) +{ + /* Variables to keep state between calls */ + static char laststate[TEXTSIZE]; + static int lastttl; + static u_long lastaddr, lastdnat_ip; + static u_short lastdnat_dport; + + static int everprinthost; // have we ever printed the hostname? + int printhost = 0; // should we print the hostname this time? + + /* kludge to make debug mode usable */ + if (o_debug) + { + fflush(stdout); + fprintf(stderr, "debug: displayed hop\n"); + fflush(stderr); + } + + /* print the DNAT line */ + if ((lastdnat_ip != record->dnat_ip && record->dnat_ip != INADDR_ANY) + || (lastdnat_dport != record->dnat_dport && record->dnat_dport != 0)) + { + /* If lastttl != record->ttl, we're already on a newline */ + if (lastttl == record->ttl) + printf("\n"); + + printf(" Detected DNAT to %s", iptos(record->dnat_ip)); + if (record->dnat_dport) + printf(":%d", ntohs(record->dnat_dport)); + printf("\n"); + + /* Only print the leading four spaces if this is not the start of a new hop */ + if (lastttl == record->ttl) + printf(" "); + + lastdnat_ip = record->dnat_ip; + lastdnat_dport = record->dnat_dport; + printhost = 1; + } + + /* ttl */ + if (lastttl != record->ttl) + { + printf("%2d ", record->ttl); + printhost = 1; + everprinthost = 0; + safe_strncpy(laststate, "", TEXTSIZE); + } + else if (lastaddr != record->addr && record->addr != INADDR_ANY && lastaddr != INADDR_ANY) + { + printf("\n "); + printhost = 1; + } + + /* host */ + if ((printhost || !everprinthost) && record->addr != INADDR_ANY) + { + char buf[TEXTSIZE]; + + if (record->q > 1 && lastaddr == INADDR_ANY) + printf(" "); + + printf("%s", iptohost(record->addr)); + + safe_strncpy(buf, iptohost(record->addr), TEXTSIZE); + if (strncmp(buf, iptos(record->addr), IPTOSBUFSIZ) != 0) + printf(" (%s)", iptos(record->addr)); + + everprinthost = 1; + } + + /* tcp state */ + if ( ((record->ttl != lastttl) && *(record->state)) || + ((record->ttl == lastttl) && *(record->state) && (strncmp(laststate, record->state, TEXTSIZE) != 0))) + { + printf(" [%s]", record->state); + } + + /* space before ms */ + if (! (record->addr == INADDR_ANY && record->q == 1)) + { + /* if timeout, only print one space. otherwise, two */ + if ((record->addr == INADDR_ANY) || (lastaddr == INADDR_ANY && record->q > 1)) + printf(" "); + else + printf(" "); + } + + if (record->addr == INADDR_ANY) + safe_strncpy(record->string, "*", TEXTSIZE); + + if (! record->string) + fatal("something bad happened\n"); + + printf(record->string, record->delta); + + /* If this will be the last probe, print the newline */ + if (record->q == o_nqueries) + printf("\n"); + + lastttl = record->ttl; + lastaddr = record->addr; + if (*(record->state)) + safe_strncpy(laststate, record->state, TEXTSIZE); + + /* kludge to make debug mode usable */ + if (o_debug) + fprintf(stdout, "\n"); + if (o_debug && record->q != o_nqueries) + fprintf(stdout, "\n"); + + fflush(stdout); +} diff --git a/probe.h b/probe.h new file mode 100644 index 0000000..72031d8 --- /dev/null +++ b/probe.h @@ -0,0 +1,57 @@ +/* -*- Mode: c; tab-width: 4; indent-tabs-mode: 1; c-basic-offset: 4; -*- */ +/* vim:set ts=4 sw=4 ai nobackup nocindent sm: */ + +/* + * tcptraceroute -- A traceroute implementation using TCP packets + * Copyright (c) 2001-2005 Michael C. Toren + * + * 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. + * + * A copy of the GNU GPL is available as /usr/doc/copyright/GPL on Debian + * systems, or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html + * You can also obtain it by writing to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#if (LIBNET_API_VERSION < 110) + extern int sockfd; +#else + extern libnet_t *libnet_context; +#endif + +/* ECN (RFC2481) */ +#ifndef TH_ECN +#define TH_ECN 0x40 +#endif +#ifndef TH_CWR +#define TH_CWR 0x80 +#endif + +/* How many IP IDs should allocateid() remember? */ +#define ALLOCATEID_CACHE_SIZE 512 + +/* probe() returns this structure, which describes the probe packet sent */ +typedef struct { + int ttl, q; + u_short id, src_prt, dnat_dport; + struct timeval timestamp; + double delta; + u_long addr, dnat_ip; + char *state; + char *string; +} proberecord; + +proberecord *newproberecord(void); +void freeproberecord(proberecord *); +u_short allocateport(u_short); +u_short allocateid(void); +void showprobe(proberecord *); +void initlibnet(void); +void probe(proberecord *, int, int); diff --git a/tcptra-testsuite.pl b/tcptra-testsuite.pl new file mode 100755 index 0000000..44cc958 --- /dev/null +++ b/tcptra-testsuite.pl @@ -0,0 +1,117 @@ +#!/usr/bin/perl +# vim:set ts=4 sw=4 ai: +# +# (c) Copyright 2003, Michel C. Toren +# mct, Sun Jun 1 23:54:39 EDT 2003 + +use strict; + +my $tcptra = shift || "tcptraceroute"; +my $host = shift || "michael.toren.net"; +my $loopback = shift || "127.0.0.1"; + +print <<"EOT"; + + --------------------------- + tcptraceroute test suite version 1.03 + Please send results to mct\@toren.net + --------------------------- + +The current time is ${\(scalar localtime)} (${\(scalar gmtime)} GMT) + +EOT + +sub findsource($) +{ + use Socket; + my $host = shift; + my $udp = getprotobyname("udp") or die "getprotobyname: $!\n"; + socket(S, PF_INET, SOCK_DGRAM, $udp) or die "scoket: $!\n"; + my $s = sockaddr_in 1, (inet_aton $host or die "Unknown host: $host\n"); + connect S, $s or die "connect: $!\n"; + return inet_ntoa((sockaddr_in getsockname S)[1]); +} + +sub run($) +{ + my $command = shift; + my $output = qx($command); + my $exit = $? >> 8; + my $signal = $? & 127; + $output =~ s/^/> /mg; + $output =~ s/>\s*$//s; + return wantarray ? ($output, $exit, $signal) : $output; +} + +sub uname +{ + print "Executing 'uname -a' to determine system type:\n"; + my ($output, $exit, $signal) = run "uname -a 2>&1"; + print $output; + print "Failed! Exit code $exit", + ($signal ? ", signal $signal" : ""), "\n" + if ($exit != 0); + print "\n"; +} + +sub ver +{ + print "Executing '$tcptra -d -v' to determine version:\n"; + my ($output, $exit, $signal) = run "$tcptra -d -v 2>&1"; + print $output; + print "Failed! Exit code $exit", + ($signal ? ", signal $signal" : ""), "\n" + if ($exit != 0); + print "\n"; +} + +sub trace($) +{ + my $host = shift; + print "Executing '$tcptra $host':\n"; + my ($output, $exit, $signal) = run "$tcptra $host 2>&1"; + print $output; + + print "Failed! Exit code $exit", + ($signal ? ", signal $signal" : ""), "\n" + if ($exit != 0); + + print "\n"; +} + +sub linklayer($) +{ + my $host = shift; + print "Attempting to determine linklayer type used to reach $host...\n"; + my ($output, $exit, $signal) = run "$tcptra -d -f 255 -m 255 -q 1 $host 2>&1"; + + if ($exit != 0) + { + print "Failed! Exit code $exit", + ($signal ? ", signal $signal" : ""), "\n\n"; + return; + } + + my ($snaplen) = ($output =~ /^> debug:\s+.*\s+SNAPLEN: (\d+)/m); + my ($datalink) = ($output =~ /^> debug:\s+.*\s+datalink: (\d+)/m); + my ($datalinkoffset)= ($output =~ /^> debug:\s+.*\s+datalinkoffset: (\d+)/m); + my ($datalinkname) = ($output =~ /^> debug:\s+.*\s+datalinkname: ([^\s]+)/m); + my ($device) = ($output =~ /^> debug:\s+.*\s+device: ([^\s]+)/m); + my ($trackport) = ($output =~ /^> debug:\s+.*\s+o_trackport: ([^\s]+)/m); + my ($noselect) = ($output =~ /^> debug:\s+.*\s+o_noselect: ([^\s]+)/m); + + print "Device $device, type $datalinkname, offset $datalinkoffset, snaplen $snaplen, o_noselect $noselect, o_trackport $trackport\n"; + print "\n"; +} + +uname; +ver; + +print "Warning: findsource($loopback) != $loopback, but instead ", + findsource $loopback, "?\n\n" + unless (findsource $loopback eq $loopback); + +trace "-f 1 -m 1 $loopback"; +trace $host; +trace "-f 1 -m 1 " . findsource $host; +linklayer $host; diff --git a/tcptraceroute.c b/tcptraceroute.c deleted file mode 100644 index 9182376..0000000 --- a/tcptraceroute.c +++ /dev/null @@ -1,2011 +0,0 @@ -/* -*- Mode: c; tab-width: 4; indent-tabs-mode: 1; c-basic-offset: 4; -*- */ -/* vim:set ts=4 sw=4 ai nobackup nocindent sm: */ - -/* - * tcptraceroute -- A traceroute implementation using TCP packets - * Copyright (c) 2001, 2002, 2003 Michael C. Toren - * - * 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. - * - * A copy of the GNU GPL is available as /usr/doc/copyright/GPL on Debian - * systems, or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html - * You can also obtain it by writing to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -/* - * Requires libnet (http://www.packetfactory.net/libnet) and libpcap - * (http://www.tcpdump.org/). - * - * Updates are available from http://michael.toren.net/code/tcptraceroute/ - */ - -#define BANNER "Copyright (c) 2001, 2002, 2003 Michael C. Toren \n\ -Updates are available from http://michael.toren.net/code/tcptraceroute/\n" - -/* - * TODO: - * - * - Command line argument handling could be improved. Currently, - * long options are always processed before short options, which - * means that debugging will always be disabled when long options - * are processed. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef __OpenBSD__ -#include /* Why doesn't OpenBSD deal with this for us? */ -#endif - -#include -#include -#include - -#ifndef SIOCGIFCONF -#include /* Solaris, maybe others? */ -#endif - -#ifndef AF_LINK -#define AF_LINK AF_INET /* BSD defines some AF_INET network interfaces as AF_LINK */ -#endif - -/* ECN (RFC2481) */ -#ifndef TH_ECN -#define TH_ECN 0x40 -#endif -#ifndef TH_CWR -#define TH_CWR 0x80 -#endif - -/* Buffer size used for a few strings, including the pcap filter */ -#define TEXTSIZE 1024 - -/* For compatability with older versions of libnet */ -#if (LIBNET_API_VERSION < 110) -#define LIBNET_IPV4_H LIBNET_IP_H -#define LIBNET_ICMPV4_H LIBNET_ICMP_H -#define LIBNET_DONT_RESOLVE 0 -#define LIBNET_RESOLVE 1 -#define libnet_addr2name4 libnet_host_lookup -#define libnet_ipv4_hdr libnet_ip_hdr -#define libnet_icmpv4_hdr libnet_icmp_hdr -#endif - -#ifndef LIBNET_VERSION -#define LIBNET_VERSION "UNKNOWN" -#endif - -#ifndef LIBNET_ERRBUF_SIZE -#define LIBNET_ERRBUF_SIZE TEXTSIZE -#endif - -/* - * How many bytes should we examine on every packet that comes off the - * wire? This doesn't include the link layer which is accounted for - * later. We're looking only for ICMP and TCP packets, so this should - * work. For ICMP, we also examine the quoted IP header, which is why - * there's a *2 there. The +32 is just to be safe. - */ - -#define SNAPLEN (LIBNET_IPV4_H * 2 + \ - (LIBNET_TCP_H > LIBNET_ICMPV4_H ? LIBNET_TCP_H : LIBNET_ICMPV4_H) + 32) - -/* - * To add support for additional link layers, add entries to the following - * table. The numbers I have in here now I believe are correct, and were - * obtained by looking through other pcap programs, however I have only - * tested tcptraceroute on ethernet, and PPP, and loopback interfaces. - */ - -struct datalinktype { - int type, offset; - char *name; -} datalinktypes[] = { - -#ifdef DLT_RAW - { DLT_RAW, 0, "RAW" }, -#endif -#ifdef DLT_EN10MB - { DLT_EN10MB, 14, "ETHERNET" }, -#endif -#ifdef DLT_PPP - { DLT_PPP, 4, "PPP" }, -#endif -#ifdef DLT_LINUX_SLL - { DLT_LINUX_SLL, 16, "PPP_HDLC" }, -#endif -#ifdef DLT_SLIP - { DLT_SLIP, 16, "SLIP" }, -#endif -#ifdef DLT_PPP_BSDOS - { DLT_PPP_BSDOS, 24, "PPP_BSDOS" }, -#endif -#ifdef DLT_SLIP_BSDOS - { DLT_SLIP_BSDOS, 24, "SLIP_BSDOS" }, -#endif -#ifdef DLT_FDDI - { DLT_FDDI, 21, "FDDI" }, -#endif -#ifdef DLT_IEEE802 - { DLT_IEEE802, 22, "IEEE802" }, -#endif -#ifdef DLT_NULL - { DLT_NULL, 4, "DLT_NULL" }, -#endif -#ifdef DLT_LOOP - { DLT_LOOP, 4, "DLT_LOOP" }, -#endif -#ifdef DLT_PPP_ETHER - { DLT_PPP_ETHER, 12, "PPP_ETHER" }, -#endif - - /* Does anyone know correct values for these? */ -#ifdef DLT_ATM_RFC1483 - { DLT_ATM_RFC1483, -1, "ATM_RFC1483" }, -#endif -#ifdef DLT_EN3MB - { DLT_EN3MB, -1, "EN3MB" }, -#endif -#ifdef DLT_AX25 - { DLT_AX25, -1, "AX25" }, -#endif -#ifdef DLT_PRONET - { DLT_PRONET, -1, "PRONET" }, -#endif -#ifdef DLT_CHAOS - { DLT_CHAOS, -1, "CHAOS" }, -#endif -#ifdef DLT_ARCNET - { DLT_ARCNET, -1, "ARCNET" }, -#endif - - /* End of the road */ - { -1, -1, NULL } -}; - -/* Various globals */ -u_long dst_ip, src_ip; -u_short src_prt, dst_prt; -char *device, *name, *dst, *src; -char dst_name[TEXTSIZE], dst_prt_name[TEXTSIZE], filter[TEXTSIZE]; -pcap_t *pcap; -int pcap_fd; -int datalink, offset; -int o_minttl, o_maxttl, o_timeout, o_debug, o_numeric, o_pktlen, - o_nqueries, o_dontfrag, o_tos, o_forceport, o_syn, o_ack, o_ecn, - o_nofilter, o_nogetinterfaces, o_noselect, o_trackport; - -char errbuf [PCAP_ERRBUF_SIZE > LIBNET_ERRBUF_SIZE ? - PCAP_ERRBUF_SIZE : LIBNET_ERRBUF_SIZE]; - -#if (LIBNET_API_VERSION < 110) - int sockfd; -#else - libnet_t *libnet_context; -#endif - - -/* interface linked list, built later by getinterfaces() */ -struct interface_entry { - char *name; - u_long addr; - struct interface_entry *next; -} *interfaces; - -/* probe() returns this structure, which describes the packet sent */ -typedef struct { - int ttl, q; - u_short id, src_prt; - struct timeval timestamp; - double delta; - u_long addr; - char *state; - char *string; -} proberecord; - -extern char *optarg; -extern int optind, opterr, optopt; -extern char pcap_version[]; -extern int errno; - -/* - * fatal() and pfatal() are useful stdarg functions from - * namp. debug() and warn() are based on them. - */ - -void fatal(char *fmt, ...) -{ - va_list ap; - fflush(stdout); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - exit(1); -} - -void debug(char *fmt, ...) -{ - va_list ap; - if (! o_debug) return; - fflush(stdout); - fprintf(stderr, "debug: "); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fflush(stderr); -} - -void warn(char *fmt, ...) -{ - va_list ap; - fflush(stdout); - fprintf(stderr, "Warning: "); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fflush(stderr); -} - -void pfatal(char *err) -{ - debug("errno == %d\n", errno); - fflush(stdout); - perror(err); - exit(1); -} - -void usage(void) -{ - printf("\n%s %s\n%s\n", PACKAGE, VERSION, BANNER); - fatal("Usage: %s [-nNFSAE] [-i ] [-f ]\n [-l ] [-q ] [-t ]\n [-m ] [-pP] ] [-s ]\n [-w ] [destination port] [packet length]\n\n", name); -} - -void about(void) -{ - printf("\n%s %s\n%s\n", PACKAGE, VERSION, BANNER); - exit(0); -} - -/* - * realloc(3) or bust! - */ - -void *xrealloc(void *oldp, int size) -{ - void *p; - - if (!oldp) - /* Kludge for SunOS, which doesn't allow realloc on a NULL pointer */ - p = malloc(size); - else - p = realloc(oldp, size); - - if (!p) - fatal("Out of memory! Could not reallocate %d bytes!\n", size); - - memset(p, 0, size); - return p; -} - -/* - * Same as strncpy and snprintf, but always be sure the result is terminated. - */ - -char *safe_strncpy(char *dst, char *src, int size) -{ - dst[size-1] = '\0'; - return strncpy(dst, src, size-1); -} - -int safe_snprintf(char *s, int size, char *fmt, ...) -{ - va_list ap; - int ret; - - va_start(ap, fmt); - ret = vsnprintf(s, size, fmt, ap); - s[size-1] = '\0'; - va_end(ap); - - return ret; -} - -/* - * return a pointer to a string containing only the - * printable characters of the string passed to it. - */ - -char *sprintable(char *s) -{ - static char buf[TEXTSIZE]; - int i; - - if (s && s[0]) - safe_strncpy(buf, s, TEXTSIZE); - else - safe_strncpy(buf, "(empty)", TEXTSIZE); - - for (i = 0; buf[i]; i++) - if (! isprint((u_char) buf[i])) - buf[i] = '?'; - - return buf; -} - -/* - * isdigit() across an entire string. - */ - -int isnumeric(char *s) -{ - int i; - - if (!s || !s[0]) - return 0; - - for (i = 0; s[i]; i++) - if (! isdigit((u_char) s[i])) - return 0; - - return 1; -} - -int datalinkoffset(int type) -{ - int i; - - for (i = 0; datalinktypes[i].name; i++) - if (datalinktypes[i].type == type) - return datalinktypes[i].offset; - - return -1; -} - -char *datalinkname(int type) -{ - static char name[TEXTSIZE]; - int i; - - for (i = 0; datalinktypes[i].name; i++) - if (datalinktypes[i].type == type) - return datalinktypes[i].name; - - safe_snprintf(name, TEXTSIZE, "#%d", type); - return name; -} - -/* - * Compute the difference between two timeval structures. - */ - -struct timeval tvdiff(struct timeval *tv1, struct timeval *tv2) -{ - struct timeval tvdiff; - - tvdiff.tv_sec = tv1->tv_sec - tv2->tv_sec; - tvdiff.tv_usec = tv1->tv_usec - tv2->tv_usec; - - if ((tvdiff.tv_sec > 0) && (tvdiff.tv_usec < 0)) - { - tvdiff.tv_usec += 1000000L; - tvdiff.tv_sec--; - } - - else if ((tvdiff.tv_sec < 0) && (tvdiff.tv_usec > 0)) - { - tvdiff.tv_usec -= 1000000L; - tvdiff.tv_sec++; - } - - return tvdiff; -} - -/* - * Is the timeval less than, equal to, or greater than zero? - */ - -int tvsign(struct timeval *tv) -{ - if (tv->tv_sec < 0) return -1; - - if (tv->tv_sec == 0) - { - if (tv->tv_usec < 0) return -1; - if (tv->tv_usec == 0) return 0; - if (tv->tv_usec > 0) return 1; - } - - if (tv->tv_sec > 0) return 1; - - return -1; -} - -/* - * Inspired by libnet_host_lookup(), but I needed more than 2 buffers while - * I was debugging. I really could get by with only 2 now, but *shrug*. - */ - -#define IPTOSBUFFERS 12 -char *iptos(u_long in) -{ - static char output[IPTOSBUFFERS][3*4+3+1]; - static short which; - u_char *p; - - p = (u_char *)∈ - which = (which + 1 == IPTOSBUFFERS ? 0 : which + 1); - safe_snprintf(output[which], 3*4+3+1, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); - return output[which]; -} - -/* - * A wrapper for libnet_addr2name4(), with the option not to resolve - * RFC1918 space. - */ - -char *iptohost(u_long in) -{ - u_char *p = (u_char *)∈ - - if ((o_numeric > -1) && - ((p[0] == 10) || - (p[0] == 192 && p[1] == 168) || - (p[0] == 172 && p[1] >= 16 && p[1] <= 31))) - { - debug("Not attempting to resolve RFC1918 address %s\n", iptos(in)); - return iptos(in); - } - - return (char *)libnet_addr2name4(in, - o_numeric > 0 ? LIBNET_DONT_RESOLVE : LIBNET_RESOLVE); -} - -/* - * A generic wrapper for libnet_name_resolve and libnet_name2addr4, because - * it's annoying to have #ifdef's all over the place to support both versions - * of libnet. - */ - -#if (LIBNET_API_VERSION < 110) -#define hosttoip(hostname, numeric) \ - libnet_name_resolve((u_char *)hostname, numeric) -#else -#define hosttoip(hostname, numeric) \ - libnet_name2addr4(libnet_context, (u_char *)hostname, numeric) -#endif - -/* - * Allocates memory for a new proberecord structure. - */ - -proberecord *newproberecord(void) -{ - proberecord *record; - - record = xrealloc(NULL, sizeof(proberecord)); - record->state = xrealloc(NULL, TEXTSIZE); - record->string = xrealloc(NULL, TEXTSIZE); - return record; -} - -/* - * Destroys a proberecord structure, carefully, as not to leak memory. - */ - -void freeproberecord(proberecord *record) -{ - if (record->string) - free(record->string); - - if (record->state) - free(record->state); - - free(record); -} - -/* - * Fetches the interface list, storing it in struct interface_entry interfaces. - */ - -void getinterfaces(void) -{ - struct interface_entry *p; - struct ifconf ifc; - struct ifreq *ifrp, ifr; - int numreqs, i, s; - u_long addr; - int salen; - char *x; - - debug("entering getinterfaces()\n"); - - if (o_nogetinterfaces) - { - debug("Not fetching the interface list\n"); - return; - } - - if (interfaces) - fatal("Double call to getinterfaces()\n"); - - ifc.ifc_buf = NULL; - p = NULL; - - numreqs = 32; - - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - fatal("socket error"); - - debug("ifreq buffer set to %d\n", numreqs); - - for (;;) - { - ifc.ifc_len = sizeof(struct ifreq) * numreqs; - ifc.ifc_buf = xrealloc(ifc.ifc_buf, ifc.ifc_len); - - if (ioctl(s, SIOCGIFCONF, &ifc) < 0) - pfatal("ioctl"); - - /* This "+ sizeof(struct ifreq) + 64" crap seems to be an (Open?)BSDism. */ - if ( (ifc.ifc_len + sizeof(struct ifreq) + 64) >= (sizeof(struct ifreq) * numreqs) ) - { - /* Assume it overflowed and try again */ - numreqs += 32; - if (numreqs > 20000) - break; /* Too big! */ - debug("ifreq buffer grown to %d\n", numreqs); - continue; - } - - break; - } - - debug("Successfully retrieved interface list\n"); - -#ifdef HAVE_SOCKADDR_SA_LEN - debug("Using HAVE_SOCKADDR_SA_LEN method for finding addresses.\n"); -#endif - - for (x = ifc.ifc_buf; x < (ifc.ifc_buf + ifc.ifc_len); x += salen) - { - ifrp = (struct ifreq *)x; - - memset(&ifr, 0, sizeof(struct ifreq)); - strcpy(ifr.ifr_name, ifrp->ifr_name); - -#ifdef HAVE_SOCKADDR_SA_LEN - - salen = sizeof(ifrp->ifr_name) + ifrp->ifr_addr.sa_len; - if (salen < sizeof(*ifrp)) - salen = sizeof(*ifrp); - - addr = ((struct sockaddr_in *)&ifrp->ifr_addr)->sin_addr.s_addr; - if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) - pfatal("ioctl(SIOCGIFFLAGS)"); - -#else /* HAVE_SOCKADDR_SA_LEN */ - - salen = sizeof(*ifrp); - - if (ioctl(s, SIOCGIFADDR, &ifr) < 0) - { - debug("ioctl(SIOCGIFADDR) on unconfigured interface %s failed; skipping\n", - sprintable(ifr.ifr_name)); - continue; - } - addr = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr.s_addr; - -#endif /* HAVE_SOCKADDR_SA_LEN else */ - -#ifdef AF_INET6 - if (ifrp->ifr_addr.sa_family == AF_INET6) - { - debug("Ignoring AF_INET6 address on interface %s\n", - sprintable(ifr.ifr_name)); - continue; - } -#endif - - if (ifrp->ifr_addr.sa_family != AF_INET && - ifrp->ifr_addr.sa_family != AF_LINK) - { - debug("Ignoring non-AF_INET address on interface %s\n", - sprintable(ifr.ifr_name)); - continue; - } - - if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) - pfatal("ioctl(SIOCGIFFLAGS)"); - if ((ifr.ifr_flags & IFF_UP) == 0) - { - debug("Ignoring down interface %s\n", - sprintable(ifr.ifr_name)); - continue; - } - - /* Deal with virtual hosts */ - for (i = 0; ifr.ifr_name[i]; i++) - if (ifr.ifr_name[i] == ':') - ifr.ifr_name[i] = '\0'; - - /* Grow another node on the linked list... */ - if (!p) - p = interfaces = xrealloc(NULL, sizeof(struct interface_entry)); - else - p = p->next = xrealloc(NULL, sizeof(struct interface_entry)); - - p->next = NULL; - - /* ... and fill it in */ - p->addr = addr; - p->name = xrealloc(NULL, strlen(ifr.ifr_name) + 1); - strcpy(p->name, ifr.ifr_name); - - debug("Discovered interface %s with address %s\n", - sprintable(p->name), iptos(p->addr)); - } - - free(ifc.ifc_buf); - debug("leaving getinterfaces()\n"); -} - -/* - * Determines the source address that should be used to reach the - * given destination address. - */ - -u_long findsrc(u_long dest) -{ - struct sockaddr_in sinsrc, sindest; - int s, size; - - if ((s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) - pfatal("socket error"); - - memset(&sinsrc, 0, sizeof(struct sockaddr_in)); - memset(&sindest, 0, sizeof(struct sockaddr_in)); - - sindest.sin_family = AF_INET; - sindest.sin_addr.s_addr = dest; - sindest.sin_port = htons(53); /* can be anything */ - - if (connect(s, (struct sockaddr *)&sindest, sizeof(sindest)) < 0) - pfatal("connect"); - - size = sizeof(sinsrc); - if (getsockname(s, (struct sockaddr *)&sinsrc, &size) < 0) - pfatal("getsockname"); - - close(s); - debug("Determined source address of %s to reach %s\n", - iptos(sinsrc.sin_addr.s_addr), iptos(dest)); - return sinsrc.sin_addr.s_addr; -} - -/* - * Find an appropriate device to use given the specified source address. - * However, if we find an interface matching the global dst_ip address, set - * the source address we're looking for to 127.0.0.1 in an attempt to select - * the loopback. Ofcourse, this entirely depends on the fact that a loopback - * interface exists with an address of 127.0.0.1. - */ - -char *finddev(u_long with_src) -{ - struct interface_entry *p; - char *device = NULL; - - debug("entering finddev()\n"); - - /* First, see if we're trying to trace to ourself */ - for (p = interfaces; p; p = p->next) - if (p->addr == dst_ip) - { - debug("Destination matches local address of interface %s;\n\tattempting to find loopback interface, o_nofilter set\n", p->name); - with_src = hosttoip("127.0.0.1", LIBNET_DONT_RESOLVE); - o_nofilter = 1; - } - - for (p = interfaces; p; p = p->next) - if (p->addr == with_src) - device = p->name; - - debug("finddev() returning %s\n", device); - return device; -} - - -/* - * Request a local unused TCP port from the kernel using bind(2) - */ - -u_short allocateport(u_short requested) -{ - struct sockaddr_in in; - int s, insize; - - if ((s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) - pfatal("socket error"); - - insize = sizeof(in); - memset(&in, 0, insize); - - in.sin_family = AF_INET; - in.sin_port = htons(requested); - - if ((bind(s, (struct sockaddr *)&in, insize)) < 0) - return 0; - - if ((getsockname(s, (struct sockaddr *)&in, &insize)) < 0) - pfatal("getsockname"); - - close(s); - return ntohs(in.sin_port); -} - -/* - * Allocate an IP ID from our pool of unallocated ID's. A cache is kept of - * the last ALLOCATEID_CACHE_SIZE allocations, so we can check for duplicates. - */ - -#ifndef ALLOCATEID_CACHE_SIZE -#define ALLOCATEID_CACHE_SIZE 512 -#endif - -u_short allocateid(void) -{ - static u_short ids[ALLOCATEID_CACHE_SIZE]; - static int n; - int i, j; - - if ((n = n % ALLOCATEID_CACHE_SIZE) == 0) - { - debug("Generating a new batch of %d IP ID's\n", ALLOCATEID_CACHE_SIZE); - - for(i = 0; i < ALLOCATEID_CACHE_SIZE; i++) - { - for(ids[i] = libnet_get_prand(LIBNET_PRu16), j = i + 1; j < ALLOCATEID_CACHE_SIZE + i; j++) - if (ids[i] == ids[j % ALLOCATEID_CACHE_SIZE]) - ids[i] = libnet_get_prand(LIBNET_PRu16), j = i + 1; - } - } - - return ids[n++]; -} - - -/* - * What a kludge, but it works. The aim is to be as compatible as possible - * with traceroute(8), with the one exception that if for the same hop we - * receive a response from two different hosts, display the second host on - * a new line, as Cisco does. This drastically improves readability when - * tracing through links which have per-packet, round-robin load balancing. - */ - -void showprobe(proberecord *record) -{ - /* Variables to keep state between calls */ - static char laststate[TEXTSIZE]; - static int lastttl; - static u_long lastaddr; - static int everprint; - - int printflag = 0; - - /* kludge to make debug mode usable */ - if (o_debug) - { - fflush(stdout); - fprintf(stderr, "debug: displayed hop\n"); - fflush(stderr); - } - - /* ttl */ - if (lastttl != record->ttl) - { - printf("%2d ", record->ttl); - printflag = 1; - everprint = 0; - safe_strncpy(laststate, "", TEXTSIZE); - } - else if (lastaddr != record->addr && record->addr != INADDR_ANY && lastaddr != INADDR_ANY) - { - printf("\n "); - printflag = 1; - } - - /* host */ - if ((printflag || !everprint) && record->addr != INADDR_ANY) - { - if (record->q > 1 && lastaddr == INADDR_ANY) - printf(" "); - - printf("%s (%s)", iptohost(record->addr), iptos(record->addr)); - everprint = 1; - } - - /* tcp state */ - if ( ((record->ttl != lastttl) && *(record->state)) || - ((record->ttl == lastttl) && *(record->state) && (strncmp(laststate, record->state, TEXTSIZE) != 0))) - { - printf(" [%s]", record->state); - } - - /* space before ms */ - if (! (record->addr == INADDR_ANY && record->q == 1)) - { - /* if timeout, only print one space. otherwise, two */ - if ((record->addr == INADDR_ANY) || (lastaddr == INADDR_ANY && record->q > 1)) - printf(" "); - else - printf(" "); - } - - if (record->addr == INADDR_ANY) - safe_strncpy(record->string, "*", TEXTSIZE); - - if (! record->string) - fatal("something bad happened\n"); - - printf(record->string, record->delta); - - if (record->q == o_nqueries) - printf("\n"); - - lastttl = record->ttl; - lastaddr = record->addr; - if (*(record->state)) - safe_strncpy(laststate, record->state, TEXTSIZE); - - /* kludge to make debug mode usable */ - if (o_debug) - fprintf(stdout, "\n"); - if (o_debug && record->q != o_nqueries) - fprintf(stdout, "\n"); - - fflush(stdout); -} - -/* - * Useful for debugging; dump #define's and command line options. - */ - -void debugoptions(void) -{ - if (! o_debug) - return; - - debug("debugoptions():\n"); - - /* - * TEXTSIZE SNAPLEN IPTOSBUFFERS ALLOCATEID_CACHE_SIZE device datalink - * datalinkname(datalink) datalinkoffset(datalink) o_minttl o_maxttl - * o_timeout o_debug o_numeric o_pktlen o_nqueries o_dontfrag o_tos - * o_forceport o_syn o_ack o_ecn o_nofilter o_nogetinterfaces o_trackport - */ - - debug("%16s: %-2d %14s: %-2d %16s: %-2d\n", - "TEXTSIZE", TEXTSIZE, - "SNAPLEN", SNAPLEN, - "IPTOSBUFFERS", IPTOSBUFFERS); - - debug("%16s: %-2d %16s: %-2d %16s: %-2d\n", - "ALLOCATEID_CACHE", ALLOCATEID_CACHE_SIZE, - "datalink", datalink, - "datalinkoffset", datalinkoffset(datalink)); - - debug("%16s: %-2d %16s: %-2d %16s: %-2d\n", - "o_minttl", o_minttl, - "o_maxttl", o_maxttl, - "o_timeout", o_timeout); - - debug("%16s: %-2d %16s: %-2d %16s: %-2d\n", - "o_debug", o_debug, - "o_numeric", o_numeric, - "o_pktlen", o_pktlen); - - debug("%16s: %-2d %16s: %-2d %16s: %-2d\n", - "o_nqueries", o_nqueries, - "o_dontfrag", o_dontfrag, - "o_tos", o_tos); - - debug("%16s: %-2d %16s: %-2d %16s: %-2d\n", - "o_forceport", o_forceport, - "o_syn", o_syn, - "o_ack", o_ack); - - debug("%16s: %-2d %16s: %d %16s: %-2d\n", - "o_ecn", o_ecn, - "o_nofilter", o_nofilter, - "o_nogetinterfaces", o_nogetinterfaces); - - debug("%16s: %-2d %16s: %-12s %s: %s\n", - "o_trackport", o_trackport, - "datalinkname", datalinkname(datalink), - "device", device); - - debug("%16s: %-2d\n", - "o_noselect", o_noselect); -} - -/* - * Check command line arguments for sanity, and fill in the blanks. - */ - -void defaults(void) -{ - struct servent *serv; - u_long recommended_src; - - getinterfaces(); - - if ((dst_ip = hosttoip(dst, LIBNET_RESOLVE)) == 0xFFFFFFFF) - fatal("Bad destination address: %s\n", dst); - - recommended_src = findsrc(dst_ip); - - if (src) - { - if ((src_ip = hosttoip(src, LIBNET_RESOLVE)) == 0xFFFFFFFF) - fatal("Bad source address: %s\n", src); - } - else - { - src_ip = recommended_src; - } - - if (device == NULL) - /* not specified on command line */ - device = finddev(recommended_src); - - if (device == NULL) - { - /* couldn't find an appropriate interface */ - warn("Could not determine appropriate device; resorting to pcap_lookupdev()\n"); - device = pcap_lookupdev(errbuf); - } - - if (device == NULL) - fatal("Could not determine device via pcap_lookupdev(): %\n", errbuf); - - if ((pcap = pcap_open_live(device, 0, 0, 0, errbuf)) == NULL) - fatal("error opening device %s: %s\n", device, errbuf); - - datalink = pcap_datalink(pcap); - offset = datalinkoffset(datalink); - - if (offset < 0) - fatal("Sorry, media type of device %s (%s) is not supported\n", - device, datalinkname(datalink)); - - pcap_close(pcap); - - if (src_prt && o_trackport) - { - warn("--track-id implied by specifying the local source port\n"); - o_trackport = 0; - } - - if (! o_trackport) - { -#ifdef HAVE_SOLARIS - warn("--track-id is unlikely to work on Solaris\n"); -#endif - - if (! o_forceport) - src_prt = allocateport(src_prt); - - if (src_prt == 0) - fatal("Sorry, requested local port is already in use. Use -P, instead of -p, to override.\n"); - } - - if (o_minttl <= 0 || o_maxttl <= 0) - fatal("TTL must be greater than 0\n"); - - if (o_minttl >= 256 || o_maxttl >= 256) - fatal("TTL must be less than 256\n"); - - if (o_minttl > o_maxttl) - fatal("Minimum TTL (%d) must be less than maximum TTL (%d)\n", - o_minttl, o_maxttl); - - if (o_nqueries <= 0) - fatal("Number of queries must be at least 1\n"); - - if (o_timeout <= 0) - fatal("Timeout must be at least 1\n"); - - if (o_pktlen < LIBNET_TCP_H + LIBNET_IPV4_H) - { - if (o_pktlen != 0) - warn("Increasing packet length to %d bytes\n", LIBNET_TCP_H + LIBNET_IPV4_H); - o_pktlen = 0; - } - else - o_pktlen -= (LIBNET_TCP_H + LIBNET_IPV4_H); - -#if (LIBNET_API_VERSION < 110) - if ((sockfd = libnet_open_raw_sock(IPPROTO_RAW)) < 0) - pfatal("socket allocation"); -#endif - -#if (LIBNET_API_VERSION < 110) - libnet_seed_prand(); -#else - libnet_seed_prand(libnet_context); -#endif - - if (strcmp(dst, iptos(dst_ip)) == 0) - safe_snprintf(dst_name, TEXTSIZE, "%s", dst); - else - safe_snprintf(dst_name, TEXTSIZE, "%s (%s)", dst, iptos(dst_ip)); - - if ((serv = getservbyport(dst_prt, "tcp")) == NULL) - safe_snprintf(dst_prt_name, TEXTSIZE, "%d", dst_prt); - else - safe_snprintf(dst_prt_name, TEXTSIZE, "%d (%s)", dst_prt, serv->s_name); - - if (! (o_syn|o_ack)) - { - debug("Setting o_syn, in absence of either o_syn or o_ack\n"); - o_syn = 1; - } - - debugoptions(); - - fprintf(stderr, "Selected device %s, address %s", device, iptos(src_ip)); - if (! o_trackport) fprintf(stderr, ", port %d", src_prt); - fprintf(stderr, " for outgoing packets\n"); -} - -/* - * Initialize the libnet library context. - */ - -void initlibnet() -{ -#if (LIBNET_API_VERSION >= 110) - libnet_context = libnet_init(LIBNET_RAW4, NULL, errbuf); - if (libnet_context == NULL) - fatal("libnet_init() failed: %s\n", errbuf); -#else - /* Nothing to do for libnet-1.0 */ -#endif - return; -} - -/* - * Open the pcap listening device, and apply our filter. - */ - -void initcapture(void) -{ - struct bpf_program fcode; - bpf_u_int32 localnet, netmask; - - if (! (pcap = pcap_open_live(device, offset + SNAPLEN, 0, 10, errbuf))) - fatal("pcap_open_live failed: %s", errbuf); - - safe_snprintf(filter, TEXTSIZE, "\n (tcp and src host %s and src port %d and dst host %s)\n or ((icmp[0] == 11 or icmp[0] == 3) and dst host %s)", - iptos(dst_ip), dst_prt, iptos(src_ip), iptos(src_ip)); - - if (o_nofilter) - filter[0] = '\0'; - - debug("pcap filter is: %s\n", o_nofilter ? "(nothing)" : filter); - - if (pcap_lookupnet(device, &localnet, &netmask, errbuf) < 0) - { - warn("pcap_lookupnet failed: %s\n", errbuf); - localnet = 0; - netmask = 0; - } - - if (pcap_compile(pcap, &fcode, filter, 1, netmask) < 0) - fatal("filter compile failed: %s", pcap_geterr(pcap)); - - if (pcap_setfilter(pcap, &fcode) < 0) - fatal("pcap_setfilter failed\n"); - - pcap_fd = pcap_fileno(pcap); - if (fcntl(pcap_fd, F_SETFL, O_NONBLOCK) < 0) - pfatal("fcntl(F_SETFL, O_NONBLOCK) failed"); - - pcap_freecode(&fcode); -} - -/* - * Sends out a TCP SYN packet with the specified TTL, and returns a - * proberecord structure describing the packet sent, so we know what - * to listen for later. A new IP ID is generated for each probe, and - * a new source port if o_trackport is specified. - */ - -void probe(proberecord *record, int ttl, int q) -{ - static u_char *payload; - int i, size, ret; - -#if (LIBNET_API_VERSION < 110) - static u_char *buf; -#else - static libnet_ptag_t ip_tag, tcp_tag, data_tag; -#endif - - size = LIBNET_IPV4_H + LIBNET_TCP_H + o_pktlen; - -#if (LIBNET_API_VERSION < 110) - if (!buf) - { - debug("Initializing packet buffer of %d bytes\n", size); - buf = xrealloc(buf, size); - } - - else - memset(buf, 0, size); -#endif - - /* Initialize the packet payload */ - if (o_pktlen && !payload) - { - debug("Initializing payload of %d bytes\n", o_pktlen); - payload = xrealloc(payload, o_pktlen); - - for(i = 0; i < o_pktlen; i++) - payload[i] = i % ('~' - '!') + '!'; - - debug("Payload: %s\n", sprintable((char *)payload)); - } - - /* Set some values of the probe record */ - record->q = q; - record->ttl = ttl; - record->addr = INADDR_ANY; - record->src_prt = src_prt; - record->id = allocateid(); - record->delta = 0; - - if (o_trackport) - { - record->src_prt = allocateport(0); - if (record->src_prt == 0) - pfatal("Could not allocate local port: bind"); - } - - if (gettimeofday(&(record->timestamp), NULL) < 0) - pfatal("gettimeofday"); - - /* Build the packet, and send it off into the cold, cruel world */ - -#if (LIBNET_API_VERSION < 110) - libnet_build_ip( - LIBNET_TCP_H+o_pktlen, /* len */ - o_tos, /* tos */ - record->id, /* id */ - o_dontfrag ? IP_DF : 0, /* frag */ - ttl, /* ttl */ - IPPROTO_TCP, /* proto */ - src_ip, /* saddr */ - dst_ip, /* daddr */ - NULL, /* data */ - 0, /* datasize? */ - buf); /* buffer */ - - libnet_build_tcp( - record->src_prt, /* source port */ - dst_prt, /* dest port */ - 0, /* seq number */ - 0, /* ack number */ - - (o_syn ? TH_SYN : 0) | - (o_ack ? TH_ACK : 0) | - (o_ecn ? TH_CWR|TH_ECN : 0), /* control */ - - 0, /* window */ - 0, /* urgent? */ - payload, /* data */ - o_pktlen, /* datasize */ - buf + LIBNET_IPV4_H); /* buffer */ - - libnet_do_checksum(buf, IPPROTO_TCP, LIBNET_TCP_H + o_pktlen); - - /* Write */ - if ((ret = libnet_write_ip(sockfd, buf, size)) < size) - fatal("libnet_write_ip failed? Attempted to write %d bytes, only wrote %d\n", - size, ret); -#else - - /* Add the payload */ - data_tag = libnet_build_data(payload, o_pktlen, libnet_context, data_tag); - - if (data_tag < 0) - fatal("Can't add payload: %s\n", libnet_geterror(libnet_context)); - - /* Add the TCP header */ - tcp_tag = libnet_build_tcp( - record->src_prt, /* source port */ - dst_prt, /* dest port */ - 0, /* seq number */ - 0, /* ack number */ - - (o_syn ? TH_SYN : 0) | - (o_ack ? TH_ACK : 0) | - (o_ecn ? TH_CWR|TH_ECN : 0), /* control */ - - 0, /* window */ - 0, /* checksum TBD */ - 0, /* urgent? */ - LIBNET_TCP_H + o_pktlen, /* TCP PDU size */ - NULL, /* data */ - 0, /* datasize */ - libnet_context, /* libnet context */ - tcp_tag); /* libnet protocol tag */ - - if (tcp_tag < 0) - fatal("Can't build TCP header: %s\n", libnet_geterror(libnet_context)); - - /* Add the IP header */ - ip_tag = libnet_build_ipv4( - size, /* total packet len */ - o_tos, /* tos */ - record->id, /* id */ - o_dontfrag ? IP_DF : 0, /* frag */ - ttl, /* ttl */ - IPPROTO_TCP, /* proto */ - 0, /* checksum TBD */ - src_ip, /* saddr */ - dst_ip, /* daddr */ - NULL, /* data */ - 0, /* datasize? */ - libnet_context, /* libnet context */ - ip_tag); /* libnet protocol tag */ - - if (ip_tag < 0) - fatal("Can't build IP header: %s\n", libnet_geterror(libnet_context)); - - /* Write */ - if ((ret = libnet_write(libnet_context)) < size) - fatal("libnet_write failed? Attempted to write %d bytes, only wrote %d\n", - size, ret); -#endif -} - - -/* - * Horrible macro kludge, to be called only from capture(), for architectures - * such as sparc that don't allow non-aligned memory access. The idea is to - * malloc new space (which is guaranteed to be properly aligned), copy the - * packet we want to parse there, then cast the packet header struct against - * the new, aligned space. - */ - -#define ALIGN_PACKET(dest, cast, offset) do { \ - static u_char *buf; \ - if (buf == NULL) buf = xrealloc(NULL, SNAPLEN - (offset)); \ - memcpy(buf, packet + (offset), len - (offset)); \ - dest = (struct cast *)buf; \ - } while (0) /* no semi-colon */ - -/* - * Listens for responses to our probe matching the specified proberecord - * structure. Returns 1 if the destination was reached, or 0 if we need to - * increment the TTL some more. - */ - -int capture(proberecord *record) -{ - u_char *packet; - struct pcap_pkthdr packet_hdr; - struct libnet_ipv4_hdr *ip_hdr; - struct timeval start, now, timepassed, timeout_tv, timeleft; - int firstpass, ret, len; - double delta; - fd_set sfd; - - firstpass = 1; - timeout_tv.tv_sec = o_timeout; - timeout_tv.tv_usec = 0; - - if (gettimeofday(&start, NULL) < 0) - pfatal("gettimeofday"); - - for(;;) - { - if (firstpass) - { - firstpass = 0; - timeleft = timeout_tv; - } - else - { - if (gettimeofday(&now, NULL) < 0) - pfatal("gettimeofday"); - - timepassed = tvdiff(&now, &start); - - if (tvsign(&timepassed) < 0) - { - /* Deal with weird clock skew */ - timepassed.tv_sec = 0; - timepassed.tv_usec = 0; - } - - timeleft = tvdiff(&timeout_tv, &timepassed); - - if (tvsign(&timeleft) <= 0) - { - debug("timeout\n"); - return 0; - } - } - - /* - * The libpcap documentation is wrong; pcap_fileno actually - * returns the fd of the live capture device, not the save - * file. References: - * - * http://www.tcpdump.org/lists/workers/2001/01/msg00223.html - * http://www.tcpdump.org/lists/workers/2001/03/msg00107.html - * http://www.tcpdump.org/lists/workers/2001/03/msg00109.html - * http://www.tcpdump.org/lists/workers/2001/03/msg00110.html - */ - - FD_ZERO(&sfd); - FD_SET(pcap_fd, &sfd); - - ret = o_noselect ? 1 : select(pcap_fd + 1, &sfd, NULL, NULL, &timeleft); - - if (ret < 0) - { - fatal("select"); - } - else if (ret == 0) - { - debug("select() timeout\n"); - continue; - } - - if ((packet = (u_char *)pcap_next(pcap, &packet_hdr)) == NULL) - { - debug("null pointer from pcap_next()\n"); - continue; - } - - packet += offset; - len = packet_hdr.caplen - offset; - - debug("received %d byte IP packet from pcap_next()\n", len); - - if (len < LIBNET_IPV4_H) - { - debug("Ignoring partial IP packet\n"); - continue; - } - - if (len > SNAPLEN) - { - debug("Packet received is larger than our snaplen? Ignoring\n", SNAPLEN); - continue; - } - - ALIGN_PACKET(ip_hdr, libnet_ipv4_hdr, 0); - - if (ip_hdr->ip_v != 4) - { - debug("Ignoring non-IPv4 packet\n"); - continue; - } - - if (ip_hdr->ip_hl > 5) - { - debug("Ignoring IP packet with IP options\n"); - continue; - } - - if (ip_hdr->ip_dst.s_addr != src_ip) - { - debug("Ignoring IP packet not addressed to us (%s, not %s)\n", - iptos(ip_hdr->ip_dst.s_addr), iptos(src_ip)); - continue; - } - - delta = (double)(packet_hdr.ts.tv_sec - record->timestamp.tv_sec) * 1000 + - (double)(packet_hdr.ts.tv_usec - record->timestamp.tv_usec) / 1000; - - if (ip_hdr->ip_p == IPPROTO_ICMP) - { - struct libnet_icmpv4_hdr *icmp_hdr; - struct libnet_ipv4_hdr *old_ip_hdr; - struct libnet_tcp_hdr *old_tcp_hdr; - - if (len < LIBNET_IPV4_H + LIBNET_ICMPV4_H + 4) - { - debug("Ignoring partial icmp packet\n"); - continue; - } - - ALIGN_PACKET(icmp_hdr, libnet_icmpv4_hdr, 0 + LIBNET_IPV4_H); - debug("Received icmp packet\n"); - - /* - * The IP header, plus eight bytes of it's payload that generated - * the ICMP packet is quoted here, prepended with four bytes of - * padding. - */ - - if (len < LIBNET_IPV4_H + LIBNET_ICMPV4_H + 4 + LIBNET_IPV4_H + 8) - { - debug("Ignoring icmp packet with incomplete payload\n"); - continue; - } - - ALIGN_PACKET(old_ip_hdr, libnet_ipv4_hdr, - 0 + LIBNET_IPV4_H + LIBNET_ICMPV4_H + 4); - - /* - * The entire TCP header isn't here, but the source port, - * destination port, and sequence number fiels are. - */ - - ALIGN_PACKET(old_tcp_hdr, libnet_tcp_hdr, - 0 + LIBNET_IPV4_H + LIBNET_ICMPV4_H + 4 + LIBNET_IPV4_H); - - if (old_ip_hdr->ip_v != 4) - { - debug("Ignoring ICMP packet which quotes a non-IPv4 packet\n"); - continue; - } - - if (old_ip_hdr->ip_hl > 5) - { - debug("Ignoring ICMP packet which quotes an IP packet with IP options\n"); - continue; - } - - if (old_ip_hdr->ip_dst.s_addr != dst_ip) - { - debug("Ignoring ICMP packet with incorrect quoted destination (%s, not %s)\n", - iptos(old_ip_hdr->ip_dst.s_addr), iptos(dst_ip)); - continue; - } - - if (old_ip_hdr->ip_src.s_addr != src_ip) - { - debug("Ignoring ICMP packet with incorrect quoted source (%s, not %s)\n", - iptos(old_ip_hdr->ip_src.s_addr), iptos(src_ip)); - continue; - } - - /* These are not the droids you are looking for */ - if (old_ip_hdr->ip_p != IPPROTO_TCP) - { - debug("Ignoring ICMP packet which doesn't quote a TCP header\n"); - continue; - } - - /* We are free to go about our business */ - if (! o_trackport && (ntohs(old_ip_hdr->ip_id) != record->id)) - { - debug("icmp packet doesn't contain the id we sent\n"); - continue; - } - - /* Move along, move along */ - if ((ntohs(old_tcp_hdr->th_sport) != record->src_prt) - || (ntohs(old_tcp_hdr->th_dport) != dst_prt)) - { - debug("icmp packet doesn't contain the correct tcp port numbers\n"); - continue; - } - - if (icmp_hdr->icmp_type == ICMP_UNREACH) - { - char s[TEXTSIZE]; - - switch(icmp_hdr->icmp_code) - { - case ICMP_UNREACH_NET: - safe_strncpy(s, "!N", TEXTSIZE); break; - - case ICMP_UNREACH_HOST: - safe_strncpy(s, "!H", TEXTSIZE); break; - - case ICMP_UNREACH_PROTOCOL: - safe_strncpy(s, "!P", TEXTSIZE); break; - - case ICMP_UNREACH_PORT: - safe_strncpy(s, "!p", TEXTSIZE); break; - - case ICMP_UNREACH_NEEDFRAG: - safe_strncpy(s, "!F", TEXTSIZE); break; - - case ICMP_UNREACH_SRCFAIL: - safe_strncpy(s, "!S", TEXTSIZE); break; - - case ICMP_UNREACH_NET_PROHIB: - case ICMP_UNREACH_FILTER_PROHIB: - safe_strncpy(s, "!A", TEXTSIZE); break; - - case ICMP_UNREACH_HOST_PROHIB: - safe_strncpy(s, "!C", TEXTSIZE); break; - - case ICMP_UNREACH_NET_UNKNOWN: - case ICMP_UNREACH_HOST_UNKNOWN: - safe_strncpy(s, "!U", TEXTSIZE); break; - - case ICMP_UNREACH_ISOLATED: - safe_strncpy(s, "!I", TEXTSIZE); break; - - case ICMP_UNREACH_TOSNET: - case ICMP_UNREACH_TOSHOST: - safe_strncpy(s, "!T", TEXTSIZE); break; - - case ICMP_UNREACH_HOST_PRECEDENCE: - case ICMP_UNREACH_PRECEDENCE_CUTOFF: - default: - safe_snprintf(s, TEXTSIZE, "!<%d>", icmp_hdr->icmp_code); - } - - record->delta = delta; - record->addr = ip_hdr->ip_src.s_addr; - safe_snprintf(record->string, TEXTSIZE, "%%.3f ms %s", s); - return 1; - } - - if (icmp_hdr->icmp_type == ICMP_TIMXCEED) - { - record->delta = delta; - record->addr = ip_hdr->ip_src.s_addr; - safe_strncpy(record->string, "%.3f ms", TEXTSIZE); - return 0; - } - - if (icmp_hdr->icmp_type != ICMP_TIMXCEED && - icmp_hdr->icmp_type != ICMP_UNREACH) - { - record->delta = delta; - record->addr = ip_hdr->ip_src.s_addr; - safe_strncpy(record->string, "%.3f ms -- Unexpected ICMP", TEXTSIZE); - return 0; - } - - fatal("Something bad happened\n"); - } - - if (ip_hdr->ip_p == IPPROTO_TCP) - { - struct libnet_tcp_hdr *tcp_hdr; - - if (ip_hdr->ip_src.s_addr != dst_ip) - { - debug("tcp packet's origin does not match our target's address (%s, not %s)\n", - iptos(ip_hdr->ip_src.s_addr), iptos(dst_ip)); - continue; - } - - if (len < LIBNET_IPV4_H + LIBNET_TCP_H) - { - debug("Ignoring partial tcp packet\n"); - continue; - } - - ALIGN_PACKET(tcp_hdr, libnet_tcp_hdr, 0 + LIBNET_IPV4_H); - - debug("Received tcp packet %s:%d -> %s:%d, flags %s%s%s%s%s%s%s%s%s\n", - iptos(ip_hdr->ip_src.s_addr), ntohs(tcp_hdr->th_sport), - iptos(ip_hdr->ip_dst.s_addr), ntohs(tcp_hdr->th_dport), - tcp_hdr->th_flags & TH_RST ? "RST " : "", - tcp_hdr->th_flags & TH_SYN ? "SYN " : "", - tcp_hdr->th_flags & TH_ACK ? "ACK " : "", - tcp_hdr->th_flags & TH_PUSH ? "PSH " : "", - tcp_hdr->th_flags & TH_FIN ? "FIN " : "", - tcp_hdr->th_flags & TH_URG ? "URG " : "", - tcp_hdr->th_flags & TH_CWR ? "CWR " : "", - tcp_hdr->th_flags & TH_ECN ? "ECN " : "", - tcp_hdr->th_flags ? "" : "(none)"); - - if ((ntohs(tcp_hdr->th_sport) != dst_prt) - || (ntohs(tcp_hdr->th_dport) != record->src_prt)) - { - debug("tcp packet doesn't contain the correct port numbers\n"); - continue; - } - - if (tcp_hdr->th_flags & TH_RST) - safe_strncpy(record->state, "closed", TEXTSIZE); - - else if ((tcp_hdr->th_flags & TH_SYN) - && (tcp_hdr->th_flags & TH_ACK) - && (tcp_hdr->th_flags & TH_ECN)) - safe_strncpy(record->state, "open, ecn", TEXTSIZE); - - else if ((tcp_hdr->th_flags & TH_SYN) - && (tcp_hdr->th_flags & TH_ACK)) - safe_strncpy(record->state, "open", TEXTSIZE); - - else - safe_snprintf(record->state, TEXTSIZE, "unknown,%s%s%s%s%s%s%s%s%s", - tcp_hdr->th_flags & TH_RST ? " RST" : "", - tcp_hdr->th_flags & TH_SYN ? " SYN" : "", - tcp_hdr->th_flags & TH_ACK ? " ACK" : "", - tcp_hdr->th_flags & TH_PUSH ? " PSH" : "", - tcp_hdr->th_flags & TH_FIN ? " FIN" : "", - tcp_hdr->th_flags & TH_URG ? " URG" : "", - tcp_hdr->th_flags & TH_CWR ? " CWR" : "", - tcp_hdr->th_flags & TH_ECN ? " ECN" : "", - tcp_hdr->th_flags ? "" : " no flags"); - - record->delta = delta; - record->addr = ip_hdr->ip_src.s_addr; - safe_strncpy(record->string, "%.3f ms", TEXTSIZE); - return 1; - } - - debug("Ignoring non-ICMP and non-TCP received packet\n"); - continue; - } -} - -int trace(void) -{ - int ttl, q, done; - proberecord *record; - - fprintf(stderr, "Tracing the path to %s on TCP port %s, %d hops max", - dst_name, dst_prt_name, o_maxttl); - if (o_pktlen) - fprintf(stderr, ", %d byte packets", o_pktlen + LIBNET_TCP_H + LIBNET_IPV4_H); - fprintf(stderr, "\n"); - - for (ttl = o_minttl, done = 0; !done && ttl <= o_maxttl; ttl++) - { - for (q = 1; q <= o_nqueries; q++) - { - record = newproberecord(); - probe(record, ttl, q); - - debug("Sent probe %d of %d for hop %d, IP ID %d, source port %d, %s%s%s\n", - q, o_nqueries, ttl, record->id, record->src_prt, - o_syn ? "SYN " : "", - o_ack ? "ACK " : "", - o_ecn ? "CWR ECN " : ""); - - done += capture(record); - - showprobe(record); - freeproberecord(record); - } - } - - if (!done) - fprintf(stderr, "Destination not reached\n"); - - return done ? 0 : 1; -} - -/* - * Verify a command line argument is numeric; only to be called from main(). - */ - -int checknumericarg(void) -{ - if (! isnumeric(optarg)) - fatal("Numeric argument required for -%c\n", optopt); - - return atoi(optarg); -} - -/* - * A kludge to help us process long command line arguments, only to be called - * using the CHECKLONG() macro, and only from main(). If the given word - * matches the current word being processed, it's removed from the argument - * list, and returns 1. - */ - -#define CHECKLONG(word) ( checklong_real(word, &i, &argc, &argv) ) - -int checklong_real(char *word, int *i, int *argc, char ***argv) -{ - int j; - - if (strcmp((*argv)[*i], word) != 0) - return 0; - - /* shift */ - for (j = *i; (*argv)[j]; j++) - (*argv)[j] = (*argv)[j+1]; - - (*argc)--; - (*i)--; - - return 1; -} - -int main(int argc, char **argv) -{ - char *optstring, *s; - int op, i, exitcode; - - src_ip = 0; - src_prt = 0; - dst_prt = DEFAULT_PORT; - src = NULL; - device = NULL; - interfaces = NULL; - - o_minttl = 1; - o_maxttl = 30; - o_debug = 0; - o_numeric = 0; - o_nqueries = 3; - o_forceport = 0; - o_pktlen = 0; - o_tos = 0; - o_ecn = 0; - o_syn = 0; - o_ack = 0; - o_dontfrag = 0; - o_timeout = 3; - o_nofilter = 0; - o_nogetinterfaces = 0; - -#ifdef NOSELECT_DEFAULT - o_noselect = 1; -#else - o_noselect = 0; -#endif - -#ifdef TRACK_PORT_DEFAULT - o_trackport = 1; -#else - o_trackport = 0; -#endif - - /* strip out path from argv[0] */ - for (name = s = argv[0]; s[0]; s++) - if (s[0] == '/' && s[1]) - name = &s[1]; - - /* First loop through and extract long command line arguments ... */ - - for(i = 1; argv[i]; i++) - { - if (CHECKLONG("--help")) - usage(); - - if (CHECKLONG("--version")) - about(); - - /* undocumented, for debugging only */ - if (CHECKLONG("--no-filter")) - { - o_nofilter = 1; - debug("o_nofilter set\n"); - continue; - } - - /* undocumented, for debugging only */ - if (CHECKLONG("--no-getinterfaces")) - { - o_nogetinterfaces = 1; - debug("o_nogetinterfaces set\n"); - continue; - } - - /* undocumented, for debugging only */ - if (CHECKLONG("--no-select")) - { - o_noselect = 1; - debug("o_noselect set\n"); - continue; - } - - /* undocumented, for debugging only */ - if (CHECKLONG("--select")) - { - o_noselect = 0; - debug("o_noselect disabled\n"); - continue; - } - - if (CHECKLONG("--track-id") || - CHECKLONG("--track-ipid")) - { - o_trackport = 0; - debug("o_trackport disabled\n"); - continue; - } - - if (CHECKLONG("--track-port")) - { - o_trackport = 1; - debug("o_trackport set\n"); - continue; - } - - if (strcmp(argv[i], "--") == 0) - break; - - if (argv[i][0] == '-' && argv[i][1] == '-') - { - fprintf(stderr, "Unknown command line argument: %s\n", argv[i]); - usage(); - } - } - - /* ... then handoff to getopt() */ - - opterr = 0; - optstring = "hvdnNi:l:f:Fm:P:p:q:w:s:t:SAE"; - - while ((op = getopt(argc, argv, optstring)) != -1) - switch(op) - { - case 'h': - usage(); - - case 'v': - about(); - - case 'd': - o_debug++; - debug("%s %s, %s\n", PACKAGE, VERSION, TARGET); - debug("Compiled with libpcap %s, libnet %s (API %d)\n", - pcap_version, LIBNET_VERSION, LIBNET_API_VERSION); - break; - - case 'n': - o_numeric = 1; - debug("o_numeric set to 1\n"); - break; - - case 'N': - o_numeric = -1; - debug("o_numeric set to -1\n"); - break; - - case 'i': /* ARG */ - device = optarg; - debug("device set to %s\n", device); - break; - - case 'l': /* ARG */ - o_pktlen = checknumericarg(); - debug("o_pktlen set to %d\n", o_pktlen); - break; - - case 'f': /* ARG */ - o_minttl = checknumericarg(); - debug("o_minttl set to %d\n", o_minttl); - break; - - case 'F': - o_dontfrag = 1; - debug("o_dontfrag set\n"); - break; - - case 'm': /* ARG */ - o_maxttl = checknumericarg(); - debug("o_maxttl set to %d\n", o_maxttl); - break; - - case 'P': /* ARG */ - o_forceport = 1; - case 'p': /* ARG */ - if (getuid()) fatal("Sorry, must be root to use -p\n"); - src_prt = checknumericarg(); - debug("src_prt set to %d\n", src_prt); - break; - - case 'q': /* ARG */ - o_nqueries = checknumericarg(); - debug("o_nqueries set to %d\n", o_nqueries); - break; - - case 'w': /* ARG */ - o_timeout = checknumericarg(); - debug("o_timeout set to %d\n", o_timeout); - break; - - case 's': /* ARG */ - if (getuid()) fatal("Sorry, must be root to use -s\n"); - src = optarg; - break; - - case 't': /* ARG */ - o_tos = checknumericarg(); - debug("o_tos set to %d\n", o_tos); - break; - - case 'S': - o_syn = 1; - debug("o_syn set\n"); - break; - - case 'A': - o_ack = 1; - debug("o_ack set\n"); - break; - - case 'E': - o_ecn = 1; - debug("o_ecn set\n"); - break; - - case '?': - default: - if (optopt != ':' && strchr(optstring, optopt)) - fatal("Argument required for -%c\n", optopt); - fprintf(stderr, "Unknown command line argument: -%c\n", optopt); - usage(); - } - - argc -= optind; - argv += optind; - - switch(argc - 1) - { - case 2: - o_pktlen = atoi(argv[2]); - - case 1: - if (isnumeric(argv[1])) - { - dst_prt = atoi(argv[1]); - } - else - { - struct servent *serv; - - if ((serv = getservbyname(argv[1], "tcp")) == NULL) - fatal("Unknown port: %s\n", argv[1]); - - dst_prt = ntohs(serv->s_port); - } - - case 0: - dst = argv[0]; - break; - - default: - usage(); - } - - if (getuid() & geteuid()) - fatal("Got root?\n"); - - initlibnet(); - defaults(); - initcapture(); - setuid(getuid()); - exitcode = trace(); -#if (LIBNET_API_VERSION >= 110) - libnet_destroy(libnet_context); -#endif - return exitcode; -} diff --git a/tcptraceroute.h b/tcptraceroute.h new file mode 100644 index 0000000..a6c00b3 --- /dev/null +++ b/tcptraceroute.h @@ -0,0 +1,90 @@ +/* -*- Mode: c; tab-width: 4; indent-tabs-mode: 1; c-basic-offset: 4; -*- */ +/* vim:set ts=4 sw=4 ai nobackup nocindent sm: */ + +/* + * tcptraceroute -- A traceroute implementation using TCP packets + * Copyright (c) 2001-2005 Michael C. Toren + * + * 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. + * + * A copy of the GNU GPL is available as /usr/doc/copyright/GPL on Debian + * systems, or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html + * You can also obtain it by writing to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Some earlier versions lacked support for double inclusion */ +#ifndef __OpenBSD__ +#include +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define BANNER "Copyright (c) 2001-2005 Michael C. Toren \n\ +Updates are available from http://michael.toren.net/code/tcptraceroute/\n" + +/* Buffer size used for a number of strings, including the pcap filter */ +#define TEXTSIZE 1024 + +/* For compatibility with older versions of libnet */ +#if (LIBNET_API_VERSION < 110) +#define LIBNET_IPV4_H LIBNET_IP_H +#define LIBNET_ICMPV4_H LIBNET_ICMP_H +#define LIBNET_DONT_RESOLVE 0 +#define LIBNET_RESOLVE 1 +#define libnet_addr2name4 libnet_host_lookup +#define libnet_ipv4_hdr libnet_ip_hdr +#define libnet_icmpv4_hdr libnet_icmp_hdr +#endif + +#ifndef LIBNET_VERSION +#define LIBNET_VERSION "UNKNOWN" +#endif + +#ifndef LIBNET_ERRBUF_SIZE +#define LIBNET_ERRBUF_SIZE TEXTSIZE +#endif + +#include "datalink.h" +#include "util.h" +#include "probe.h" +#include "capture.h" + +extern u_long dst_ip, src_ip, isn; +extern u_short src_prt, dst_prt; +extern char *device, *name, *dst, *src; +extern char dst_name[], dst_prt_name[], filter[], errbuf[]; +extern int datalink, offset; +extern int o_minttl, o_maxttl, o_timeout, o_debug, o_numeric, o_pktlen, + o_nqueries, o_dontfrag, o_tos, o_forceport, o_syn, o_ack, o_ecn, + o_nofilter, o_nogetinterfaces, o_noselect, o_trackport, o_dnat, + o_isn; + +extern char *optarg; +extern int optind, opterr, optopt; diff --git a/util.c b/util.c new file mode 100644 index 0000000..5a068bd --- /dev/null +++ b/util.c @@ -0,0 +1,311 @@ +/* -*- Mode: c; tab-width: 4; indent-tabs-mode: 1; c-basic-offset: 4; -*- */ +/* vim:set ts=4 sw=4 ai nobackup nocindent sm: */ + +/* + * tcptraceroute -- A traceroute implementation using TCP packets + * Copyright (c) 2001-2005 Michael C. Toren + * + * 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. + * + * A copy of the GNU GPL is available as /usr/doc/copyright/GPL on Debian + * systems, or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html + * You can also obtain it by writing to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "tcptraceroute.h" +#include + +/* + * fatal() and pfatal() are useful stdarg functions from + * namp. debug() and warn() are based on them. + */ + +void fatal(char *fmt, ...) +{ + va_list ap; + fflush(stdout); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + exit(1); +} + +void debug(char *fmt, ...) +{ + va_list ap; + if (! o_debug) return; + fflush(stdout); + fprintf(stderr, "debug: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fflush(stderr); +} + +void warn(char *fmt, ...) +{ + va_list ap; + fflush(stdout); + fprintf(stderr, "Warning: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fflush(stderr); +} + +void pfatal(char *err) +{ + debug("errno == %d\n", errno); + fflush(stdout); + perror(err); + exit(1); +} + +void usage(void) +{ + printf("\n%s %s\n%s\n", PACKAGE, VERSION, BANNER); + fatal("\ +Usage: %s [-nNFSAE] [-i ] [-f ]\n\ + [-l ] [-q ] [-t ]\n\ + [-m ] [-pP] ] [-s ]\n\ + [-w ] [destination port] [packet length]\n\n", name); +} + +void about(void) +{ + printf("\n%s %s\n%s\n", PACKAGE, VERSION, BANNER); + exit(0); +} + +/* + * realloc(3) or bust! + */ + +void *xrealloc(void *oldp, int size) +{ + void *p; + + if (!oldp) + p = malloc(size); + else + p = realloc(oldp, size); + + if (!p) + fatal("Out of memory! Could not reallocate %d bytes!\n", size); + + memset(p, 0, size); + return p; +} + +/* + * Same as strncpy and snprintf, but always be sure the result is terminated. + */ + +char *safe_strncpy(char *dst, char *src, int size) +{ + dst[size-1] = '\0'; + return strncpy(dst, src, size-1); +} + +int safe_snprintf(char *s, int size, char *fmt, ...) +{ + va_list ap; + int ret; + + va_start(ap, fmt); + ret = vsnprintf(s, size, fmt, ap); + s[size-1] = '\0'; + va_end(ap); + + return ret; +} + +/* + * return a pointer to a string containing only the + * printable characters of the string passed to it. + */ + +char *sprintable(char *s) +{ + static char buf[TEXTSIZE]; + int i; + + if (s && s[0]) + safe_strncpy(buf, s, TEXTSIZE); + else + safe_strncpy(buf, "(empty)", TEXTSIZE); + + for (i = 0; buf[i]; i++) + if (! isprint((u_char) buf[i])) + buf[i] = '?'; + + return buf; +} + +/* + * isdigit() across an entire string. + */ + +int isnumeric(char *s) +{ + int i; + + if (!s || !s[0]) + return 0; + + for (i = 0; s[i]; i++) + if (! isdigit((u_char) s[i])) + return 0; + + return 1; +} + +/* + * Compute the difference between two timeval structures. + */ + +struct timeval tvdiff(struct timeval *tv1, struct timeval *tv2) +{ + struct timeval tvdiff; + + tvdiff.tv_sec = tv1->tv_sec - tv2->tv_sec; + tvdiff.tv_usec = tv1->tv_usec - tv2->tv_usec; + + if ((tvdiff.tv_sec > 0) && (tvdiff.tv_usec < 0)) + { + tvdiff.tv_usec += 1000000L; + tvdiff.tv_sec--; + } + + else if ((tvdiff.tv_sec < 0) && (tvdiff.tv_usec > 0)) + { + tvdiff.tv_usec -= 1000000L; + tvdiff.tv_sec++; + } + + return tvdiff; +} + +/* + * Is the timeval less than, equal to, or greater than zero? + */ + +int tvsign(struct timeval *tv) +{ + if (tv->tv_sec < 0) return -1; + + if (tv->tv_sec == 0) + { + if (tv->tv_usec < 0) return -1; + if (tv->tv_usec == 0) return 0; + if (tv->tv_usec > 0) return 1; + } + + if (tv->tv_sec > 0) return 1; + + return -1; +} + +/* + * Inspired by libnet_host_lookup(), but I needed more than 2 buffers while + * I was debugging. I really could get by with only 2 now, but *shrug*. + */ + +char *iptos(u_long in) +{ + static char output[IPTOSBUFFERS][IPTOSBUFSIZ]; + static short which; + u_char *p; + + p = (u_char *)∈ + which = (which + 1 == IPTOSBUFFERS ? 0 : which + 1); + safe_snprintf(output[which], IPTOSBUFSIZ, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); + return output[which]; +} + +/* + * A wrapper for libnet_addr2name4(), with the option not to resolve + * RFC1918 space. + */ + +char *iptohost(u_long in) +{ + u_char *p = (u_char *)∈ + + if ((o_numeric > -1) && + ((p[0] == 10) || + (p[0] == 192 && p[1] == 168) || + (p[0] == 172 && p[1] >= 16 && p[1] <= 31))) + { + debug("Not attempting to resolve RFC1918 address %s\n", iptos(in)); + return iptos(in); + } + + return (char *)libnet_addr2name4(in, + o_numeric > 0 ? LIBNET_DONT_RESOLVE : LIBNET_RESOLVE); +} + +/* + * Useful for debugging; dump #define's and command line options. + */ + +void debugoptions(void) +{ + if (! o_debug) + return; + + debug("debugoptions():\n"); + + debug("%16s: %-2d %14s: %-2d %16s: %-2d\n", + "TEXTSIZE", TEXTSIZE, + "SNAPLEN", SNAPLEN, + "IPTOSBUFFERS", IPTOSBUFFERS); + + debug("%16s: %-3d %15s: %-2d %16s: %-2d\n", + "ALLOCATEID_CACHE", ALLOCATEID_CACHE_SIZE, + "datalink", datalink, + "datalinkoffset", datalinkoffset(datalink)); + + debug("%16s: %-2d %16s: %-2d %16s: %-2d\n", + "o_minttl", o_minttl, + "o_maxttl", o_maxttl, + "o_timeout", o_timeout); + + debug("%16s: %-2d %16s: %-2d %16s: %-2d\n", + "o_debug", o_debug, + "o_numeric", o_numeric, + "o_pktlen", o_pktlen); + + debug("%16s: %-2d %16s: %-2d %16s: %-2d\n", + "o_nqueries", o_nqueries, + "o_dontfrag", o_dontfrag, + "o_tos", o_tos); + + debug("%16s: %-2d %16s: %-2d %16s: %-2d\n", + "o_forceport", o_forceport, + "o_syn", o_syn, + "o_ack", o_ack); + + debug("%16s: %-2d %16s: %d %16s: %-2d\n", + "o_ecn", o_ecn, + "o_nofilter", o_nofilter, + "o_nogetinterfaces", o_nogetinterfaces); + + debug("%16s: %-2d %16s: %-12s %s: %s\n", + "o_trackport", o_trackport, + "datalinkname", datalinkname(datalink), + "device", device); + + debug("%16s: %-2d %16s: %-2d %16s: %-10ld\n", + "o_noselect", o_noselect, + "o_dnat", o_dnat, + "isn", isn); +} diff --git a/util.h b/util.h new file mode 100644 index 0000000..215cbdb --- /dev/null +++ b/util.h @@ -0,0 +1,55 @@ +/* -*- Mode: c; tab-width: 4; indent-tabs-mode: 1; c-basic-offset: 4; -*- */ +/* vim:set ts=4 sw=4 ai nobackup nocindent sm: */ + +/* + * tcptraceroute -- A traceroute implementation using TCP packets + * Copyright (c) 2001-2005 Michael C. Toren + * + * 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. + * + * A copy of the GNU GPL is available as /usr/doc/copyright/GPL on Debian + * systems, or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html + * You can also obtain it by writing to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#define IPTOSBUFFERS 12 +#define IPTOSBUFSIZ (4*3+3+1) /* Four three-digit numbers, three dots, and NUL */ + +/* + * A generic wrapper for libnet_name_resolve and libnet_name2addr4, because + * it's annoying to have #ifdef's all over the place to support both versions + * of libnet. + */ + +#if (LIBNET_API_VERSION < 110) +#define hosttoip(hostname, numeric) \ + libnet_name_resolve((u_char *)hostname, numeric) +#else +#define hosttoip(hostname, numeric) \ + libnet_name2addr4(libnet_context, (u_char *)hostname, numeric) +#endif + +void fatal(char *, ...); +void debug(char *, ...); +void warn(char *, ...); +void pfatal(char *); +void usage(void); +void about(void); +void *xrealloc(void *, int); +char *safe_strncpy(char *, char *, int); +int safe_snprintf(char *, int, char *, ...); +char *sprintable(char *); +int isnumeric(char *); +struct timeval tvdiff(struct timeval *, struct timeval *); +int tvsign(struct timeval *); +char *iptos(u_long); +char *iptohost(u_long); +void debugoptions(void);