guessnet-0.55/0000755000000000000000000000000011770717500010173 5ustar guessnet-0.55/doc/0000755000000000000000000000000011770705652010745 5ustar guessnet-0.55/doc/Saner-Defaults-HOWTO0000644000000000000000000000166511770705652014413 0ustar Saner Ifupdown Defaults ======================= Without going into complex network detection issues, guessnet can be used with very little effort to avoid the annoying DHCP timeout at boot when no cable is connected to the ethernet device. To do it, just use something like this /etc/network/interfaces file: ---------------------------------------------------------------------- auto lo eth0 iface lo inet loopback # Use guessnet mapping eth0 script /usr/sbin/guessnet-ifupdown map default: dhcp # If there is no link detected, don't try DHCP # # Here it would be useful to have 'fail' method for iface that just # keeps the interface down (see ifupdown bug #275326) # In the meantime, leave the interface unconfigured by hand. iface interface inet manual test missing-cable pre-up echo No link present. pre-up false # By default, perform DHCP iface dhcp inet dhcp ---------------------------------------------------------------------- guessnet-0.55/missing0000755000000000000000000002623311770705723011604 0ustar #! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2009-04-28.21; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar*) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: guessnet-0.55/guessnet-scan.80000644000000000000000000000532711770705652013057 0ustar .\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH GUESSNET-SCAN 8 "10 October 2004" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME guessnet-scan \- guess network configuration data by looking at network traffic .SH SYNOPSIS .B guessnet-scan .RI [ options ] .RI [ ethernet_interface ] .br .SH DESCRIPTION \fBGuessnet-scan\fP tries to deduce network configuration data by watching network traffic at a given Ethernet interface. .P After scanning network traffic for some time, \fBguessnet-scan\fP prints a configuration string suitable for inclusion in /etc/network/interfaces. .P Note that \fBguessnet-scan\fP uses heuristics and wild guesses and that the resulting data is not guaranteed to be accurate. The program is intended to be used as a first try at getting network configuration data without bothering anyone. .SH OPTIONS Options follow the usual GNU conventions, .TP .B \-\-debug Print debugging messages. .TP .B \-\-help Show a brief summary of commandline options. .TP .BR \-\-init\-time =\fIint\fP Time in seconds to wait for the interface to initialize when it is not found already up at program startup. Default: 3 seconds. .TP .BR \-t ", " \-\-timeout=\fIint\fP Time in seconds to watch for network traffic. Default: 5 seconds. .TP .BR \-v ", " \-\-verbose Operate verbosely. .TP .B \-\-version Show the version number of the program. .SH "SCANNING REQUIREMENTS" To correctly identify all data of the local network, \fBguessnet-scan\fP needs to see traffic related to a host in the local network and to the local gateway, if any. .P To be able to identify the network gateway, \fBguessnet-scan\fP also needs to see some traffic directed to the external network: you can help the detection by generating some outbound IP traffic during the scan, for example by browsing a web page (without proxy) or using telnet to open a connection to some remote host. .P Note that if you are connected to a switch, \fBguessnet-scan\fP won't probably be able to work, since the switch will isolate it from the network traffic that the other machines are generating. .SH SEE ALSO .BR guessnet (8), .BR interfaces (5). .SH AUTHOR \fBGuessnet-scan\fP was written by Enrico Zini . guessnet-0.55/FAQ0000644000000000000000000001662711770705652010546 0ustar ============ Guessnet FAQ ============ ----------------- General questions ----------------- Can you show me a simple ``/etc/network/interfaces`` file enhanced with guessnet? --------------------------------------------------------------------------------- Sure:: auto lo eth0 iface lo inet loopback # possible guessnet default iface dhcp inet dhcp # guessnet interface to detect the absence of cable iface interface inet manual test missing-cable pre-up echo No link present. pre-up false mapping eth0 script /usr/sbin/guessnet-ifupdown # List of stanzas guessnet should scan for # If none is specified, scans for all stanzas #map home work # Profile to select when all tests fail map default: dhcp # If no test succeed after this amount of seconds, # then guessnet selects the default profile. # Default is 5, but some network drivers need more. #map timeout: 10 # Uncomment if something goes wrong: #map verbose: true #map debug: true # Home network configuration iface home inet static address 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1 dns-search home.loc dns-nameservers 192.168.1.1 # Check for one of these hosts: test peer address 192.168.1.1 mac 00:01:02:03:04:05 What is the difference between guessnet and whereami, intuitively, laptop-net, divine, ... ------------------------------------------------------------------------------------------ The main difference is that guessnet only cares about selecting a network profile, and has no functionalities to reconfigure the system. The main purpose of guessnet is integrating with ifupdown_, adding automatic network detection to a Debian system with very minimum changes. How do I get the MAC address of a remote machine? ------------------------------------------------- Just use arping: ``arping [machine name]``. arping can be found in debian as the package ``iputils-arping`` or ``arping``. Alternatively, if you don't have arping availbale, you can generate some traffic with the remote host (such as by pinging it) and then find its MAC address in the ARP cache using: ``/usr/sbin/arp -v`` which also works as a normal user. How can I tell a test to only run on some interfaces? ----------------------------------------------------- You can do this by limiting the candidate profiles for an interface in the mapping stanza. The following example runs the ``no-cable`` test only on the ethernet interface:: mapping eth0 script /usr/sbin/guessnet-ifupdown map default: auto map no-cable home work mapping wlan0 script /usr/sbin/guessnet-ifupdown map default: auto map home work hotel Or you can use the automap feature, which limits candidate profiles for an interface depending on their name. So for example if the interface is named wlan0, only profiles which name starts with "wlan0-" are considered for that interface. You can broaden or restrict this selection with usual map syntax. --------------- Troubleshooting --------------- How do I know what profile has been chosen by guessnet? ------------------------------------------------------- You have three options: 1. see the current ifupdown mapping: ``cat /etc/network/ifstate`` 2. activate debug output by adding ``map debug: true`` to the ``mapping`` section of ``/etc/network/interfaces`` 3. run a guessnet scan directly: ``cat /dev/null | guessnet -i eth0``. guessnet works when eth* is up, but always returns the default profile when eth* is down, why? ---------------------------------------------------------------------------------------------- One common cause for this is a network driver which takes some time to bring up the interface, so guessnet works fine when invoked on the commandline with the interface already up, but when run in ifupdown to bring up the interface, guessnet times out before the driver has finished with the initialization. If that is the case, just increase the timeout: add ``map timeout: 10`` in the ``mapping`` stanza of ``/etc/network/interfaces`` and see if it gets better. If it does, try decreasing the timeout to get the optimal value for you. Link beat does not work: when guessnet tries to check it, the interface is still down for configuration ------------------------------------------------------------------------------------------------------- This problem is caused by some network drivers going down and needing lots of time to go up again after being configured. Try working around the problem by adding:: map init-time: 5 (or higher numbers) to the mapping stanza of your interfaces file: that asks guessnet to wait for 5 seconds (instead of the default 3 seconds) after bringing up the interface. If it doesn't work with 5 seconds, try with 10 :) At some point, it should work, then you try smaller numbers to fit your needs. I can't find a host that answers ARP requests coming from 0.0.0.0: can I use a peer scan anyway? ------------------------------------------------------------------------------------------------ Yes, using the source address. If you had this:: iface work inet static address 192.168.1.41 test peer address 192.168.1.1 mac 00:0C:CE:03:0F:E0 try this:: iface work inet static address 192.168.1.41 test peer address 192.168.1.1 mac 00:0C:CE:03:0F:E0 source 192.168.1.42 If instead you don't know the IP address you're going to get, try using the address of the network as a source address:: iface work inet dhcp test peer address 192.168.1.1 mac 00:0C:CE:03:0F:E0 source 192.168.1.0 If using a network address (that is, ending with 0) as a source address doesn't work either, using a valid IP (possibly one you know it's unused) might work. pppoe scans do not work ----------------------- Unfortunately I implemented the PPPOE scans some time ago when I had a PPPOE modem, but after that I never needed that feature myself, and now I don't even have a PPPOE modem anymore. This means that I'm in need of someone to maintain the PPPOE scans; I'm sorry I can't help much. However, going through old mail I just found that someone had problems with pppoe scans and solved using a stanza like this:: iface home inet ppp test pppoe provider providername up ifconfig eth0 up down ifconfig eth0 down If those 'up' and 'down' commands work for you, please let me know. If you also happen to know *why* they work, I'd be even more interested :) I ran guessnet but the interface is still down ---------------------------------------------- You may be having a misunderstanding about the role of guessnet. The role of guessnet is to help ifupdown_ to understand which, among various available configurations, should be used for an interface, not to bring up the interface. The job of bringing up the interface belongs to ifupdown_. It goes like this:: # ifup eth0 ifupdown asks guessnet: "which profile should I use for eth0?" ...guessnet scans... guessnet replies to ifupdown: "use profile Foobar" ifupdown brings eth0 up using profile Foobar If you want an automatic system that brings up the network as you plug it, then have a look at ifplugd_: it will invoke ifup and ifdown when you plug or unplug the cable. ifupdown_+guessnet+ifplugd_ make a nice automatic system for transparent reconfiguration of the network. .. _ifupdown: http://packages.debian.org/ifupdown .. _ifplugd: http://packages.debian.org/ifplugd .. vim:set syntax=rst: guessnet-0.55/install-sh0000755000000000000000000003253711770705723012215 0ustar #!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: guessnet-0.55/tests/0000755000000000000000000000000011770717500011335 5ustar guessnet-0.55/tests/tut-main.cpp0000644000000000000000000000363011770705652013606 0ustar #include #include #include #include #include #include namespace tut { test_runner_singleton runner; } void signal_to_exception(int) { throw std::runtime_error("killing signal catched"); } int main(int argc,const char* argv[]) { tut::reporter visi; signal(SIGSEGV,signal_to_exception); signal(SIGILL,signal_to_exception); if( (argc == 2 && (! strcmp ("help", argv[1]))) || argc > 3 ) { std::cout << "TUT example test application." << std::endl; std::cout << "Usage: example [regression] | [list] | [ group] [test]" << std::endl; std::cout << " List all groups: example list" << std::endl; std::cout << " Run all tests: example regression" << std::endl; std::cout << " Run one group: example std::auto_ptr" << std::endl; std::cout << " Run one test: example std::auto_ptr 3" << std::endl;; } // std::cout << "\nFAILURE and EXCEPTION in these tests are FAKE ;)\n\n"; tut::runner.get().set_callback(&visi); try { if( argc == 1 || (argc == 2 && std::string(argv[1]) == "regression") ) { tut::runner.get().run_tests(); } else if( argc == 2 && std::string(argv[1]) == "list" ) { std::cout << "registered test groups:" << std::endl; tut::groupnames gl = tut::runner.get().list_groups(); tut::groupnames::const_iterator i = gl.begin(); tut::groupnames::const_iterator e = gl.end(); while( i != e ) { std::cout << " " << *i << std::endl; ++i; } } else if( argc == 2 && std::string(argv[1]) != "regression" ) { tut::runner.get().run_tests(argv[1]); } else if( argc == 3 ) { tut::runner.get().run_test(argv[1],::atoi(argv[2])); } } catch( const std::exception& ex ) { std::cerr << "tut raised exception: " << ex.what() << std::endl; } return 0; } guessnet-0.55/tests/ifupdown0000644000000000000000000000270111770705652013120 0ustar # Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or # /usr/share/doc/ifupdown/examples for more information. auto lo eth0 eth1 iface lo inet loopback mapping eth0 #script /tmp/ifprobe script /home/enrico/dev/deb/guessnet-0.18/src/guessnet-ifupdown map prova zippo lippo map cippo map verbose: true map default: cippolizzo iface prova inet static guessnet peer 192.168.1.11 00:80:AD:7E:50:62 test-peer address 192.168.1.1 mac 00:80:AD:7E:50:62 pippo 1 test peer address 192.168.1.1 mac 00:80:AD:7E:50:62 test peer address 192.168.1.1 mac 00:80:AD:7E:50:62 source 192.168.1.2 test peer address 192.168.1.1 source 192.168.1.2 test1 peer address 192.168.1.1 test2-peer address 192.168.1.1 iface cippo inet static test-script /bin/true test script /bin/true test1 script /bin/true test2-script /bin/true guessnet test-script /bin/true guessnet1 test script /bin/true guessnet2 test1 script /bin/true guessnet3 test2-script /bin/true iface lippo inet static test-missing-cable please test missing-cable test1 missing-cable test1-missing-cable guessnet test-missing-cable guessnet1 test-missing-cable guessnet2 test missing-cable iface zippo inet static test-pppoe please test pppoe test1 pppoe test1-pppoe guessnet test-pppoe guessnet1 test-pppoe guessnet2 test pppoe iface pippo inet static test-wireless-ap args test-wireless-scan args args args test1-wireless-id args args "args args" iface pluto guessnet default guessnet-0.55/tests/test-guessnet0000755000000000000000000000013511770705652014101 0ustar #!/bin/sh FILE=${1:?Usage: $0 configfile} ../src/guessnet --config-file=$FILE --debug eth0 guessnet-0.55/tests/test-processrunner.cc0000644000000000000000000000267611770705652015551 0ustar #include "util/processrunner.h" #include "util/output.h" #include #include using namespace std; using namespace util; class ProcessPrinter : public ProcessListener { public: virtual void handleTermination(const std::string& tag, int status) throw () { cout << tag << ": terminated with status " << status << endl; } }; int main(int argc, char* argv[]) { try { wibble::exception::InstallUnexpected installUnexpected; Output::get().debug(true); ProcessPrinter pp; // Start everything Starter::get().start(); fprintf(stderr, "\t\tAdding processes...\n"); vector env; env.push_back(string("PATH=") + SCRIPTDIR + ":/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"); ProcessRunner::get().addProcess("test1", "sleep 1", env, &pp); ProcessRunner::get().addProcess("test2", "sleep 2", env, &pp); ProcessRunner::get().addProcess("test2a", "sleep 2", env, &pp); ProcessRunner::get().addProcess("test0", "true", env, &pp); ProcessRunner::get().addProcess("test3", "false", env, &pp); ProcessRunner::get().addProcess("test2b", "sleep 2", env, &pp); ProcessRunner::get().addProcess("test1a", "sleep 1", env, &pp); Starter::get().start(); fprintf(stderr, "\t\tSleeping...\n"); sleep(2); fprintf(stderr, "\t\tShutting down...\n"); ProcessRunner::get().shutdown(); fprintf(stderr, "\t\tDone.\n"); } catch (std::exception& e) { error("%s", e.what()); return 1; } return 0; } guessnet-0.55/tests/guessnet0000644000000000000000000000070411770705652013123 0ustar prova peer 192.168.1.11 192.168.78.3 prova peer 192.168.1.11 0.0.0.0 prova peer 192.168.1.11 00:80:AD:7E:50:62 192.168.78.3 prova peer 192.168.1.11 00:80:AD:7E:50:62 0.0.0.0 prova peer 192.168.1.11 00:80:AD:7E:50:62 prova peer 192.168.1.1 00:80:AD:7E:50:62 prova peer 192.168.1.1 cippo script /bin/true lippo missing-cable zippo pppoe pippo wireless-ap args pippo wireless-scan args args args pippo wireless-id args args "args args" pluto default guessnet-0.55/tests/test-ifupdown0000755000000000000000000000022111770705652014073 0ustar #!/bin/sh FILE=${1:?Usage: $0 configfile} grep 'map ' $FILE | sed 's/[ \t]*map[ \t]\+//' | ../src/guessnet -i --config-file=$FILE --debug eth0 guessnet-0.55/tests/test-iface.cc0000644000000000000000000000261011770705652013674 0ustar #include "util/output.h" #include "IFace.h" #include #include static void printConfig(const char* tag, IFace& iface) { if_params ifp = iface.getConfiguration(); printf("%-10.10s %s: ", tag, iface.name().c_str()); ifp.print(); } int main(int argc, char* argv[]) { if (argc < 2) fatal_error("Usage: %s \n", argv[0]); try { fprintf(stderr, "\t\tInitializing iface object...\n"); IFace iface(argv[1]); fprintf(stderr, "\t\tRetrieving configuration...\n"); if_params ifp = iface.getConfiguration(); fprintf(stderr, "\t\tPrinting config...\n"); printConfig("Initial", iface); fprintf(stderr, "\t\tDeconfiguring interface...\n"); system("ifconfig eth0 down"); fprintf(stderr, "\t\tPrinting config...\n"); printConfig("Down", iface); fprintf(stderr, "\t\tConfiguring for broadcast...\n"); if_params unconf = iface.initBroadcast(4); printf("%-10.10s %s: ", "Pre-Bcast", iface.name().c_str()); unconf.print(); printConfig("Broadcast", iface); fprintf(stderr, "\t\tIfconfig for broadcast...\n"); system("ifconfig"); fprintf(stderr, "\t\tReconfiguring interface...\n"); if_params bcast = iface.setConfiguration(ifp); printf("%-10.10s %s: ", "Pre-Restore", iface.name().c_str()); bcast.print(); printConfig("Restored", iface); fprintf(stderr, "\t\tDone.\n"); } catch (std::exception& e) { error("%s\n", e.what()); return 1; } return 0; } guessnet-0.55/tests/Makefile.in0000644000000000000000000005111511770705723013411 0ustar # Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : TESTS = guessnet-test$(EXEEXT) check_PROGRAMS = guessnet-test$(EXEEXT) noinst_PROGRAMS = test-iface$(EXEEXT) test-netsender$(EXEEXT) \ test-netwatcher$(EXEEXT) test-processrunner$(EXEEXT) subdir = tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) am_guessnet_test_OBJECTS = tut-main.$(OBJEXT) guessnet_test_OBJECTS = $(am_guessnet_test_OBJECTS) guessnet_test_DEPENDENCIES = ../src/options.o ../src/GuessnetParser.o \ ../src/IFace.o ../src/IfaceParser.o ../src/nettypes.o \ ../src/parser.o ../src/libguessnet.a am_test_iface_OBJECTS = test-iface.$(OBJEXT) test_iface_OBJECTS = $(am_test_iface_OBJECTS) test_iface_DEPENDENCIES = ../src/options.o ../src/GuessnetParser.o \ ../src/IfaceParser.o ../src/IFace.o ../src/libguessnet.a am_test_netsender_OBJECTS = test-netsender.$(OBJEXT) test_netsender_OBJECTS = $(am_test_netsender_OBJECTS) test_netsender_DEPENDENCIES = ../src/nettypes.o ../src/options.o \ ../src/GuessnetParser.o ../src/IfaceParser.o ../src/IFace.o \ ../src/libguessnet.a am_test_netwatcher_OBJECTS = test-netwatcher.$(OBJEXT) test_netwatcher_OBJECTS = $(am_test_netwatcher_OBJECTS) test_netwatcher_DEPENDENCIES = ../src/options.o \ ../src/GuessnetParser.o ../src/IfaceParser.o ../src/IFace.o \ ../src/libguessnet.a am_test_processrunner_OBJECTS = test-processrunner.$(OBJEXT) test_processrunner_OBJECTS = $(am_test_processrunner_OBJECTS) test_processrunner_DEPENDENCIES = ../src/options.o \ ../src/GuessnetParser.o ../src/IfaceParser.o ../src/IFace.o \ ../src/libguessnet.a DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(guessnet_test_SOURCES) $(test_iface_SOURCES) \ $(test_netsender_SOURCES) $(test_netwatcher_SOURCES) \ $(test_processrunner_SOURCES) DIST_SOURCES = $(guessnet_test_SOURCES) $(test_iface_SOURCES) \ $(test_netsender_SOURCES) $(test_netwatcher_SOURCES) \ $(test_processrunner_SOURCES) ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ IFCONFIG = @IFCONFIG@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBNET_CFLAGS = @LIBNET_CFLAGS@ LIBNET_CONFIG = @LIBNET_CONFIG@ LIBNET_LIBS = @LIBNET_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBWIBBLE_CFLAGS = @LIBWIBBLE_CFLAGS@ LIBWIBBLE_LIBS = @LIBWIBBLE_LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SH = @SH@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ scriptdir = @scriptdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ guessnet_test_SOURCES = tut-main.cpp guessnet_test_LDADD = \ ../src/options.o \ ../src/GuessnetParser.o \ ../src/IFace.o \ ../src/IfaceParser.o \ ../src/nettypes.o \ ../src/parser.o \ ../src/libguessnet.a \ @LIBNET_LIBS@ @LIBWIBBLE_LIBS@ #noinst_PROGRAMS = tgp #tgp_SOURCES = stringf.cc Exception.cc nettypes.cc Parser.cc GuessnetParser.cc test_iface_SOURCES = \ test-iface.cc test_iface_LDADD = \ ../src/options.o \ ../src/GuessnetParser.o \ ../src/IfaceParser.o \ ../src/IFace.o \ ../src/libguessnet.a \ @LIBNET_LIBS@ @LIBWIBBLE_LIBS@ test_netsender_SOURCES = \ test-netsender.cc test_netsender_LDADD = \ ../src/nettypes.o \ ../src/options.o \ ../src/GuessnetParser.o \ ../src/IfaceParser.o \ ../src/IFace.o \ ../src/libguessnet.a \ @LIBNET_LIBS@ @LIBWIBBLE_LIBS@ test_netwatcher_SOURCES = \ test-netwatcher.cc test_netwatcher_LDADD = \ ../src/options.o \ ../src/GuessnetParser.o \ ../src/IfaceParser.o \ ../src/IFace.o \ ../src/libguessnet.a \ @LIBNET_LIBS@ @LIBWIBBLE_LIBS@ test_processrunner_SOURCES = \ test-processrunner.cc test_processrunner_LDADD = \ ../src/options.o \ ../src/GuessnetParser.o \ ../src/IfaceParser.o \ ../src/IFace.o \ ../src/libguessnet.a \ @LIBNET_LIBS@ @LIBWIBBLE_LIBS@ INCLUDES = @LIBNET_CFLAGS@ @LIBWIBBLE_CFLAGS@ -DSCRIPTDIR=\"@scriptdir@\" -I ../src EXTRA_DIST = test-guessnet test-ifupdown test-utils.h conf-wireless guessnet ifupdown all: all-am .SUFFIXES: .SUFFIXES: .cc .cpp .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) guessnet-test$(EXEEXT): $(guessnet_test_OBJECTS) $(guessnet_test_DEPENDENCIES) @rm -f guessnet-test$(EXEEXT) $(CXXLINK) $(guessnet_test_OBJECTS) $(guessnet_test_LDADD) $(LIBS) test-iface$(EXEEXT): $(test_iface_OBJECTS) $(test_iface_DEPENDENCIES) @rm -f test-iface$(EXEEXT) $(CXXLINK) $(test_iface_OBJECTS) $(test_iface_LDADD) $(LIBS) test-netsender$(EXEEXT): $(test_netsender_OBJECTS) $(test_netsender_DEPENDENCIES) @rm -f test-netsender$(EXEEXT) $(CXXLINK) $(test_netsender_OBJECTS) $(test_netsender_LDADD) $(LIBS) test-netwatcher$(EXEEXT): $(test_netwatcher_OBJECTS) $(test_netwatcher_DEPENDENCIES) @rm -f test-netwatcher$(EXEEXT) $(CXXLINK) $(test_netwatcher_OBJECTS) $(test_netwatcher_LDADD) $(LIBS) test-processrunner$(EXEEXT): $(test_processrunner_OBJECTS) $(test_processrunner_DEPENDENCIES) @rm -f test-processrunner$(EXEEXT) $(CXXLINK) $(test_processrunner_OBJECTS) $(test_processrunner_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-iface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-netsender.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-netwatcher.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-processrunner.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tut-main.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.o: @am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(PROGRAMS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-noinstPROGRAMS ctags \ distclean distclean-compile distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: guessnet-0.55/tests/test-netwatcher.cc0000644000000000000000000000337211770705652014777 0ustar #include "IFace.h" #include "util/netwatcher.h" #include "util/output.h" #include extern "C" { #include } using namespace util; class PacketPrinter : public PacketListener { public: virtual void handleARP(struct libnet_arp_hdr* arp_header) throw () { printf("Seen ARP\n"); } virtual void handleEthernet(struct libnet_ethernet_hdr* arp_header) throw () { printf("Seen Ethernet\n"); } // others to come as needed, like: // // virtual handleDHCP(struct libnet_hdcp_something* hdcp_header) throw () {} }; static void printConfig(const char* tag, IFace& iface) { if_params ifp = iface.getConfiguration(); printf("%-10.10s %s: ", tag, iface.name().c_str()); ifp.print(); } int main(int argc, char* argv[]) { if (argc < 2) fatal_error("Usage: %s \n", argv[0]); try { wibble::exception::InstallUnexpected installUnexpected; NetWatcher::configure(argv[1]); IFace iface(argv[1]); if_params ifp = iface.getConfiguration(); printConfig("Initial", iface); PacketPrinter pp; NetWatcher::get().addARPListener(&pp); //watcher.addEthernetListener(&pp); Starter::get().start(); sleep(20); /* fprintf(stderr, "\t\tDeconfiguring interface...\n"); system("ifconfig eth0 down"); printConfig("Down", iface); { } fprintf(stderr, "\t\tConfiguring for broadcast...\n"); iface.initBroadcast(4); printConfig("Broadcast", iface); { fprintf(stderr, "\t\tInitializing net watcher...\n"); NetWatcher watcher(argv[1]); printConfig("Post-NS", iface); } fprintf(stderr, "\t\tRestoring interface...\n"); iface.setConfiguration(ifp); printConfig("Restored", iface); */ fprintf(stderr, "\t\tDone.\n"); } catch (std::exception& e) { error("%s\n", e.what()); return 1; } return 0; } guessnet-0.55/tests/test-netsender.cc0000644000000000000000000000610111770705652014613 0ustar #include "IFace.h" #include "util/netsender.h" #include "util/netwatcher.h" #include "util/packetmaker.h" #include "util/output.h" #include #include extern "C" { #include } using namespace std; using namespace wibble::sys; using namespace util; class PacketPrinter : public PacketListener { public: virtual void handleARP(struct libnet_arp_hdr* arp_header) throw () { cout << "Seen ARP"; // Parse and check the arp header if (ntohs (arp_header->ar_op) == ARPOP_REPLY) { string rep; //in_addr* ipv4_him = arp_get_tip(arp_header); in_addr* ipv4_him = arp_get_sip(arp_header); ether_addr* mac_him = arp_get_sha(arp_header); rep += fmt(IPAddress(*ipv4_him)) + " " + fmt(*mac_him); cout << " reply from " << rep; //IPv4_FROM_LIBNET(ipv4_me, arp_header->ar_tpa); //IPv4_FROM_ARP(ipv4_him, arp_header->ar_spa); } cout << endl; } virtual void handleEthernet(struct libnet_ethernet_hdr* arp_header) throw () { cout << "Seen Ethernet" << endl; } // others to come as needed, like: // // // virtual handleDHCP(struct libnet_hdcp_something* hdcp_header) throw () {} }; static void printConfig(const char* tag, IFace& iface) { if_params ifp = iface.getConfiguration(); printf("%-10.10s %s: ", tag, iface.name().c_str()); ifp.print(); } int main(int argc, char* argv[]) { if (argc < 2) fatal_error("Usage: %s \n", argv[0]); try { wibble::exception::InstallUnexpected installUnexpected; { fprintf(stderr, "\t\tTrying libnet setup...\n"); libnet_t* ln_context; char ln_errbuf[LIBNET_ERRBUF_SIZE]; if (!(ln_context = libnet_init(LIBNET_LINK_ADV, argv[1], ln_errbuf))) throw wibble::exception::Libnet(ln_errbuf, "opening link interface"); fprintf(stderr, "\t\tLibnet deleting %p...\n", ln_context); libnet_destroy(ln_context); fprintf(stderr, "\t\tLibnet tried...\n"); } NetSender::configure(argv[1]); NetWatcher::configure(argv[1]); IFace iface(argv[1]); if_params ifp = iface.getConfiguration(); printConfig("Initial", iface); /* fprintf(stderr, "\t\tDeconfiguring interface...\n"); system("ifconfig eth0 down"); printConfig("Down", iface); { fprintf(stderr, "\t\tInitializing net sender...\n"); NetSender sender(argv[1]); printConfig("Post-NS", iface); } fprintf(stderr, "\t\tConfiguring for broadcast...\n"); iface.initBroadcast(4); printConfig("Broadcast", iface); { fprintf(stderr, "\t\tInitializing net sender...\n"); NetSender sender(argv[1]); printConfig("Post-NS", iface); } */ PacketPrinter pp; NetWatcher::get().addARPListener(&pp); // Build and send arp probes Buffer pkt = PacketMaker::makeARPRequest(IPAddress("192.168.1.1"), IPAddress("0.0.0.0")); // Enqueue the packet for sending NetSender::get().post(pkt, 1000, 10000); Starter::get().start(); sleep(20); fprintf(stderr, "\t\tRestoring interface...\n"); iface.setConfiguration(ifp); printConfig("Restored", iface); fprintf(stderr, "\t\tDone.\n"); } catch (std::exception& e) { error("%s\n", e.what()); return 1; } return 0; } // vim:set ts=4 sw=4: guessnet-0.55/tests/Makefile.am0000644000000000000000000000342211770705652013377 0ustar TESTS = guessnet-test check_PROGRAMS = guessnet-test guessnet_test_SOURCES = tut-main.cpp guessnet_test_LDADD = \ ../src/options.o \ ../src/GuessnetParser.o \ ../src/IFace.o \ ../src/IfaceParser.o \ ../src/nettypes.o \ ../src/parser.o \ ../src/libguessnet.a \ @LIBNET_LIBS@ @LIBWIBBLE_LIBS@ # ../src/scanner/TrafficScanner.o #DEFINES := $(shell libnet-config --defines) #LIBS := $(shell libnet-config --libs) -lpcap -lpthread -lpopt #CFLAGS := $(shell libnet-config --cflags) $(CFLAGS) #SUBDIRS = gnparser ifparser . #SUBDIRS = ipexpr noinst_PROGRAMS = test-iface test-netsender test-netwatcher test-processrunner #noinst_PROGRAMS = tgp #tgp_SOURCES = stringf.cc Exception.cc nettypes.cc Parser.cc GuessnetParser.cc test_iface_SOURCES = \ test-iface.cc test_iface_LDADD = \ ../src/options.o \ ../src/GuessnetParser.o \ ../src/IfaceParser.o \ ../src/IFace.o \ ../src/libguessnet.a \ @LIBNET_LIBS@ @LIBWIBBLE_LIBS@ test_netsender_SOURCES = \ test-netsender.cc test_netsender_LDADD = \ ../src/nettypes.o \ ../src/options.o \ ../src/GuessnetParser.o \ ../src/IfaceParser.o \ ../src/IFace.o \ ../src/libguessnet.a \ @LIBNET_LIBS@ @LIBWIBBLE_LIBS@ test_netwatcher_SOURCES = \ test-netwatcher.cc test_netwatcher_LDADD = \ ../src/options.o \ ../src/GuessnetParser.o \ ../src/IfaceParser.o \ ../src/IFace.o \ ../src/libguessnet.a \ @LIBNET_LIBS@ @LIBWIBBLE_LIBS@ test_processrunner_SOURCES = \ test-processrunner.cc test_processrunner_LDADD = \ ../src/options.o \ ../src/GuessnetParser.o \ ../src/IfaceParser.o \ ../src/IFace.o \ ../src/libguessnet.a \ @LIBNET_LIBS@ @LIBWIBBLE_LIBS@ INCLUDES=@LIBNET_CFLAGS@ @LIBWIBBLE_CFLAGS@ -DSCRIPTDIR=\"@scriptdir@\" -I ../src EXTRA_DIST = test-guessnet test-ifupdown test-utils.h conf-wireless guessnet ifupdown guessnet-0.55/tests/conf-wireless0000644000000000000000000000024011770705652014041 0ustar prova1 wireless essid pippo prova2 wireless mac 01:02:03:0A:0B:0C prova3 wireless essid pluto mac 01:02:03:0A:0B:0D prova4 wireless open prova5 wireless closed guessnet-0.55/tests/test-utils.h0000644000000000000000000001652311770705652013637 0ustar /** * @file test-utils.h * @author Peter Rockai (mornfall) * @brief Utility functions for the unit tests */ #include #define TESTGRP(name) \ typedef test_group tg; \ typedef tg::object to; \ tg name ## _tg (#name); namespace tut_guessnet { inline static std::string __ensure_errmsg(std::string f, int l, std::string msg) { char buf[64]; snprintf(buf, 63, "%d", l); buf[63] = 0; std::string ln = buf; f.append(":"); f.append(ln); f.append(": '"); f.append(msg); f.append("'"); return f; } #define gen_ensure(x) ensure (__ensure_errmsg(__FILE__, __LINE__, #x).c_str(), (x)) } #if 0 #include #include #define TEST_TAGCOLL #ifdef TEST_TAGCOLL #include #include #endif /* #include #include #include #include #include #include */ namespace tut_tagcoll { using namespace std; using namespace stringf; using namespace Tagcoll; using namespace tut; template class TestConsumer : public Tagcoll::Consumer { protected: virtual void consumeItemUntagged(const ITEM& item) { items++; } virtual void consumeItem(const ITEM& item, const OpSet& tags) { items++; this->tags += tags.size(); } public: int items; int tags; TestConsumer() : items(0), tags(0) {} }; void outputCollection(const std::string& str, Tagcoll::Consumer& cons); void __tc_ensure_coll_equal(std::string f, int l, std::string s, const Tagcoll::Collection& c1, const Tagcoll::Collection& c2); #define ensure_coll_equal(a, b) \ __tc_ensure_coll_equal(__FILE__, __LINE__, #a " == " #b, a, b) inline static std::string __tc_ensure_errmsg(std::string f, int l, std::string f1, int l1, std::string msg) { return f + ":" + fmt(l) + ": '" + f1 + ":" + fmt(l1) + ": " + msg + "'"; } #ifdef TEST_TAGCOLL inline static void __test_tagged_collection(std::string f, int l, Collection& tc) { #define ttc_ensure(x) ensure (__tc_ensure_errmsg(f, l, __FILE__, __LINE__, #x).c_str(), (x)) // Test handling of untagged items (they are not stored) tc.consume("untagged"); ttc_ensure(tc.getTags("untagged").empty()); // Test handling of tagged items OpSet tagset; tagset += "tag1"; tagset += "tag2"; tc.consume("tagged", tagset); ttc_ensure(tc.getTaggedItems().contains("tagged")); //ttc_ensure(tc.hasTag("tag1")); //ttc_ensure(tc.hasTag("tag2")); tagset = tc.getTags("tagged"); ttc_ensure(tagset.contains("tag1")); ttc_ensure(tagset.contains("tag2")); OpSet itemset = tc.getItems("tag1"); ttc_ensure(itemset.contains("tagged")); itemset = tc.getItems("tag2"); ttc_ensure(itemset.contains("tagged")); tagset = tc.getAllTags(); ttc_ensure(tagset.contains("tag1")); ttc_ensure(tagset.contains("tag2")); tagset.clear(); tagset += "tag1"; tagset = tc.getCompanionTags(tagset); ttc_ensure(!tagset.contains("tag1")); ttc_ensure(tagset.contains("tag2")); // Test handling of changes PatchList change; Patch p("tagged"); tagset.clear(); p.remove("tag1"); p.remove("tag2"); change.addPatch(p); tc.applyChange(change); // "tagged" should now be untagged ttc_ensure(tc.getTags("tagged").empty()); tc.applyChange(change.getReverse()); // "tagged" should now be as before //ttc_ensure(tc.hasTag("tag1")); //ttc_ensure(tc.hasTag("tag2")); tagset = tc.getTags("tagged"); ttc_ensure(tagset.contains("tag1")); ttc_ensure(tagset.contains("tag2")); itemset = tc.getItems("tag1"); ttc_ensure(itemset.contains("tagged")); itemset = tc.getItems("tag2"); ttc_ensure(itemset.contains("tagged")); tagset = tc.getAllTags(); ttc_ensure(tagset.contains("tag1")); ttc_ensure(tagset.contains("tag2")); tagset.clear(); tagset += "tag1"; tagset = tc.getCompanionTags(tagset); ttc_ensure(!tagset.contains("tag1")); ttc_ensure(tagset.contains("tag2")); // Try a patch that adds a tag change = PatchList(); p = Patch("tagged"); p.add("tag3"); change.addPatch(p); tc.applyChange(change); //ttc_ensure(tc.hasTag("tag1")); //ttc_ensure(tc.hasTag("tag2")); //ttc_ensure(tc.hasTag("tag3")); tagset = tc.getTags("tagged"); ttc_ensure(tagset.contains("tag1")); ttc_ensure(tagset.contains("tag2")); ttc_ensure(tagset.contains("tag3")); itemset = tc.getItems("tag1"); ttc_ensure(itemset.contains("tagged")); itemset = tc.getItems("tag2"); ttc_ensure(itemset.contains("tagged")); itemset = tc.getItems("tag3"); ttc_ensure(itemset.contains("tagged")); tagset = tc.getAllTags(); ttc_ensure(tagset.contains("tag1")); ttc_ensure(tagset.contains("tag2")); ttc_ensure(tagset.contains("tag3")); tagset.clear(); tagset += "tag1"; tagset = tc.getCompanionTags(tagset); ttc_ensure(!tagset.contains("tag1")); ttc_ensure(tagset.contains("tag2")); ttc_ensure(tagset.contains("tag3")); // Try a patch that adds some items change = PatchList(); p = Patch("tagged1"); p.add("tag1"); p.add("tag2"); p.add("tag4"); change.addPatch(p); tc.applyChange(change); tagset = tc.getTags("tagged1"); ttc_ensure(tagset.contains("tag1")); ttc_ensure(tagset.contains("tag2")); ttc_ensure(!tagset.contains("tag3")); ttc_ensure(tagset.contains("tag4")); itemset = tc.getItems("tag1"); ttc_ensure(itemset.contains("tagged1")); itemset = tc.getItems("tag2"); ttc_ensure(itemset.contains("tagged1")); itemset = tc.getItems("tag3"); ttc_ensure(!itemset.contains("tagged1")); itemset = tc.getItems("tag4"); ttc_ensure(!itemset.contains("tagged")); ttc_ensure(itemset.contains("tagged1")); tagset = tc.getAllTags(); ttc_ensure(tagset.contains("tag1")); ttc_ensure(tagset.contains("tag2")); ttc_ensure(tagset.contains("tag3")); ttc_ensure(tagset.contains("tag4")); tagset.clear(); tagset += "tag1"; tagset = tc.getCompanionTags(tagset); ttc_ensure(!tagset.contains("tag1")); ttc_ensure(tagset.contains("tag2")); ttc_ensure(tagset.contains("tag3")); ttc_ensure(tagset.contains("tag4")); // And reverse it tc.applyChange(change.getReverse()); itemset = tc.getItems("tag1"); ttc_ensure(!itemset.contains("tagged1")); itemset = tc.getItems("tag2"); ttc_ensure(!itemset.contains("tagged1")); itemset = tc.getItems("tag3"); ttc_ensure(!itemset.contains("tagged1")); ttc_ensure(tc.getItems("tag4") == OpSet()); tagset = tc.getAllTags(); ttc_ensure(tagset.contains("tag1")); ttc_ensure(tagset.contains("tag2")); ttc_ensure(tagset.contains("tag3")); ttc_ensure(!tagset.contains("tag4")); tagset.clear(); tagset += "tag1"; tagset = tc.getCompanionTags(tagset); ttc_ensure(!tagset.contains("tag1")); ttc_ensure(tagset.contains("tag2")); ttc_ensure(tagset.contains("tag3")); ttc_ensure(!tagset.contains("tag4")); #undef ttc_ensure } #endif } #define test_tagged_collection(x) (__test_tagged_collection(__FILE__, __LINE__, (x))) /* namespace tut { static void aptInit () { pkgInitConfig (*_config); _config->Set("Dir", CACHE_DIR); _config->Set("Dir::Cache", "cache"); _config->Set("Dir::State", "state"); _config->Set("Dir::Etc", "etc"); _config->Set("Dir::State::status", CACHE_DIR "dpkg-status"); pkgInitSystem (*_config, _system); // _config -> Set ("Capture::Cache::UseExtState", extstate); } } */ #endif guessnet-0.55/COPYING0000644000000000000000000004311011770705652011232 0ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. guessnet-0.55/configure.ac0000644000000000000000000000571111770705652012472 0ustar dnl Process this file with autoconf to produce a configure script. AC_INIT([guessnet],[0.54],[enrico@debian.org]) AC_CONFIG_SRCDIR([configure.ac]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([foreign subdir-objects]) dnl Add option to specify a nonstandard location of libnet LIBNET_CONFIG=no AC_ARG_WITH(libnet-config, [ --with-libnet-config=[PFX] Specify location of libnet-config], LIBNET_CONFIG=$withval ) dnl To use subdirs AC_PROG_MAKE_SET AC_ISC_POSIX AC_PROG_CXX AC_PROG_CXXCPP AC_PROG_CC AC_HEADER_STDC AC_CHECK_HEADERS(unistd.h) AC_C_CONST AC_C_BIGENDIAN dnl Needed by subdir-objects AM_PROG_CC_C_O AC_PROG_RANLIB AM_PROG_LEX AC_PROG_YACC LIBWIBBLE_DEFS(libwibble >= 0.1.16) dnl Check for libnet #AC_CHECK_HEADER(libnet.h, AC_DEFINE(HAVE_LIBNET_H, 1, libnet.h has been found), # AC_MSG_ERROR([ #*** libnet.h not found. Check 'config.log' for more details.])) # #AC_CHECK_LIB(net, libnet_open_link_interface, x_libs="-lnet", # AC_MSG_ERROR([ #*** libnet not found. Check 'config.log' for more details.])) dnl Find libnet if test "$LIBNET_CONFIG" = "no" then AC_PATH_PROG(LIBNET_CONFIG,libnet-config,no) AC_MSG_CHECKING(for libnet libraries) if test "$LIBNET_CONFIG" != "no" then if ! $LIBNET_CONFIG --help > /dev/null 2>&1 then AC_MSG_ERROR(Could not find libnet-config anywhere (see config.log for details).) fi LIBNET_LIBS="`$LIBNET_CONFIG --libs`" LIBNET_CFLAGS="`$LIBNET_CONFIG --cflags` `$LIBNET_CONFIG --defines`" AC_MSG_RESULT(found) AC_SUBST(LIBNET_LIBS) AC_SUBST(LIBNET_CFLAGS) else AC_MSG_ERROR(No libnet-config was specified (see config.log for details).) fi fi dnl Check for libpcap AC_CHECK_HEADER(pcap.h, AC_DEFINE(HAVE_PCAP_H, 1, pcap.h has been found), AC_MSG_ERROR([ *** pcap.h not found. Check 'config.log' for more details.])) AC_CHECK_LIB(pcap, pcap_open_live, LIBS="-lpcap $LIBS", AC_MSG_ERROR([ *** libpcap not found. Check 'config.log' for more details.])) dnl Check for libpthread AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H, 1, pthread.h has been found), AC_MSG_ERROR([ *** pthread.h not found. Check 'config.log' for more details.])) AC_CHECK_LIB(pthread, pthread_create, LIBS="-lpthread $LIBS", AC_MSG_ERROR([ *** libpthread not found. Check 'config.log' for more details.])) AC_CHECK_LIB(iw, iw_scan, LIBS="-liw $LIBS", AC_MSG_ERROR([ *** libiw not found. Check 'config.log' for more details.])) dnl Define some useful locations scriptdir="$datadir/$PACKAGE/test" AC_SUBST(scriptdir) dnl Check for misc other progs AC_PATH_PROG(SH, sh) AC_DEFINE_UNQUOTED(SH, "$SH", [Path to a Bourne-compatible shell]) AC_PATH_PROG(IFCONFIG, ifconfig, /sbin/ifconfig, "$PATH:/sbin:/usr/sbin") AC_DEFINE_UNQUOTED(IFCONFIG, "$IFCONFIG", [Path to ifconfig]) AC_PATH_PROG(GREP, grep) AC_DEFINE_UNQUOTED(GREP, "$GREP", [Path to grep]) CFLAGS="-Wall $CFLAGS" AC_CONFIG_FILES([ Makefile src/Makefile scripts/Makefile tests/Makefile ]) dnl src/ipexpr/Makefile dnl src/gnparser/Makefile dnl src/ifparser/Makefile AC_OUTPUT guessnet-0.55/AUTHORS0000644000000000000000000000141511770705652011251 0ustar Enrico Zini Massimiliano Masserelli Thomas Hood Parts were taken from laptop-netconf.c by Matt Kern . Parts were taken from divine.c by Felix von Leitner . Thanks to: Lucien Saviot for noticing a bad typo in the code and suggesting some ideas for a nice default local address. Fabian Knittel provided patches to fix many bugs. Max Kutny sent ideas and manpage corrections. Andrew McMillan wrote the original testpppoe script that has then be adapted by Thomas Hood to be used in ifupdown-roam, and eventually made its way into the pppoe guessnet test method. Joey Hess sent patches and ideas. guessnet-0.55/debian/0000755000000000000000000000000011770717500011415 5ustar guessnet-0.55/debian/README.Debian0000644000000000000000000000570511770705652013472 0ustar guessnet for Debian ------------------- * Small list of wishes that, if fulfilled, could help making ifupdown plus guessnet a more useful combination: - #76142, #92993, #96265, #129003, #164823, #171981, would help in having an interesting default for when no test succeeds, especially when I'll have implemented DHCP scans - #204641 would help in having an even more interesting default for when no test succeeds - #139383 would help in passing options to guessnet in a more natural way than using `map' lines, and would remove the need for a guessnet-ifupdown symlink - #224742 would help in starting to think of /etc/network/interfaces as a common network configuration file shared by many, cooperating applications using an elegant, consistent and documented syntax - #225860 would help in making the Debian network configuration evolve. No need of getting ajt out; however, it would be nice if ifupdown and the other network configuration tools in Debian could be maintained by an active task force like it happens with xfree and apache. * Some thoughts on network detection and configuration on Debian There are a lot of packages for automatic network detection and reconfiguration on debian: whereami, laptop-netconf, laptop-net, netenv and maybe others. IMHO they all have a problem: they do network detection AND reconfiguration. This is a problem because Debian already has a way to configure network interfaces, provided by the base package ifupdown. Ifupdown already provides a way to define configuration profiles, and hooks for selecting the good one. This means that Debian does not need a unique tool for network detection AND reconfiguration, but two different tools, one for network detection and one for system reconfiguration. All the mentioned packages provide ways of detecting what the correct configuration profile is, and ways for reconfiguring the system to use the correct profile. The problem is, they don't integrate with ifupdown. Guessnet is a solution that does integrate with ifupdown. Unfortunately it doesn't implement all the tests yet that would be necessary to make it useful for everyone. Then we have the system reconfiguration part. For simple needs, ifupdown can take care of it, possibly with the aid of a couple of up/pre-up/down/ post-down commands. For more complex needs, ifupdown alone doesn't provide an adequate solution. Maybe the existing reconfiguration methods can be hooked into ifupdown as wvdial has been, but I'm not confortable with the entangled ifupdown sources to elaborate more on that. Maybe the problem of system reconfiguration is intrinsically complex. I'd like to cooperate with the authors and users of the involved packages to address this problem and see what they think. If we share the same concerns, maybe we should merge efforts and try to clean up the mess. guessnet-0.55/debian/docs0000644000000000000000000000004411770705652012273 0ustar README FAQ doc/Saner-Defaults-HOWTO guessnet-0.55/debian/vercheck0000755000000000000000000000073411770705652013146 0ustar #!/bin/sh VERSION_AUTOTOOLS=`head configure.ac |grep AC_INIT | sed -re 's/.+\[([0-9]+[^]]+)\].+/\1/'` VERSION_DEB=`head -n 1 debian/changelog | sed -re 's/.+\(([^-]+).+/\1/'` VERSION_DEBFULL=`head -n 1 debian/changelog | sed -re 's/.+\((.+)\).+/\1/'` VERSION="$VERSION_SRC" if [ "$VERSION_AUTOTOOLS" != "$VERSION_DEB" ] then echo "Version mismatch between ini-get ($VERSION_AUTOTOOLS) and debian/changelog ($VERSION_DEB)" >&2 exit 1 fi echo "$VERSION_AUTOTOOLS" exit 0 guessnet-0.55/debian/dirs0000644000000000000000000000001111770706641012275 0ustar usr/sbin guessnet-0.55/debian/guessnet.links0000644000000000000000000000005511770705652014321 0ustar usr/sbin/guessnet usr/sbin/guessnet-ifupdown guessnet-0.55/debian/guessnet.examples0000644000000000000000000000001311770705652015011 0ustar examples/* guessnet-0.55/debian/rules0000755000000000000000000000146211770705652012505 0ustar #!/usr/bin/make -f VERSION=$(shell debian/vercheck) include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/autotools.mk DEB_MAKE_CHECK_TARGET := check # Store build information common-binary-post-install-arch common-binary-post-install-indep:: dh_buildinfo vercheck: debian/vercheck > /dev/null debsrc: vercheck test -z "`git diff --cached`" || (echo "There are uncommitted changes in the index" >&2; /bin/false) test -e Makefile || ./configure make dist fakeroot debian/rules clean rm -rf buildpkg mkdir buildpkg mv guessnet-$(VERSION).tar.gz buildpkg/guessnet_$(VERSION).orig.tar.gz cd buildpkg && tar zxf guessnet_$(VERSION).orig.tar.gz cp -a debian buildpkg/guessnet-$(VERSION)/ cd buildpkg/guessnet-$(VERSION) && debuild -S -us -uc -I.git -i.git rm -f buildpkg/*_source.* guessnet-0.55/debian/compat0000644000000000000000000000000211770705652012620 0ustar 7 guessnet-0.55/debian/copyright0000644000000000000000000000170611770706565013365 0ustar This package was debianized by Enrico Zini on Sat, 10 Nov 2001 10:56:46 +0100. Copyright (C) 2003, 2004 Enrico Zini License: This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 dated June, 1991. This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. On Debian GNU/Linux systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2. guessnet-0.55/debian/source/0000755000000000000000000000000011770717053012720 5ustar guessnet-0.55/debian/source/format0000644000000000000000000000001511770717053014127 0ustar 3.0 (native) guessnet-0.55/debian/control0000644000000000000000000000257011770706577013040 0ustar Source: guessnet Section: net Priority: optional Maintainer: Andrew O. Shadura Build-Depends: cdbs, debhelper (>= 7), dh-buildinfo, libnet1-dev (>= 1.1.1rel-2), libpcap-dev, libtut-dev, libwibble-dev (>= 0.1.16), libwibble-dev (<< 0.2), pkg-config, libiw-dev Standards-Version: 3.9.3 Vcs-Git: git://git.debian.org/git/collab-maint/guessnet.git Vcs-Browser: http://git.debian.org/?p=collab-maint/guessnet.git Package: guessnet Architecture: any Enhances: ifupdown Depends: ${shlibs:Depends}, ${misc:Depends} Suggests: pppoe, ifplugd Description: Guess which LAN a network device is connected to Guessnet is a non-aggressive network detection tool to use when moving a machine among networks which don't necessarily provide DHCP. . Guessnet takes in input a list of candidate network profiles, each of which includes a test description; then it runs all the tests in parallel and prints the name of the profile whose test was the first one to succeed. . Available tests are: * ARP probes to check for known hosts in the network * link beat check, to check if the interface is connected to anything * PPPOE check to see if there is a concentrator accessible via PPPOE * Checks provided by custom arbitrary scripts. . Guessnet can be used in either native mode or "ifupdown mode". In the latter case guessnet integrates nicely with ifupdown as a "mapping script". guessnet-0.55/debian/changelog0000644000000000000000000004623211770717207013302 0ustar guessnet (0.55) unstable; urgency=low * Document that recent changes to ifupdown require the fully qualified path to guessnet-ifupdown to run at boot. * Fix typos in the manpage. * Don't ship empty directory. * Bump Standards-Version; no changes needed. * Switch to 3.0 (native) source package format. -- Andrew O. Shadura Fri, 22 Jun 2012 00:21:56 +0200 guessnet (0.54-1) unstable; urgency=low * New maintainer. * New upstream version. + Support source directive for ifupdown 0.7 compatibility. -- Andrew O. Shadura Wed, 28 Dec 2011 14:00:39 +0300 guessnet (0.53-2) unstable; urgency=low * Maintainer set to QA * Code moved to collab-maint git -- Enrico Zini Tue, 02 Nov 2010 12:02:15 +0000 guessnet (0.53-1) unstable; urgency=low * New upstream version + Parse command line arguments also in ifupdown mode. Thanks Kevin Locke for the patch. Closes: #572424. -- Enrico Zini Thu, 04 Mar 2010 13:49:52 +0000 guessnet (0.52-1) unstable; urgency=low * Acknowledge NMU (Closes: #570306) * New upstream version + Added help option in test-wireless* scripts thanks to Stefano Sabatini Closes: #393904 + Added iwscan-tries option to retry wireless scans. Thanks to Sebastian Schmidt. Closes: #554614 + Properly shutdown child threads and wait for them. Closes: #553906 + Fixed a harmless race condition in the tests. valgrind is pure joy. valgrind --tool=helgrind is pure concurrent joy. + Switch to pcap_next_ex to catch timeout conditions. Closes: #549192 -- Enrico Zini Sun, 28 Feb 2010 13:44:15 +0000 guessnet (0.51-1.1) unstable; urgency=low * Non-maintainer upload with the ACK of the maintainer. * Fix FTBFS with newer g++ by adding a missing include directive. (Thanks to Fabian Knittel.) (Closes: #570306) -- Philipp Kern Thu, 18 Feb 2010 15:29:06 +0100 guessnet (0.51-1) unstable; urgency=low * New upstream version + Fixed crashes when sending output to syslog. Closes: #532609. -- Enrico Zini Tue, 29 Sep 2009 10:47:41 +0100 guessnet (0.50-1) unstable; urgency=low * New upstream release + increased pcap timeout in netwatcher.cc. Closes: #529882. Thanks to Dietz Pröpper and Vincent Lefevre for digging this out. * Removed waproamd from suggests. Closes: #509394. -- Enrico Zini Mon, 28 Sep 2009 17:01:40 +0100 guessnet (0.49-1) unstable; urgency=low * New upstream version + Minor fixes in the scan selection logic. -- Enrico Zini Mon, 26 May 2008 22:04:45 +0100 guessnet (0.48-1) unstable; urgency=low * New upstream version + Fixed command line parser. Closes: #472450. -- Enrico Zini Fri, 28 Mar 2008 10:18:03 +0800 guessnet (0.47-1.1) unstable; urgency=medium * Non-maintainer upload. * Fix FTBFS and gcc-4.3 incompatibilty by tweaking headers. Thanks to Kumar Appaiah and Cyril Brulebois. Closes: #467580, #456068 -- Andreas Barth Sun, 16 Mar 2008 21:55:06 +0000 guessnet (0.47-1) unstable; urgency=low * New upstream version - Allow spaces in essid names, protected with double quotes. Closes: bug#454903. -- Enrico Zini Sat, 08 Dec 2007 19:05:55 +0000 guessnet (0.46-1) unstable; urgency=low * New upstream version - Output routines are now thread safe. Closes: bug#453864. -- Enrico Zini Thu, 06 Dec 2007 12:03:56 +0000 guessnet (0.45-1) unstable; urgency=low * New upstream version - Added --syslog and --init-delay - The profile filtering system should now work as expected. -- Enrico Zini Sun, 18 Nov 2007 15:12:30 +0000 guessnet (0.44-1) experimental; urgency=low * New upstream version - Restored selecting interfaces in 'map' commands, that got accidentally disabled - Implemented autofiltering mapping based on mapping name. Look for 'autofilter' in the manpage -- Enrico Zini Sun, 04 Nov 2007 13:58:28 +0100 guessnet (0.43-1) experimental; urgency=low * New upstream version - Added missing includes. Closes: bug#417224. - Reorganised the code. - Implemented wireless tests internally using iwlib. Closes: bug#429862. - Allows to test for open wireless networks. * Many things have changed, so this upload goes to experimental * Updated Standards-Version -- Enrico Zini Sat, 03 Nov 2007 19:34:56 +0100 guessnet (0.42-1) unstable; urgency=high * Remove throw() handlers to allow the new strange new exception raised by thread cancellation to do its job. Closes: #400866. * Urgency is high as this bug makes guessnet mostly unusable. Changes since 0.41-1 have been kept to a minimum. -- Enrico Zini Mon, 19 Mar 2007 15:00:13 +0000 guessnet (0.41-1) unstable; urgency=low * New upstream version - Use a correct version number in configure.ac * Build-depend on new libwibble to get a working commandline parser. Closes: bug#389114. -- Enrico Zini Sun, 24 Sep 2006 00:35:09 +0100 guessnet (0.40-1) unstable; urgency=low [ Joachim Breitner ] * test-wireless makes wireless interface lose association (Closes: #329419) Until now, test-wireless ifconfig up'ed the interface and ifconfig down'ed it afterwards, which always caused a disconnect. I have removed these lines. If it breaks it for you now, please tell us, so that we can implement a conditional ifconfig-up-and-down'ing. [ Enrico Zini ] * New upstream version. - Use the system classes from wibble 0.1.4+ - Fix the script line parser for the standalone configuration file. Closes: bug#387601. - Correctly prints wlan and priv link beat detection errors. Closes: bug#387603. - Better output for link detection functions when they fail. Closes: bug#387600. - Correctly handle error cases in link beat detection. Closes: bug#336924. - Don't check if the wlan interface is associated with an AP as part of link-beat detection. * Added X-Vcs-Svn tag to debian/control -- Enrico Zini Sat, 23 Sep 2006 16:39:57 +0100 guessnet (0.39-2) unstable; urgency=low * Added pkg-config to build dependencies, thanks to Andreas Jochens for the note (closes: #384910). -- martin f. krafft Tue, 29 Aug 2006 08:30:18 +0200 guessnet (0.39-1) unstable; urgency=low * New upstream version. + Ported to libwibble. + Fixed path of arping. Closes: #384569. + Greatly improved /etc/network/interfaces examples. Thanks Adeodato Simó for the patches. + Applied patch from NMU. Closes: 357182. Thanks Martin Michlmayr for the patch. + Added an FAQ entry on how to run tests only on some interfaces. Closes: #374326. + Removed check for existance of script file and looking for scripts with relative paths in the script directory: it did not add security and it was more confusing than useful. Closes: #366549. * Updated Standards-Version, no change required. -- Enrico Zini Fri, 25 Aug 2006 19:25:26 +0100 guessnet (0.38-1) unstable; urgency=low * New upstream version. + Applied patch from Jean-Damien Durand. Closes: #337199, #336640. -- Enrico Zini Thu, 10 Nov 2005 16:16:19 +0100 guessnet (0.37-1) unstable; urgency=low [ Thomas Hood ] * Bump Standards-Version to 3.6.2.1; no changes required [ Enrico Zini ] * New upstream version + Implemented peer test without destination IP, to test for the existance of physical interfaces with changing IP addresses. + Script scans now look for the script in /usr/share/guessnet/test instead of current directory if they are specified with relative paths. Hopefully noone used relative paths, as they didn't work. Script scans now also get a sane and clean PATH, which includes the script directory itself. Closes: #257328. -- Enrico Zini Sun, 23 Oct 2005 13:48:03 +0200 guessnet (0.36-1) unstable; urgency=low * New upstream version + If link beat detection fails completely (as happens when it is not supported), then act as if the link beat is present (Closes: #295518) + Make test-wireless-ap handle the MAC address argument properly (Closes: #286835) + Speed up test-wireless + No longer use ip command in /usr/share/guessnet/test/test-*. Use ifconfig instead. (Closes: #294346) + Comment resolvconf-related lines from /etc/network/interfaces example stanzas since users could be confused by them (Closes: #297836) -- Enrico Zini Mon, 2 May 2005 14:11:32 +0200 guessnet (0.35-1) unstable; urgency=low * Allows any amount of whitespace in /etc/network/interfaces between "test" and the rest of the line (partly addresses #293356) * Complains if a line starts with "test(-|\s)" but it cannot be parsed by guessnet. Closes: #293356. -- Enrico Zini Mon, 7 Feb 2005 16:45:21 +0100 guessnet (0.34-1) unstable; urgency=low * Integrate material from ifupdown-roam README into the README -- Thomas Hood Wed, 20 Oct 2004 14:59:17 +0200 guessnet (0.33-1) unstable; urgency=low * Upstream version. Fixes another FTBFS on Alpha. Closes: #276787. Thanks to Kurt Roeckx for the patch. -- Enrico Zini Mon, 18 Oct 2004 00:13:52 +0200 guessnet (0.32-1) unstable; urgency=low * Upstream version. Fixes FTBFS on Alpha. -- Enrico Zini Fri, 15 Oct 2004 22:09:27 +0200 guessnet (0.31-1) unstable; urgency=low * Release of 0.30-1~trial4. Thomas Hood joined development team. -- Enrico Zini Fri, 15 Oct 2004 12:33:01 +0200 guessnet (0.30-1~trial4) unstable; urgency=low * Unreleased * New upstream release which includes the following changes that affect Debian bug reports: + test-dhcp: - Remove (Closes: #268318) + guessnet: - Redirect output of pppoe test to /dev/null (Closes: #257216) - Make wireless tests work (Closes: #225953) + getmac: - Add comment that it is written for the iputils-arping version of arping. (Closes: #273110) + guessnet.8: - Note that multiple test peer IP addresses must differ from one another (Mitigates: #268572) * copyright, README.Debian + Tweak * Remove execute permission from files in the examples directory * control: + Suggest: waproamd + Tweak Description -- Thomas Hood Sun, 3 Oct 2004 12:13:51 +0200 guessnet (0.29-2) unstable; urgency=low * Added guessnet.links (Closes: #257325) * Applied script patches from Thomas Hood (Closes: #257325) -- Enrico Zini Fri, 2 Jul 2004 21:47:39 +0200 guessnet (0.29-1) unstable; urgency=low * New upstream version * Allow (optionalle) to specify a source address in peer scans (Closes: #235307) * Ported to cdbs -- Enrico Zini Fri, 2 Jul 2004 12:10:45 +0200 guessnet (0.28-1) unstable; urgency=low * New upstream version ("Alcorcon") * Removed unused ifexpr code (Closes: #240759) * Actually waits for timeout to get scan results, and fixed handling of default scan (Closes: #240781) * Fixed debian/copyright (Closes: #240791) -- Enrico Zini Wed, 31 Mar 2004 16:06:19 +0100 guessnet (0.27-1) unstable; urgency=low * New upstream version ("Alberto Gonzalez Iniesta") * Uses the right types for the arguments of libnet_adv_cull_packet Closes: #226934 (FTBFS on m68k) (I just can't get it right) * New initialization strategy does not initialize unused scanning layers Closes: #228540 * Replaced pthread_cancel with another strategy (NPTL problems?) Closes: #235591 * Applied Lennart patches (Closes: #240387) * Bumped Standards-Version to 3.6.1.0 -- Enrico Zini Sun, 28 Mar 2004 14:21:59 +0200 guessnet (0.26-1) unstable; urgency=low * New upstream version ("The noisy one") * Uses libnet_adv_cull_packet instead of libnet_pblock_coalesce * Uses the right types for the arguments of libnet_adv_cull_packet Closes: #225221 (FTBFS on HPPA) * Closes: #224894 (Segfault when using "default:" in ifupdown mode and when using other parameters) * Does not enforce UID to be 0, but prints a note about uid not being 0 when catching fatal exceptions Closes: #224910 (should not ask for root privileges) * Allows an optional guessnet[0-9]*\s+ token in front of configuration lines Closes: #224893 (using 'guessnet' option instead of 'test' in interfaces file) * Works around ifupdown peskiness as reported in bug #224742, allowing and ignoring some stupid useless things in the configuration lines. * Restructured the manpage Closes: #224888 (manpage improvement) * Added scan for PPPOE -- Enrico Zini Tue, 6 Jan 2004 18:06:41 +0100 guessnet (0.25-1) unstable; urgency=low * New upstream version * Turn an unhandled exception into a libnet error message showing an old libnet bug that had been corrected but is back again -- Enrico Zini Mon, 22 Dec 2003 14:46:06 +0100 guessnet (0.24-1) unstable; urgency=low * New upstream version * Configuration file: change "test-stuff" in "test stuff" in ifupdown mode to account for ifupdown quirks. Allow both syntaxes for compatibility with older ifupdown files. * Allow for specifying test-peer scans without a macaddress, only checking for the existance of a host with that IP address. -- Enrico Zini Sun, 21 Dec 2003 14:53:12 +0100 guessnet (0.23-1) unstable; urgency=low * New upstream version ("Who does not die sees himself again") * Port to libnet1 * Nice code refactorying * If there are no profiles given in stdin in ifupdown mode, assume they are all enabled * Integrate the simple patch from the BTS (thank you Fabian Knittel!) Closes: #220470 (Hangs on thread join) * Added link-beat detection scan, to select a profile if there is no cable on the socket -- Enrico Zini Sun, 21 Dec 2003 01:59:02 +0100 guessnet (0.22-1) unstable; urgency=low * Fixed typos in the description. Closes: bug#194889 * FIxed misspelling of Hervé Eychenne * Applied patches by Fabien Knittel to make ifupdown mode work. Closes: bug#195393 * Reading commandline arguments from stdin now works -- Enrico Zini Thu, 5 Jun 2003 17:11:21 +0200 guessnet (0.21-1) unstable; urgency=low * New upstream version * Added guessnet-scan -- Enrico Zini Tue, 27 May 2003 01:34:40 +0200 guessnet (0.20-1) unstable; urgency=low * New upstream version. Closes: bug#193796 * Replaced -V with --debug and let -V work as --version * Removed dependancy on libpopt -- Enrico Zini Sun, 25 May 2003 16:14:25 +0200 guessnet (0.19-1) unstable; urgency=low * New upsteam version * Correctly handle when libpopt popt_next returns null instead of a packet (had to look at popt sources to see what it means, since I couldn't find it documented anywhere >:((( ) * The check to see if an interface is really up is now correct. Closes: bug#193411 * Experimental nice parser updates; documentation will come in the next release, when they won't be experimental anymore -- Enrico Zini Fri, 16 May 2003 21:38:53 +0200 guessnet (0.18-1) unstable; urgency=low * New upstream version * -v and -V switch can now work without specifying an ethernet device * New scanning modes added * ifupdown mode is now fully implemented * Added a guessnet-ifupdown symlink to guessnet that activates ifupdown mode. BTW, invoking guessnet by that name is the only clean way to tell guessnet it's being invoked by ifupdown. Bug#139383 has a simple suggestion for a better ways of doing that, too bad it's 1 year and 50 days old at the moment and there's no sign it will be addressed soon. -- Enrico Zini Sat, 10 May 2003 21:29:31 +0200 guessnet (0.17-1) unstable; urgency=low * New upstream release, major rewrite, fully backwards compatible * Backported to libnet0. Closes: bug#180403 * Can now use /etc/network/interfaces itself to store detection info * No longer needs a local ip address to generate ARP probes -- Enrico Zini Thu, 8 May 2003 11:46:01 +0200 guessnet (0.16-1) unstable; urgency=low * New upstream release -- Enrico Zini Sun, 9 Feb 2003 22:22:15 +0100 guessnet (0.15-2) unstable; urgency=low * Added build dependency to libpcap-dev. Closes: bug#180161 I'm ashamed. * Further manpage improvements by Thomas Hood. Closes: bug#178228 -- Enrico Zini Fri, 7 Feb 2003 21:41:45 +0100 guessnet (0.15-1) unstable; urgency=low * New upstream vesion (with porting to libnet 1.x) * guessnet executable is now installed in /usr/sbin. Closes: bug#177886 * Manpage uses the new DESCRIPTION field from Thomas Hood, slightly edited by me. Closes: bug#178228 * First maintainer upload after libpcap0 change. Closes: bug#156179 * Updated to Standards Version 3.5.8 -- Enrico Zini Fri, 7 Feb 2003 15:55:11 +0100 guessnet (0.14-1.1) unstable; urgency=low * Non maintainer upload * Rebuilt with new libpcap to remove dependency on libpcap0, which I got removed from unstable by accident. Sorry about this... -- Torsten Landschoff Sat, 10 Aug 2002 11:36:56 +0200 guessnet (0.14-1) unstable; urgency=low * New upstream release, should be ok on big endian machines, too. -- Enrico Zini Sun, 24 Mar 2002 12:52:51 +0100 guessnet (0.13-1) unstable; urgency=low * New upstream release. -- Enrico Zini Sat, 16 Mar 2002 12:42:39 +0100 guessnet (0.12-1) unstable; urgency=low * New upstream release. Closes: bug#121985 * Added some useful scripts for the examples directory -- Enrico Zini Thu, 6 Dec 2001 15:45:52 +0100 guessnet (0.11-1) unstable; urgency=low * New upstream release (just some documentation improvements) -- Enrico Zini Fri, 30 Nov 2001 17:06:16 +0100 guessnet (0.10-2) unstable; urgency=low * Replaced automake symlinks with real files. Closes: bug#120965 -- Enrico Zini Sun, 25 Nov 2001 10:59:09 +0100 guessnet (0.10-1) unstable; urgency=low * New upstream release * Forgot to close wnpp bug. Closes: bug#118996 -- Enrico Zini Fri, 23 Nov 2001 12:59:46 +0100 guessnet (0.9-2) unstable; urgency=low * Removed debug stdout printf of default profile when -d is used, now checks verbosity and uses stderr -- Enrico Zini Sat, 17 Nov 2001 11:12:48 +0100 guessnet (0.9-1) unstable; urgency=low * Initial Release. -- Enrico Zini Sat, 10 Nov 2001 10:56:46 +0100 guessnet-0.55/config.h.in0000644000000000000000000000447011770705722012226 0ustar /* config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Path to grep */ #undef GREP /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* pcap.h has been found */ #undef HAVE_PCAP_H /* pthread.h has been found */ #undef HAVE_PTHREAD_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Path to ifconfig */ #undef IFCONFIG /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Path to a Bourne-compatible shell */ #undef SH /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER /* Define to empty if `const' does not conform to ANSI C. */ #undef const guessnet-0.55/testnets0000644000000000000000000000071411770705652011776 0ustar # Config file used to test guessnet and its parser # Home network #192.168.1.2 00:80:AD:7E:50:62 192.168.1.1 profile-home #192.168.1.2 00:80:AD:7E:50:62 192.168.1.1 profile-home # Funky comment mitac peer 192.168.1.42 00:40:D0:1A:DE:3C #mitac peer ip 192.168.1.42 mac 00:40:D0:1A:DE:3C # Empty lines # Some script scans #trivial script /bin/true #impossible script /bin/false #bastard script while /bin/true; do /bin/true; done #cippo lippo guessnet-0.55/ChangeLog0000644000000000000000000002177511770705652011766 0ustar 2009-09-29 enrico@enricozini.org * output.cc: reissue va_start before calling vsyslog 2009-09-28 enrico@enricozini.org * netwatcher.cc: 1000ms timeout to pcap, seems to be needed on amd64. Thanks Dietz Pröpper and Vincent Lefevre * scanbag.h, scanbag.cc: fixed small compiler warnings * guessnet-ifupdown.8: fixed dashes * Makefile.am: also include the examples in the tarball 2008-05-26 enrico@enricozini.org * iwscan.cc: In wireless scan, evaluate profiles in the same order they appear in the config file 2007-12-06 enrico@enricozini.org * Output routines are now protected with a mutex * Only the thread safe output routines are used now 2007-11-04 enrico@enricozini.org * Reverted adding interface name to script command line * Implemented interface autofilter based on name, when enabled using 'map autofilter: true' directive (thanks to Massimiliano Masserelli) * Actually activated the interface filter 2007-11-03 enrico@enricozini.org * Reorganised all the code - Make strong use of singleton classes for subsystems like the network scanner - Removed lots of useless infrastructure code and abstractions - util::Starter coordinates starting subsystems, only those that are needed, and in the right order * Implemented wireless scan tests using iwlib: test-wireless script is not used anymore. Thanks to Massimiliano Masserelli for giving ideas, setting up the test setup and assisting in the development. * Released as version 0.43 2007-11-02 enrico@enricozini.org * Removed unused wireless low-level code * Compiles with GCC 4.3 2005-05-02: New version 0.36 * If link beat detection fails completely (like, is not supported), then act as if the link beat is present * Make test-wireless-ap handle MAC address argument properly * Speed up test-wireless * No longer use ip command in /usr/share/guessnet/test/test-*. Use ifconfig instead. * Remove dns-* lines from /etc/network/interfaces example stanzas since these are Debian-specific and users may be confused by them 2005-02-07: New version 0.35 * Allows any amount of whitespace in /etc/network/interfaces between "test" and the rest of the line * Complains if a line starts with "test(-|\s)" but it cannot be parsed by guessnet * Integrate material from ifupdown-roam README into the README * Fix FTBFS on Alpha 2004-10-05: New version 0.30 * Move auxiliary test programs to /usr/share/guessnet/test/ * Replace test-wifi-* scripts with test-wireless * Remove test-dhcp * test-wireless-*: - Add sleeps after ip link set up * guessnet: - Implement automatic bound check when accessing packets - Redirect output of pppoe test to /dev/null - Make wireless test work - Add experimental dhcp test - Remove parsing of old-style ifupdown peer and script options - Make 'script' a (deprecated) synonym for 'command' keyword - Print "guessnet: " before messages - Use 'command' instead of 'script' in debug messages - Use 'test' instead of 'scan' in many places * getmac: - Add comment that it is written for the iputils-arping version of arping. * Merge TODO into README * Merge old NEWS into ChangeLog * guessnet.8 - Many editorial changes - Document "wireless" as a new experimental test - Note that multiple test peer IP addresses must differ from one another 2003-12-21: New version 0.23 - Implemented two different environments for the two different work modes (normal and ifupdown) - Port to libnet1 - Encapsulate configuration parsing, and instantiate the right parser through a factory class that checks commandline switches and whatever - If there are no profiles given in stdin in ifupdown mode, assume they are all enabled - Integrate the simple patch from the BTS (thank you Fabian Knittel!) - If the interface detects no link beat, output a profile "none". Add a switch to change its name and to turn the feature off for interfaces that do not support link beat detection. 2003-05-27: New in version 0.22 - Fixed a typo in the manpage (Courtesy of Hervé Eychenne) - Fixed typos in the Debian package description - Applied patches by Fabien Knittel to make ifupdown mode work - Fixed another bunch of things to make reading commandline arguments from stdin work 2003-05-26: New in version 0.21 - In ifupdown mode, read from stdin all the commandline parameters, not just the --default equivalent - Documented the new peer and commandline-in-map-lines syntax - Added guessnet-scan 2003-05-25: New in version 0.20 - Lots of manpage updates and fixes (Thanks to Thomas Hood) - Removed redundant documentation from the README, and added a line pointing to the manpage for further documentation - The new peer syntax was not be parsed well (it misses all key-value pairs except the first) - Replaced -V with --debug and let -V work as --version - Remove dependancy on libpopt - When bringing up an interface, check when it comes up and do not wait for all the init-timeout. Use init-timeout only to avoid waiting indefinitely in case of problems. 2003-05-16: New in version 0.19 - Correctly handle when libpopt popt_next returns null instead of a packet (had to look at popt code to see what it means, since I couldn't find it documented anywhere >:((( ) New version 0.18 - -v and -V switch can now work without specifying an ethernet device - Ship with guessnet-ifupdown alias to be used in ifupdown config file - Do not append the interface name to the output tag in ifupdown mode - "script" scan mode added - "default" scan mode added - Read from stdin a list of profiles to be checked when in ifupdown mode New version 0.17 - Rewrite in c++ to support a more flexible and extensible architecture: expect more discovery methods soon - Discovered ARP DAD mode (RFC2131, 4.4.1.) looking at arping manpage, `-D' switch: finally found a way to avoid the need for the source IP address. The source IP address is now ignored - Backported to libnet0, since libnet1 is broken for nonconfigured interfaces 2003-05-09 Enrico Zini * guessnet.c Implement evil ifupdown detection * guessnet.1 Path is /usr/sbin, not /usr/bin (thanks to Hervé Eychenne) Got tired of writing changelogs when I'm the only one that maintains the code. I'd be happy of having guessnet in a CVS somewhere, with other people contributing to it, and it would be essential for implementing wireless scans, since I don't have access to a wireless network or wireless hardware. 2003-05-08 * guessnet.c Corrected commandline parsing code (now the presence of commandline switches does not force taking the interface name from commandline) 2003-05-17 Enrico Zini * Extensive code reorganization and rewrite 2003-02-09 Enrico Zini * guessnet.c Print the ethernet device if using -v Print a good error message in case libnet intialization fails 2003-02-07 Enrico Zini * guessnet.c Finished porting to libnet1 Documentation updates 2003-02-05 Enrico Zini * Makefile.am Install guessnet under /usr/sbin (thanks to Thomas Hood) * guessnet.1 Uses new description by Thomas Hood, slightly edited by me * AUTHORS Added mention to Thomas Hood * guessnet.c Started porting to libnet1 2002-03-24 Enrico Zini * guessnet.c Insulated possible endianness issues and enclosed them in functions and macros * configure.ac Added check for libpopt, since libnet-config does not add -lpopt to LIBS anymore * guessnet.1 Filled the SECTION template with the section number at the start of the file (ops!) 2002-03-16 Enrico Zini * guessnet.c target = *((int *)arp_header->ar_tpa); becomes target = *((int *)&arp_header->ar_tpa); Thanks to Lucien Saviot for pointing me of the typo. Next issue to solve is how could it possibly work before :) * AUTHORS Added thanks to Lucien Saviot 2001-12-06 Enrico Zini * guessnet.c Added #include to make it compile on S390 (thanks to Gerhard Tonn ) * examples/ Added README, laptop-netconf and getmac * README Updated to mention getmac 2001-12-05: Added examples/README, examples/laptop-netconf and examples/getmac Should now compile on S390 2001-11-30 Enrico Zini * guessnet.1, README Added suggestions and examples on how to retrieve the MACaddress of a remote interface with arping or arp -a 2001-11-23 Enrico Zini * guessnet.c Added sleep after interface initialization and --init-time option Cleaned comment style, getting rid of C++ style comments Use memcpy instead of strncpy to compare MACaddresses (oh, shame! shame! shame on me!) Added debugging output and --more-verbose (-V) option Code cleanups * guessnet.1 Documented new option --init-time Documented new option --more-verbose (-V) * README Updated invocation summary 2001-11-23: Added --init-time option Added --very-verbose option Fixed a bug that caused false positives guessnet-0.55/guessnet.80000644000000000000000000004022411770706720012125 0ustar .\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH GUESSNET 8 "4 November 2007" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME guessnet \- guess which LAN a network interface is connected to .SH SYNOPSIS .B guessnet .RI [ options ] .RI [ network_interface ] .br .SH DESCRIPTION \fBGuessnet\fP guesses which LAN a network interface is connected to. Given a list of candidate profiles each of which includes a test description, \fBguessnet\fP runs all the tests in parallel and prints the name of the profile whose test was the first one to succeed. If no test succeeds within a certain timeout period then a default profile name is printed. After printing a profile name, \fBguessnet\fP immediately kills any tests that are still running and exits. .P Candidate profiles are read either from a test description file or, in ifupdown mode, from /etc/network/interfaces. .SH OPTIONS Options follow the usual GNU conventions. In ifupdown mode, options can also be specified on the standard input in the form ": ". .TP .BR \-C ", " \-\-config\-file =\fIfilename\fP Name of the configuration file to use if not specified on command line. Default: standard input or \fI/etc/network/interfaces\fP in ifupdown mode. .TP .BR \-\-autofilter Only useful when operating in ifupdown mode (see below). Instructs guessnet to only consider logical interface names that start with physical interface name being mapped. (ie: eth0\-home only matches when mapping eth0) Default: \fIfalse\fP. .TP .B \-\-debug Print debugging messages. .TP .BR \-d ", " \-\-default =\fIstring\fP Interface name to print if no known networks are found. Default: \fInone\fP. .TP .B \-\-help Show a brief summary of command line options. .TP .BR \-i ", " \-\-ifupdown\-mode Operate in ifupdown mode: parse the input as if it is in the format of /etc/network/interfaces and read from /etc/network/interfaces instead of the standard input if the configuration \fIfilename\fP is not specified. See the ifupdown mode section below for details. .TP .BR \-\-init\-time =\fIint\fP Time in seconds to wait for the interface to initialize when it is not found already up at program startup. Default: 3 seconds. .TP .BR \-\-init\-delay =\fIint\fP Sleep a given number of seconds before starting operations. May be useful in case interface driver needs a little time to settle before reacting to commands. Default: 0 seconds. .TP .BR \-\-iwscan\-tries =\fIint\fP Retry wireless network scanning a given amount. Useful if your driver needs some attempts to return a network list. Default: 1. .TP .BR \-\-syslog Send messages to syslog facility DAEMON, in addition to stderr. .TP .BR \-t ", " \-\-timeout =\fIint\fP Timeout in seconds used to wait for tests to terminate. Default: 5 seconds. .TP .BR \-v ", " \-\-verbose Operate verbosely. .TP .B \-\-version Show the version number of the program. .SH "TEST DESCRIPTION FILE" .br \fBguessnet\fP takes as input a description of the tests it should perform. The test description file looks like this: .nf # Empty lines and lines starting with '#' are ignored. # Other lines contain: # # At home, look for a host with the given IP and MAC address home peer 192.168.1.1 00:01:02:03:04:05 # At the university, check for the presence of at least one # of the following hosts university peer 130.136.1.1 05:06:03:02:01:0A university peer 130.136.1.2 15:13:B3:A2:2F:CD # If the peer doesn't reply to ARP packets coming from 0.0.0.0 # then you can additionally specify a source address to use university peer 130.136.1.2 15:13:B3:A2:2F:CD 130.136.1.250 # For the work network use a custom script work command /usr/local/bin/check_work # Commands are executed by "sh \-c" so shell syntax can be used john\-irda command grep \-q `cat ~enrico/john\-irda\-id` /proc/net/irda/discovery # Location name and interface name are exported in NAME and IFACE weirdnet command /usr/local/bin/weirddetect "$NAME" "$IFACE" # Profile "none" is selected if no network signal is detected # (i.e. there is no cable plugged into the socket) no\-net missing\-cable # Match a wireless network with the given essid home wireless essid Home # You can also match the mac address of the access point home wireless mac 01:02:03:04:0A:0B # Or both home wireless essid Home mac 01:02:03:04:0A:0B # You can also match any open network anyopen wireless open .fi Every non\-comment line represents a test to perform. .P The first word in the line is the name that will be printed if the test succeeds. .P The second word is the test type. .P The remainder of the line contains parameters for the selected test; these vary depending on the test type. .SH "IFUPDOWN MODE" \fBifupdown\fP, Debian's standard network configuration system, permits one to define different "logical interfaces" (\fBifupdown\fP's name for configuration profiles) and to choose among them when one configures a network interface. The choice can be delegated to an external "mapping" program. \fBguessnet\fP can be used as such a program if it is run in "ifupdown mode". \fBguessnet\fP runs in ifupdown mode if it is invoked as \fBguessnet\-ifupdown\fP or if it is given the \fB\-\-ifupdown\-mode\fP option. .P In ifupdown mode \fBguessnet\fP reads test data directly from the logical interface definitions in /etc/network/interfaces rather than from a separate test description file. .P In ifupdown mode if names are passed to \fBguessnet\fP on its standard input then \fBguessnet\fP considers only those logical interface definitions; otherwise it considers them all. You can have \fBifupdown\fP deliver data to \fBguessnet\fP's standard input using the \fImap\fP directive. See interfaces(5) for more information. If names are preceded with "!" character then match is inverted, meaning that all logical interfaces will be processed except for the ones specified in standard input. You cannot mix normal and negated interface names in the same mapping directive. Note: when using autofilter option (see above) you can broaden or tighten the automatic matching by specifying interface names as descripted. .P Please note that you have to specify the fully qualified path to \fBguessnet\fP (/usr/sbin/guessnet\-ifupdown), as otherwise it won't be run at system boot, as /usr/sbin is not on PATH of networking init script any more. Also, you need to ensure /usr is actually mounted at that moment. .P In ifupdown mode options are selected by passing ": " on \fBguessnet\fP's standard input. This feature is provided because \fBifupdown\fP cannot pass command line arguments to mapping scripts. .P If you prefer you can precede the \fBtest\fP keyword in /etc/network/interfaces with the word \fBguessnet\fP. .P \fBifupdown\fP does not allow two option lines in /etc/network/interfaces to start with the same word. To work around this limitation, multiple \fBtest\fP (or \fBguessnet\fP) lines can have different numerals suffixed to their initial keywords (\fBtest1\fP, \fBtest2\fP, or \fBguessnet1\fP, \fBguessnet2\fP, and so on). .P Here's an example of an /etc/network/interfaces file that has been set up for \fBguessnet\fP: .nf auto lo eth0 iface lo inet loopback mapping eth0 script /usr/sbin/guessnet\-ifupdown # Scan all logical interfaces # More options can be given here, such as: # map timeout: 10 # map verbose: true # map debug: true # map iwscan-tries: 23 map default: none mapping eth1 script /usr/sbin/guessnet\-ifupdown # Disable open net checking, just comment out if you are # desperate enough :) (see relative stanza below) map !eth1\-anyopen # Scan only logical interfaces named eth1\-* map autofilter: true iface home inet static address 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1 # Lines for resolvconf (if you use it: see apt\-cache show resolvconf) # dns\-search casa # dns\-nameservers 192.168.1.1 192.168.2.1 # Two tests, in case one of the two machines is down when we test test1 peer address 192.168.1.1 mac 00:01:02:03:04:05 test2 peer address 192.168.1.3 mac 00:01:02:03:04:06 iface work inet static address 10.1.1.42 netmask 255.255.255.0 broadcast 10.1.1.255 gateway 10.1.1.1 test command /usr/local/bin/check_work iface work2 inet static address 192.168.2.23 netmask 255.255.255.0 broadcast 192.168.2.255 gateway 192.168.2.1 # A source address has to be specified in case the peer # doesn't reply to ARP packets coming from 0.0.0.0 test peer address 192.168.2.1 mac 00:01:02:03:04:05 source 192.168.2.23 iface eth1\-home inet static wireless\-essid Home wireless\-key s:myverysecret address 192.168.1.5 netmask 255.255.255.0 gateway 192.168.1.1 dns\-nameservers 192.168.1.1 # Match a wireless network with the given essid test wireless essid Home # You can also match the mac address of the access point #test wireless mac 01:02:03:04:0A:0B # Or both #test wireless essid Home mac 01:02:03:04:0A:0B iface eth1\-work inet dhcp wireless\-essid Work wireless\-key s:myverysecretkey # Match a wireless network with the given essid # If you have spaces in the essid, use double quotes test wireless essid "Work place" iface eth1\-anyopen inet dhcp # You can also match any open network, if you are desperate :) wireless\-essid any wireless\-mode auto test wireless open # If nothing else is found, try DHCP iface none inet dhcp .fi .SH "Supported tests" .SS peer .TP .B Test description file syntax: \fIprofile\fP \fBpeer\fP \fIIP\-address\fP [\fIMAC\-address\fP] [\fIIP\-address\fP] .TP .B Ifupdown mode syntax: \fBtest peer\fP \fBaddress\fP \fIIP\-address\fP [\fBmac\fP \fIMAC\-address\fP] [\fBsource\fP \fIIP\-address\fP] .TP .B Description: Look for peer using ARP. The test will succeed if a network interface with the specified IP address (and MAC address if specified) is connected to the local network. .sp One can omit the MAC address, in which case \fBguessnet\fP only tests for the presence of a host with the specified IP address. .sp If the peer whose presence you want to test for refuses to reply to ARP packets coming from 0.0.0.0 then specify some source IP address from which the peer will accept requests. .sp Multiple peers can be specified (on multiple lines) but each peer must have a different IP address. This restriction may be eliminated in the future. .sp You can also omit the IP address and only use the MAC: that is useful to test for the existance of physical interfaces with changing IP addresses. This kind of scan uses an ICMP ping packet requires a source address in most cases, as hosts tend not to reply to pings coming from nowhere. .SS wireless .TP .B Test description file syntax: \fIprofile\fP \fBwireless\fP [\fBessid\fP \fIessid\fP] [\fBmac\fP \fIMAC\-address\fP] [\fBopen\fP|\fBclosed\fP] .TP .B Ifupdown mode syntax: \fBtest wireless\fP [\fBessid\fP \fIessid\fP] [\fBmac\fP \fIMAC\-address\fP] [\fBopen\fP|\fBclosed\fP] .TP .B Description: Perform a wireless scan like \fBiwlist scan\fP does, and match the results. .sp The test succeeds if the scan reports at least one network for which all the tests (essid, mac of the access point, network is open or closed) match. .sp In case more than one profile matches a network, only the first one, as found in the configuration file, will succeed. This allows prioritising profiles: for example, you can prefer your home access point to an open network by listing it first in the configuration file. .SS missing\-cable .TP .B Test description file syntax: \fIprofile\fP \fBmissing\-cable\fP .TP .B Ifupdown mode syntax: \fBtest missing\-cable\fP .TP .B Description: Check for link beat. The test is successful if link beat is \fInot\fP detected. .sp This feature allows guessnet to detect the case where there is no cable plugged into a network socket; in this case it makes no sense to go through other detection phases. .sp This test can be used in ifupdown mode too if a dummy logical interface is defined that includes the \fBtest missing\-cable\fP option. Bear in mind that when the cable is unplugged, ifupdown will consider the interface to be configured as this dummy logical interface. That is somewhat counterintuitive; one might prefer the interface to be deconfigured in that case. Unfortunately, guessnet is not currently able to tell ifup to refrain from configuring an interface. The problem can be solved, however, by means of the .BR ifplugd (8) program. .sp Link beat detection is not supported on all network hardware. If the interface or its driver does not support link beat detection then this test does not succeed. .SS command .TP .B Test description file syntax: \fIprofile\fP \fBcommand\fP \fIcommand\fP .TP .B Ifupdown mode syntax: \fBtest command\fP \fIcommand\fP .TP .B Description: Test using an arbitrary command. The test is considered successful if the command terminates with exit status 0. .sp Location name and interface name are exported to the script via the NAME and IFACE environment variables. .sp For backward compatibility, \fBscript\fP can be used instead of \fBcommand\fP. .SH "Experimental tests" .SS pppoe .TP .B Test description file syntax: \fIprofile\fP \fBpppoe\fP .TP .B Ifupdown mode syntax: \fBtest pppoe\fP .TP .B Description: Use the \fBpppoe\fP program to send PADI packets in order to look for access concentrators. The test should succeed if a PPPOE modem is present on the given interface. .sp Using this test requires that pppoe be installed on the system. .SS wireless .TP .B Test description file syntax: \fIprofile\fP \fBwireless\fP [\fBmac\fP \fIMAC\-address\fP] [\fBessid\fP \fIESSID\fP] .TP .B Ifupdown mode syntax: \fBtest wireless\fP [\fBmac\fP \fIMAC\-address\fP] [\fBessid\fP \fIESSID\fP] .TP .B Description: Test certain properties of the wireless interface. More specifically, test the MAC address and/or the ESSID of the associated access point. If both are given then \fIMAC\-address\fP must precede \fIESSID\fP. .sp Blanks may be included in the ESSID. For example, .nf prof1 wireless essid My LAN .fi tests for an ESSID of "My LAN". .sp Note that the \fBwireless\fP test does not attempt to change these properties; it only examines them. This test is designed to work with programs such as .B waproamd which independently and dynamically manage the wireless network adapter to keep it associated to an access point. .sp Note that the \fBwireless\fP test is not yet implemented cleanly. .P Note that if one of several tests terminates successfully then any other tests still running will be terminated with the KILL signal. Therefore, test programs should not need to do any special cleanup on exit. .SH NOTES .SS "Getting remote host MAC addresses" When you prepare the test data for \fBguessnet\fP you may need to know the MAC address of a remote interface in the local network. There are various ways to obtain this. The easiest is to use the \fBarping\fP utility by doing "\fBarping [hostname]\fP". If you don't have \fBarping\fP installed on your system then try the command "\fBarp \-a [hostname]\fP" which will display the MAC address if it is in the ARP cache of your machine. You might want to ping the remote interface first to make sure that you have the information in the cache. You can also take a look at the /usr/share/doc/guessnet/examples/getmac script. .SS "Multiple tests" Currently \fBguessnet\fP only supports specifying one kind of test per profile. .SH SEE ALSO .BR ifup (8), .BR interfaces (5), .BR arping (8), .BR sh (1), .BR pppoe (8), .BR ifplugd (8). .SH AUTHOR \fBGuessnet\fP was written by Enrico Zini with contributions from Thomas Hood. The ARP network detection code was taken from \fBlaptop\-netconf\fP by Matt Kern , which in turn in based on \fBdivine\fP by Felix von Leitner . .P The \fBGuessnet\fP webpage is at http://guessnet.alioth.debian.org . guessnet-0.55/README0000644000000000000000000006462211770705652011072 0ustar guessnet README Sections: NOTES INTRODUCING MARKETING TRIGGERING BUILDING MAINTAINING TODO DONE LINKS NEWS ==== Last updated 27 Oct 2005 INTRODUCING =========== The guessnet program tries to guess the current network location by performing tests such as making DHCP and ARP requests. Please see the guessnet(8) manual page for usage information. MARKETING ========= In this section guessnet is discussed in comparison with other automagic network configurers. The following network configurers exist in Debian. Numbers in brackets are the number of votes each package had in popularity- contest on 22 October 2004. * guessnet [25] Report current network environment - This can be used as an ifup mapping program to select configuration for the current environment * ifupdown [5710] Configure or deconfigure network - These are the standard Debian tools for configuring and deconfiguring a network interface * intuitively [3] Select network configuration for current environment * laptop-net [0, but 63 installed] Continually select network configuration for current environment * netenv [36] On boot, set environment variables to manually selected values - This can be used to switch between network configurations. * whereami [18] On boot, APM event, pcmcia event or command, clock state machine. Tests and actions are furnished that are useful for testing current environment and for configuring the network. Incompatible with ifupdown. Ifupdown does not work correctly if other utilities independently futz with the low-level network configuration. Therefore, any adequate solution must be one that either replaces ifupdown entirely or else cooperates with it somehow. Of the above, only laptop-net and guessnet do the latter. Laptop-net is like a combination of ifplugd, intuitively and switchconf rolled into one, except that it is better than such a combination because it uses ifupdown to do low-level configuration, is better integrated and has good documentation. Guessnet is designed to integrate into ifupdown: it is a program that "maps" the specified "physical interface" to the first "logical interface" that it finds by scouting around. One of the many advantages of integrating with ifupdown is that ifupdown handles locking: only one instance of if(up|down) can run at a time (and so ditto for its mapping programs). When using guessnet, ifplugd or waproamd and init and apmd hook scripts can be configured to run ifdown and ifup, which calls guessnet. The following packages were referred to above: * ifplugd [141] Continually monitor iface for (pre|ab)sence of link beat - This can be used to trigger a configurer. * waproamd [33] Continually scan for access points and set encryption key according to the detected MAC or ESSID. These packages were included in earlier releases of Debian but are now obsolete. * divine Ancestor of intuitively * laptop-netconf Select network configuration for current environment I have also found the following software that hasn't been packaged for Debian. For more information consult Freshmeat.net and/or Google. * bootprofile On boot, set environment variables to manually selected values * quickswitch On boot or command, set environment variables to manually selected values * FEWT Traveler Select network configuration * autonetconf Select network configuration for current environment - Trivial * TuX-Mobile Continually select network configuration for current environment - This one looks ambitious. Documentation in Spanish. - GNOME app. - Vaporware. * aphopper * aphunter Continually associate to wireless access points * perlskan Scan for APs and log info with GPS data * Wellenreiter Scan for APs and display details * YaST SuSE's network configurator - http://sdb.suse.de/en/sdb/html/mmj_network80.html * netcfg Improved RedHat network configurer - http://netcfg.sourceforge.net/ * NetworkManager Uses DBUS and HAL to set up network configuration - http://people.redhat.com/dcbw/NetworkManager TRIGGERING ========== Using ifupdown and guessnet one's interface will be reconfigured every time it is upped with ifup. To increase automation, one wants ifup to be run on events such as (1) boot, (2) APM resume, (3) PCMCIA network card insertion, (4) hotplug event, (5) establishment of network link, (6) wireless event, (7) timer, (8) whim. 1. boot ifup is already run at boot time by /etc/init.d/networking to bring up all interfaces defined as "auto". 2. APM resume You can add a hook script to /etc/apm/event.d to ifdown and ifup interfaces on APM suspend and resume. 3. PCMCIA network card insertion The default /etc/pcmcia/network and /etc/pcmcia/network.opts conffiles shipped in the pcmcia-cs package will cause cardmgr to ifup interfaces on inserted non-CardBus PCMCIA cards and to ifdown interfaces on ejected non-CardBus PCMCIA cards. The ifup should be disabled since we want to let the hotplug mechanism take care of network configuration. Simply put an "exit 0" line near the top of the "start" case in /etc/pcmcia/network. As you know, cardmgr beeps once to signal that it has detected a new PCMCIA card, and beeps a second time to indicate that it has successfully configured the card. If, previously, you had your system configured so that the ifup was done by cardmgr via /etc/pcmcia/network then you are accustomed to hearing the second cardmgr beep _after_ the interface has been brought up. If you are now letting hotplug bring up the interface then you may hear the second cardmgr beep before or during the configuration of the interface because cardmgr no longer has to wait for network configuration to complete before it beeps. If you really liked having a beep tell you that the interface is ready to use then use ifplugd (see below), which beeps when it detects a link beat and beeps again when it has configured the interface. 4. hotplug event Current Linux kernels run the hot plug handling program "hotplug" when new adapters (include PCMCIA cards) are plugged in. The current default configuration of the hotplug package will cause ifup to be called with "hotplug" specified as the logical interface name. To make use of this such that hot plug causes interfaces to be ifupped after they become available, include the following stanza in /etc/network/interfaces . mapping hotplug script echo If you want to restrict ifup-on-hot-plug to a certain list of interfaces then use a stanza like the following instead, listing the interfaces you want to be ifupped on separate map lines. mapping hotplug script grep map eth0 map eth2 Here eth0 and eth2 are the interfaces you want to be ifupped on hot plug. Any other interfaces will not be ifupped. I don't recommend that this be done, however. Read on. 5. establishment of network link Even better is to use ifplugd or waproamd to ifup and ifdown interfaces for you according to whether, in the case of ifplugd and a wired network interface, a network cable is plugged in or, in the case of waproamd and a wireless network interface, an access point is associated. The ifplugd or waproamd daemon will call ifup when the network adapter detects a link (presence of active network cable or associated wireless access point) and ifdown when the link is broken (cable disconnected or AP disassociated). Ifplugd and waproamd can be configured to be started and stopped by hotplug. Ifplugd works better with some cards than with others. You may find that ifplugd is useless with yours. If your wireless network traffic is encrypted then your wireless networking adapter needs to be programmed with the encryption key. Many adapters can store one or more keys in their nonvolatile memory and will choose a key that allows them to associate. If you make use of this feature then once you have programmed the adapter no system-side support is necessary. If you do not have the benefit of this feature then your system will need to be set up so that it sets the encryption key each time the adapter is powered up. The console command for this is "iwconfig IFACE key ...". The best way to set the key is to use waproamd. Waproamd scans for wireless networks and sets the encryption key according to the MAC address or the ESSID of the detected access point. E.g., suppose your access point 00:62:a5:37:1e:67 requires the key 12345678901; simply create a file /etc/waproamd/keys/00:62:a5:37:1e:67.wep containing the string "12345678901". Using waproamd provides several benefits. Waproamd can store any number of keys, so you are not limited in the number of different networks among which you can roam. Waproamd works independently of the other programs we have been discussing, but is designed to work properly with ifplugd. Waproamd takes care of setting required keys; the setting of appropriate keys causes adapter association; ifplugd notices association and calls ifup to bring up the interface. 6. wireless event You could use iwevent to trigger a call to (ifdown and) ifup on certain wireless network events such as appearance or disappearance of access points. Unfortunately there is currently (in wireless-tools 26) a bug in iwevent that makes it impossible to pipe the output of the program, thus rendering it nearly useless for this purpose. 7. timer You could set up cron to run (ifdown and) ifup periodically. (See below). 8. user's whim The user can run (ifdown and) ifup any time to reconfigure all active interfaces. Note: If you install the whereami package, make sure you remove the file /etc/network/if-pre-up.d/whereami which is a faulty attempt to hook whereami into ifup, even though whereami is fundamentally incompatible with the standard ifupdown package. Also make sure that whereami is not called on any of the events mentioned above. BUILDING ======== automake 1.9.6 was used. MAINTAINING =========== Enrico is the main maintainer of guessnet, but he isn't the best person for it: he doesn't usually work with network protocols, he doesn't use all scan methods and he uses a limited amount of hardware. This means that Enrico could be good in gluing all the code together, but he can't do a good job alone with making sure that everything works everywhere or with implementing a fancy new scan method. There is a need of more people with different needs and skills to work together. This section lists the various scan methods together with who is maintaining them and their status. 'peer' scan ----------- Maintained by Enrico and generally working, although one should send patches to get new features in and not rely on Enrico's low-level networking skills :) 'pppoe' scan ------------ Currently unmaintained. If you regularly use this, have a bit of technical skills and want to take care of it, please contact enrico@enricozini.org. 'wifi' scans ------------ Currently unmaintained. This is currently implemented using external scripts, which are officially unmaintained besides some patch from Thomas Hood to fix the biggest issues. The scripts are sometimes interacting badly with the rest of guessnet (they bring the interface up and down while the rest of guessnet is doing the same). The best long-term course of action would be to use libiw-dev to implement the scripts' work inside guessnet. It is also unclear what would be the role of guessnet and what would be the role of waproamd. If you regularly use this, have the needed technical skills and want to take care of it, please contact enrico@enricozini.org. 'missing link' scan ------------------- Maintained by Enrico, but not working in some hardware. If you happen to have a non-working interface, please help finding a patch. More code to do link-beat detection can be found in mii-tool and in ifplugd. 'dhcp' scan ----------- Just drafted and unmaintained. If you have a good understanding of the DHCP protocol, please help in extending this. Recognizing the DHCP server name in the reply, for example, would be a very useful feature. 'script' scan ------------- Maintained by Enrico. TODO ==== - Check out NetworkManager - Create a script to output an ifupdown configuration snippet out of the current network configuration: $ guessnet-mkconfig eth0 debconf iface debconf inet static address netmask broadcast gateway test-peer $ guessnet-mkconfig eth0 debconf peermachine test-peer - Add an option to just dump configuration to stdout and exit, to be used to test configuration file parsers - Suggest ifplugd and suggest a high hysteresis - Wait for #238344 "unknown physical layer type 0x30f" to be solved (cannot reproduce anymore) - Render the libnet work-around optional, wrap it around preprocessor directives and set the directives in configure.ac - Consider #226031 "support for a --runcommand option" - It might be that Fabian's patch introduces this bug that guessnet can't kill child processes still running when the program should end - Make guessnet-scan try to get a dhcp lease, and if it succeeds, output an iface line with dhcp and a test-peer to the dhcp server (need to wait until the *damn* libnet1 fixes bug#180441 :(( ) - Use tcpdump's produced packet matching code for having precise and optimized packet matching in the sniffer - Wish: it would be nice to have a macaddr-only detection mechanism, as coming up on the wrong ip on a network can sometimes be disruptive to others (i.e. someone else already using the same ip addr). I'm not sure what mechanism would underlie such a thing, tho. (Tony Godshall ) - guessnet: Limit the scope of the program to Ethernet. Whoever calls guessnet does it just to find out the correct profile for an Ethernet interface. For detection on other kinds of interfaces, other programs can be made. - Add default tests according to the kind of logical interface defined in /e/n/i? - If multiple addresses or address/mac pairs are specified in a single test-peer line, they should all exist for the test to be true (opens the possibility of the same peer being specified in multiple lines, requiring to handle this in a smart way). - Bringing up and down the interface spawns children which could interfere with ProcessRunner (Should not do so, though, since iface_init and iface_shutdown are invoked when the ProcessRunner is not active)? - I'm open to better ideas on how to implement ProcessRunner.cc (see its FIXMEs) - Suggest ifupdown people to implement a zcip mode - wireless test needs to be integrated into guessnet proper. The test-wireless script does ifconfig up and ifconfig down which is really terrible because guessnet runs many instances of the script in parallel. DONE ==== * Done in version 0.38 + Applied patch from Jean-Damien Durand to get scripts with arguments to work again. * Done in version 0.36 + Implemented peer test without destination IP, to test for the existance of physical interfaces with changing IP addresses. + Script scans now look for the script in /usr/share/guessnet/test if they are specified with relative paths. It is easier to write in the config file, and it avoids scripts specified without an absolute path to be run relative to the current directory, which is bad. + Script scans now get a sane and clean PATH, which includes the script directory itself. * Done in version 0.35 + Allow any number of spaces between "test" and the rest of the line + Complains if a line starts with "test(-|\s)" but it cannot be parsed by guessnet. * Done in version 0.30 + Add happy bound checking when accessing packets + Add DHCP scan - DHCPINFORM, DHCPREQUEST (see dhcping for how to do it) - dhcpcd -d -c /dev/null -T ethp_0 -t 4 + In case timeout happens and there are still multiple candidate profiles, return the default profile name * Done in version 0.29 + Allow an extra "src " for arp scans, to set the source IP when the peer doesn't answer DAD ARP packets + Implement in parser + Implement in scans + Add version info to --debug output + Create an example file for the ifupdown (or guessnet) configuration, to be shipped in /usr/share/doc/guessnet/examples * Done in version 0.28 --- 2004-03-31 + Fixed debian/copyright file (#240791) + Removed ifexpr code (#240759) + Did not wait for timeout to get scan results + ScanBag: returns the last scan instead of defaultScan if there are no scan results (#240781) * Done in version 0.27 --- 2004-03-27 + Really invoke the scan start routine + Taken working MII detection from ifplugd + Applied Lennart patches (#240387) --- 2004-03-18 + Implement tests as binary expression NO: it would be hard to evaluate a NOT ping Instead, implement the cases in which it makes sense to AND scans: for example, allow multiple peer data to be specified in a test-peer, and treat them as ANDed together + Even, use ambiguity: - save each profile with the list of scans - as soon as a scan succeeds, remove it - the first profile that remains without scans nor other more specific candidates (e.g. dhcp, dhcp+arp) wins - on timeout, in case a profile succeeds but there are more specific candidates, forget about them and output the succeeded scan. + Debug the strange exception problem in test-netsender (bug#235591) - If I don't do a cancel, everything is fine - If I don't do delete impl, sometimes aborts - If I don't do libnet_destroy, sometimes aborts - Replace cancel with a quit request + Don't wait for sigchild if ProcessRunner (doesn't work on my system) but busy-wait for events with a 10msec pause between iterations (can't come up with anything better) --- 2004-03-16 + Start test-netsender.cc + IFace::initBroadcast: when initializing for 0.0.0.0, IFP_VALID_* are probably not accepted. Search ifconfig sources on how to do that --- 2004-03-15 + Start test-iface.cc --- 2004-01-21 + Dedicate next release to Alberto Gonzalez Iniesta + Don't call ifconfig: directly use interface configuration routines from laptop-net (also works around the libnet bug) + Include the patch from Chris Hanson to work around libnet's bug * Done in version 0.26 --- 2004-01-07 + Use libnet_adv_cull_packet instead of libnet_pblock_coalesce + Solve #225221 (FTBFS with patch from Joey) + Solve #224894 (segfault on "default:") The environments called get() in the constructor, which of course would have tried to dereference 0 + Solve #224910 (Do not enforce UID to be 0, but print a note about uid not being 0 when catching fatal exceptions) + Solve #224893 by supporting an optional guessnet[0-9]* in front of lines + Put an optional 'guessnet[0-9]* ' in front of everything Solves #224893 (using 'guessnet' option instead of 'test' in interfaces file) + Put an optional arbitary number after test + Put the optional dash after test[0-9]* + Reintroduce the dash in test-stuff (ifupdown complains about duplicate first-words even in unrecognized lines) + Document that if no logical interfaces are given on stdin in ifupdown mode, all those that are found are tried + Document test-missing-cable as test-missing-cable please (and .+ for what it matters) + Do not mention ethernet in the documentation anymore + manpage + README + README.Debian + debian/control + Document why numbers and garbage after test-missing-cable + Document the optional guessnet name in ifupdown config lines + Document the ifupdown wishlist bugs of guessnet interest in README.Debian + Apply the changes in #224888 + Document that multiple test- things are "or-ed" together, not "and-ed" + Add a pppoe scan taking the code from one of the ifupdown-roam scripts + Add a scripts directory + Add experimental support for wireless scans by transparently running /usr/share/guessnet/test-wifi-* scripts + Print a warning about "guessnet default" being obsolete if it is used in ifupdown mode + Added some preliminary test scripts for the parser * Done in version 0.25 + logic_error creating a string with a null when running guessnet -i (or maybe also normal guessnet) on an interface who's up but not initialized yet) * Done in version 0.24 --- 2003-12-21 + Configuration file: change "test-stuff" in "test stuff". Allow for both syntaxes. + Allow for specifying test-peer scans without a macaddress. If no macaddress is provided, when and PARP reply is received it should not be tested for MACaddress match, but just make the test succeed. In this case it's like a ping scan. + Make sure that we use forward arp instead of reverse arp * Done in version 0.23 "Who does not die sees himself again" --- 2003-12-20 + Implemented two different environments for the two different work modes (normal and ifupdown) + Port to libnet1 + Encapsulate configuration parsing, and instantiate the right parser through a factory class that checks commandline switches and whatever + If there are no profiles given in stdin in ifupdown mode, assume they are all enabled + Integrate the simple patch from the BTS (thank you Fabian Knittel!) + If the interface detects no link beat, output a profile "none". Add a switch to change its name and to turn the feature off for interfaces that do not support link beat detection. + Open a project on a development server like Savannah, SourceForge or Alioth. (Chosen Alioth) * Done in version 0.21 --- 2003-05-26 + In ifupdown mode, read from stdin all the commandline parameters, not just the --default equivalent + Document the new peer and commandline-in-map-lines syntax + Guess the local network address and the gateway address through network sniffing: + build a table with source and target IPs and MACs of IP packets that pass thru the network: in the common case, you have packets from and to the local net, and packets from/to outside with the gateway MAC address in the side of the external IP. After some sniffing, it should be easy to distinguish the gateway from the other machines, and consequently the local network address + use this scheme in an external application that scans for a gateway and prints a guessnet scan definition to be put in the config file * Done in version 0.20 --- 2003-05-25 + Removed redundant documentation from the README, and added a line pointing to the manpage for further documentation + The new peer syntax is not parsed well (it misses all key-value pairs except the first) + Replace -V with -vv (or with --debug) and let -V work as --version + Remove dependancy on libpopt + Use the code from netplugd to wait for an interface to come up instead of using init-timeout. Use init-timeout only to avoid waiting indefinitely in case of problems. --- 2003-05-19 + NetSender, NetWatcher and ProcessRunner didn't increment the Impl reference count in their plain constructor * Done in version 0.19 --- 2003-05-16 + Change the parser to allow a syntax like: + test-peer ip 1.2.3.4 mac a:b:c:d:e:F service www and consider only the parameters that are needed + test-command commandline + The interface default in ifupdown mode should be listed in a line as: default: name + The test to see if an interface is up does not work, and if the interface is down, pcap_next returns 0 because it's not been brought up + the interface keeps existing in /proc/net/dev even if it's down. + use the check from netplugd * Done in version 0.18 --- 2003-05-10 + Ship guessnet with a guessnet-ifupdown link + Do not scan getppid for ifupdown mode, but check argv0. + Prefix the ifupdown guessnet lines with "guessnet " + manpage: change the program description, since now it doesn't just use ARP probes + manpage: document -i behaviour + manpage: document script scan behaviour + Make a singleton environment class to hold run-time parameters (interface, verbosity...) + Export NAME=tag and IFACE=interface in the environment of child scripts + [Thomas Hood] you need to add an option to set the configuration file. With the [current] syntax, you can't specify a config file unless you also specify an ethernet interface + ChildProcess: make more versions of fork, especially a simple one that does not try to do magic with file descriptors + In ifupdown mode, read the list of profiles to try from stdin, so that it won't always try every possible stanza found in /etc/network/interfaces + guessnet hangs if no candidates are found in input + Locks waiting mutex in killall at runner.shutdown() + guessnet hangs if only a script /bin/false candidate is found in input * Done in version 0.17 --- 2003-05-09 * Introduce other detection ideas: + External script + Rename --use-interfaces to --use-ifupdown * Older releases --- + Add a manpage + Use a different timeout if the interface is not found up but is brought up by guessnet, since in that case it might require more time to initialize itself + Audit the code clearing endianness issues + Port to libnet1 = Check what is the difference between guessnet and the arpfind script found in the scripts directory of newer whereami, that do arping -f -w1 -D -I $INTERFACE $REMOTEIP | grep -e $REMOTEMAC Example: marvin:~# arping -f -w1 -D -I eth0 192.168.1.1 ARPING 192.168.1.1 from 0.0.0.0 eth0 Unicast reply from 192.168.1.1 [00:01:02:03:04:05] for 192.168.1.1 [00:0A:0B:0C:0D:0E] 0.741ms Sent 1 probes (1 broadcast(s)) Received 1 response(s) If they are the same, we could get rid of guessnet and write a shellscript around arping to do the same. = After the redesign, a script cannot do what guessnet is doing + Backport to libnet0 (*&%^%$^!!) + See if the broadcast IP address can be used as the local IP address No, but 0.0.0.0 can (see arping -D manpage) + Implement the new config file syntax + - Example: casa peer 192.168.1.1 01:02:03:04:05:06 uni dhcp otherplace script /usr/local/bin/detect-otherplace + Hervé Eychenne > So, the pb is that you MUST specify the interface when using -v and -V > options, whereas you don't have to when specifying no parameter. LINKS ===== - http://www.networksorcery.com/enp/protocol/ guessnet-0.55/src/0000755000000000000000000000000011770717500010762 5ustar guessnet-0.55/src/IFace.cc0000644000000000000000000004041711770705652012253 0ustar /* * Encapsulate access to a network interface * * Copyright (C) 2003 Enrico Zini * * Interface configuration routines are adapted from * Laptop-net, Copyright 2002 Massachusetts Institute of Technology * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include #else #warning No config.h found: using fallback values #define IFCONFIG "/sbin/ifconfig" #endif #include "IFace.h" #include // strncpy #include // socket #include // socket #include // ioctl //#include #include // close #include /* wait */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "util/output.h" #ifndef SIOCGMIIPHY #define SIOCGMIIPHY (SIOCDEVPRIVATE) /* Get the PHY in use. */ #define SIOCGMIIREG (SIOCDEVPRIVATE+1) /* Read a PHY register. */ #endif #define IFP_VALID_ADDR 0x1 #define IFP_VALID_DSTADDR 0x2 #define IFP_VALID_BROADADDR 0x4 #define IFP_VALID_NETMASK 0x8 #define IFP_VALID_ALL 0xF #define IFP_ALL_ADDRESSES_VALID(ifp) \ ((((ifp) -> addr_flags) & IFP_VALID_ALL) == IFP_VALID_ALL) using namespace std; #include "ethtool-local.h" #if 0 #include "wireless.h" #endif typedef enum { IFSTATUS_UP, IFSTATUS_DOWN, IFSTATUS_ERR } interface_status_t; static interface_status_t interface_detect_beat_mii(int fd, const char *iface) { struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name)-1); if (ioctl(fd, SIOCGMIIPHY, &ifr) == -1) throw wibble::exception::MII("SIOCGMIIPHY failed"); ((unsigned short*) &ifr.ifr_data)[1] = 1; if (ioctl(fd, SIOCGMIIREG, &ifr) == -1) throw wibble::exception::MII("SIOCGMIIREG failed"); return (((unsigned short*) &ifr.ifr_data)[3] & 0x0016) == 0x0004 ? IFSTATUS_UP : IFSTATUS_DOWN; } static interface_status_t interface_detect_beat_priv(int fd, const char *iface) { struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name)-1); if (ioctl(fd, SIOCDEVPRIVATE, &ifr) == -1) throw wibble::exception::MII("SIOCDEVPRIVATE failed"); ((unsigned short*) &ifr.ifr_data)[1] = 1; if (ioctl(fd, SIOCDEVPRIVATE+1, &ifr) == -1) throw wibble::exception::MII("SIOCDEVPRIVATE+1 failed"); return (((unsigned short*) &ifr.ifr_data)[3] & 0x0016) == 0x0004 ? IFSTATUS_UP : IFSTATUS_DOWN; } static interface_status_t interface_detect_beat_ethtool(int fd, const char *iface) { struct ifreq ifr; struct ethtool_value edata; memset(&ifr, 0, sizeof(ifr)); strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name)-1); edata.cmd = ETHTOOL_GLINK; ifr.ifr_data = (caddr_t) &edata; if (ioctl(fd, SIOCETHTOOL, &ifr) == -1) throw wibble::exception::MII("ETHTOOL_GLINK failed"); return edata.data ? IFSTATUS_UP : IFSTATUS_DOWN; } #if 0 static int get_wlan_qual_old(const char *iface) { FILE *f; char buf[256]; char *bp; int l, q = -1; l = strlen(iface); if (!(f = fopen("/proc/net/wireless", "r"))) throw wibble::exception::MII("Failed to open /proc/net/wireless"); while (fgets(buf, sizeof(buf)-1, f)) { bp = buf; while (*bp && isspace(*bp)) bp++; if(!strncmp(bp, iface, l) && bp[l]==':') { /* skip device name */ if (!(bp = strchr(bp,' '))) break; bp++; /* skip status */ if (!(bp = strchr(bp,' '))) break; q = atoi(bp); break; }; } fclose(f); if (q < 0) throw wibble::exception::MII("Failed to find interface in /proc/net/wireless"); return q; } static int get_wlan_qual_new(int fd, const char *iface) { struct iwreq req; struct iw_statistics q; static struct iw_range range; memset(&req, 0, sizeof(req)); strncpy(req.ifr_ifrn.ifrn_name, iface, IFNAMSIZ); req.u.data.pointer = (caddr_t) &q; req.u.data.length = sizeof(q); req.u.data.flags = 1; if (ioctl(fd, SIOCGIWSTATS, &req) < 0) throw wibble::exception::MII("Failed to get interface quality"); memset(&req, 0, sizeof(req)); strncpy(req.ifr_ifrn.ifrn_name, iface, IFNAMSIZ); memset(&range, 0, sizeof(struct iw_range)); req.u.data.pointer = (caddr_t) ⦥ req.u.data.length = sizeof(struct iw_range); req.u.data.flags = 0; if (ioctl(fd, SIOCGIWRANGE, &req) < 0) throw wibble::exception::MII("SIOCGIWRANGE failed"); /* Test if both qual and level are on their lowest level */ if (q.qual.qual <= 0 && (q.qual.level > range.max_qual.level ? q.qual.level <= 156 : q.qual.level <= 0)) return 0; return 1; } static int is_assoc_ap(uint8_t mac[ETH_ALEN]) throw () { int b, j; b = 1; for (j = 1; j < ETH_ALEN; j++) if (mac[j] != mac[0]) { b = 0; break; } return !b || (mac[0] != 0xFF && mac[0] != 0x44 && mac[0] != 0x00); } static interface_status_t interface_detect_beat_wlan(int fd, const char *iface) { uint8_t mac[6]; int q; struct iwreq req; memset(&req, 0, sizeof(req)); strncpy(req.ifr_ifrn.ifrn_name, iface, IFNAMSIZ); if (ioctl(fd, SIOCGIWAP, &req) < 0) throw wibble::exception::MII("Failed to get AP address"); memcpy(mac, &(req.u.ap_addr.sa_data), ETH_ALEN); if (!is_assoc_ap(mac)) return IFSTATUS_DOWN; if ((q = get_wlan_qual_new(fd, iface)) < 0) if ((q = get_wlan_qual_old(iface)) < 0) throw wibble::exception::MII("Failed to get wireless link quality"); return q > 0 ? IFSTATUS_UP : IFSTATUS_DOWN; } #endif static interface_status_t (*cached_detect_beat_func)(int, const char*) = NULL; static interface_status_t detect_beat_auto(int fd, const char *iface) { if (cached_detect_beat_func) try { return cached_detect_beat_func(fd, iface); } catch (wibble::exception::MII& e) { verbose("Link beat detection (cached) failed: %s\n", e.desc().c_str()); } try { interface_status_t status = interface_detect_beat_mii(fd, iface); cached_detect_beat_func = interface_detect_beat_mii; return status; } catch (wibble::exception::MII& e) { verbose("Link beat detection (mii) failed: %s\n", e.desc().c_str()); } try { interface_status_t status = interface_detect_beat_ethtool(fd, iface); cached_detect_beat_func = interface_detect_beat_ethtool; return status; } catch (wibble::exception::MII& e) { verbose("Link beat detection (ethtool) failed: %s\n", e.desc().c_str()); } #if 0 try { interface_status_t status = interface_detect_beat_wlan(fd, iface); cached_detect_beat_func = interface_detect_beat_wlan; return status; } catch (wibble::exception::MII& e) { verbose("Link beat detection (wlan) failed: %s\n", e.desc().c_str()); } #endif try { interface_status_t status = interface_detect_beat_priv(fd, iface); cached_detect_beat_func = interface_detect_beat_priv; return status; } catch (wibble::exception::MII& e) { verbose("Link beat detection (priv) failed: %s\n", e.desc().c_str()); } verbose("No working link beat detection function available for interface %s\n", iface); return IFSTATUS_ERR; } #define READ_ADDR(symbol, field, addr_flag) \ { \ if ((ioctl (_socket, symbol, _ifr)) < 0) \ { \ if (errno != EADDRNOTAVAIL) \ throw wibble::exception::IFace(string("getting " #field " for ") + name()); \ (ifp -> addr_flags) &=~ (addr_flag); \ } \ else \ { \ (ifp -> field) \ = (* ((struct sockaddr_in *) (& (_ifr -> ifr_##field)))); \ (ifp -> addr_flags) |= (addr_flag); \ } \ } void IFace::read_interface_configuration(struct if_params *ifp) throw (wibble::exception::IFace) { if ((ioctl (_socket, SIOCGIFFLAGS, _ifr)) < 0) throw wibble::exception::IFace(string("getting interface flags for ") + name()); ifp->flags = _ifr->ifr_flags; (ifp -> addr_flags) = 0; READ_ADDR (SIOCGIFADDR, addr, IFP_VALID_ADDR); READ_ADDR (SIOCGIFDSTADDR, dstaddr, IFP_VALID_DSTADDR); READ_ADDR (SIOCGIFBRDADDR, broadaddr, IFP_VALID_BROADADDR); READ_ADDR (SIOCGIFNETMASK, netmask, IFP_VALID_NETMASK); if ((ioctl (_socket, SIOCGIFHWADDR, _ifr)) < 0) { if (errno != EADDRNOTAVAIL) throw wibble::exception::IFace(string("getting hwaddr for ") + name()); bzero(&(ifp->hwaddr), sizeof(struct sockaddr)); } else { ifp->hwaddr = _ifr->ifr_hwaddr; } } #define WRITE_ADDR(symbol, field, addr_flag) \ { \ if (((ifp . addr_flags) & (addr_flag)) != 0) \ { \ memcpy(&(_ifr->ifr_##field), &(ifp.field), sizeof(struct sockaddr)); \ if ((ioctl (_socket, symbol, _ifr)) < 0) \ throw wibble::exception::IFace("setting interface configuration for " + name()); \ } \ } void IFace::write_interface_configuration(const struct if_params& ifp) throw (wibble::exception::IFace) { //writeField(fd, ifr, SIOCSIFADDR); WRITE_ADDR (SIOCSIFADDR, addr, IFP_VALID_ADDR); WRITE_ADDR (SIOCSIFDSTADDR, dstaddr, IFP_VALID_DSTADDR); WRITE_ADDR (SIOCSIFBRDADDR, broadaddr, IFP_VALID_BROADADDR); WRITE_ADDR (SIOCSIFNETMASK, netmask, IFP_VALID_NETMASK); (_ifr -> ifr_flags) = (ifp . flags); if ((ioctl (_socket, SIOCSIFFLAGS, _ifr)) < 0) throw wibble::exception::IFace("setting interface configuration for " + name()); } IFace::IFace(const string& name) throw (wibble::exception::System, wibble::exception::IFace, wibble::exception::MII) : _socket(-1), _ifr(0), _up(false), _run(false), _conn(false), _has_iface(false), _has_mii(true) { _socket = socket(AF_INET, SOCK_DGRAM, 0); if (_socket == -1) throw wibble::exception::System("opening generic socket"); _ifr = new struct ifreq; int sz = name.size(); if (sz > IFNAMSIZ - 1) sz = IFNAMSIZ - 1; memcpy(_ifr->ifr_name, name.data(), sz); _ifr->ifr_name[sz] = 0; update(); } IFace::~IFace() throw () { if (_ifr) delete _ifr; if (_socket != -1) close(_socket); } string IFace::name() const throw () { return _ifr->ifr_name; } void IFace::update() throw (wibble::exception::IFace, wibble::exception::MII) { try { if (ioctl(_socket, SIOCGIFFLAGS, _ifr) == -1) throw wibble::exception::IFace("getting interface flags for " + name()); _up = (_ifr->ifr_flags & IFF_UP) != 0; _run = (_ifr->ifr_flags & IFF_RUNNING) != 0; if (!_has_iface) { //log_info("Interface queries for " + name() + " started working"); _has_iface = true; _up = false; _run = false; _conn = false; } if (_has_mii) { debug("Trying MII detection\n"); interface_status_t status = detect_beat_auto(_socket, name().c_str()); if (status == IFSTATUS_ERR) { _has_mii = false; // If we have no link beat, consider as we're always connected _conn = true; } else { _conn = (status == IFSTATUS_UP); } /* if (ioctl(_socket, SIOCGMIIPHY, _ifr) == -1) throw wibble::exception::MII("getting MII informations for " + name()); unsigned short* ifdata = (unsigned short *)&(_ifr->ifr_data); ifdata[1] = 1; if (ioctl(_socket, SIOCGMIIREG, _ifr) == -1) throw wibble::exception::MII("reading MII register for " + name()); _conn = (ifdata[3] & 0x0016) == 0x0004; */ } } catch (wibble::exception::MII& e) { //log_info("Link beat detection failed for interface " + name() + // ": disabling it. Error was: " + // e.type() + ": " + e.desc()); verbose("Exception during link beat detection: %s: %s\n", e.type(), e.desc().c_str()); _has_mii = false; } catch (wibble::exception::IFace& e) { if (_has_iface) { //log_info("Interface query failed for interface " + name() + // ". Error was: " + e.type() + ": " + e.desc()); _has_iface = false; _conn = false; } } } static const void storeIP(struct sockaddr_in& field, const char* addr) { memset(&field, 0, sizeof(field)); field.sin_family = AF_INET; if (!inet_aton(addr, &(field.sin_addr))) fatal_error("Invalid address: %s", addr); } #define STORE_IP(string, field, addr_flag) \ ((memset ((& (ifp . field)), 0, (sizeof (ifp . field)))), \ ((ifp . field . sin_family) = AF_INET), \ ((inet_aton ((string), (& (ifp . field . sin_addr)))) \ ? (((ifp . addr_flags) |= (addr_flag)), 1) \ : (((ifp . addr_flags) &=~ (addr_flag)), 0))) /* Initialize the interface (with "ifconfig up" if it is found down * Return true if the interface was down */ if_params IFace::initBroadcast(int timeout) throw (wibble::exception::IFace) { if_params res; read_interface_configuration(&res); if_params ifp = res; /* if (up()) { verbose("Interface %.*s is up\n", PFSTR(name())); return; } if ((((ifp . flags) & IFF_UP) != 0) && (((ifp . flags) & IFF_RUNNING) != 0) && (IFP_ALL_ADDRESSES_VALID (&ifp))) return (0); */ if (/*libnet_workaround*/ false) { ifp.flags |= IFF_UP | IFF_RUNNING; storeIP(ifp.addr, "192.168.254.254"); storeIP(ifp.dstaddr, "192.168.254.0"); storeIP(ifp.broadaddr, "192.168.254.255"); storeIP(ifp.broadaddr, "255.255.255.0"); ifp.addr_flags |= (IFP_VALID_ADDR | IFP_VALID_DSTADDR | IFP_VALID_BROADADDR | IFP_VALID_NETMASK); write_interface_configuration(ifp); } else { memset(&(_ifr->ifr_addr), 0, sizeof(sockaddr)); ((struct sockaddr_in*)&_ifr->ifr_addr)->sin_family = AF_INET; ((struct sockaddr_in*)&_ifr->ifr_addr)->sin_addr.s_addr = INADDR_ANY; if ((ioctl (_socket, SIOCSIFADDR, _ifr)) < 0) throw wibble::exception::IFace("setting interface configuration for " + name()); if ((ioctl (_socket, SIOCGIFFLAGS, _ifr)) < 0) throw wibble::exception::IFace(string("getting interface flags for ") + name()); _ifr->ifr_flags |= IFF_UP | IFF_RUNNING; if ((ioctl (_socket, SIOCSIFFLAGS, _ifr)) < 0) throw wibble::exception::IFace("setting interface configuration for " + name()); /* storeEmptyIP(ifp.addr); storeEmptyIP(ifp.dstaddr); storeEmptyIP(ifp.broadaddr); storeEmptyIP(ifp.broadaddr); ifp.addr_flags &= !(IFP_VALID_ADDR | IFP_VALID_DSTADDR | IFP_VALID_BROADADDR | IFP_VALID_NETMASK); //ifp.addr_flags |= (IFP_VALID_ADDR | IFP_VALID_NETMASK); ifp.addr_flags |= (IFP_VALID_ADDR); */ } /* Wait a little for the interface to initialize */ time_t pre_wait = time(0); while (time(0) < pre_wait + timeout) { update(); if (up()) return res; else usleep(300000); } warning("Interface did not come up in %d seconds\n", timeout); return res; } if_params IFace::getConfiguration() throw (wibble::exception::IFace) { if_params res; read_interface_configuration(&res); return res; } if_params IFace::setConfiguration(const if_params& config) throw (wibble::exception::IFace) { if_params res; read_interface_configuration(&res); write_interface_configuration(config); return res; } void if_params::print() { string s_addr = addr_flags & IFP_VALID_ADDR ? inet_ntoa(addr.sin_addr) : "invalid"; string s_dest = addr_flags & IFP_VALID_DSTADDR ? inet_ntoa(dstaddr.sin_addr) : "invalid"; string s_bcst = addr_flags & IFP_VALID_BROADADDR ? inet_ntoa(broadaddr.sin_addr) : "invalid"; string s_mask = addr_flags & IFP_VALID_NETMASK ? inet_ntoa(netmask.sin_addr) : "invalid"; stringstream str; str << s_addr << " dst " << s_dest << " bcast " << s_bcst << " nm " << s_mask << " flags " << flags << " aflags " << addr_flags << " hwaddrtype " << hwaddr.sa_family << endl; output("%s", str.str().c_str()); } // vim:set ts=4 sw=4: guessnet-0.55/src/IfaceParser.h0000644000000000000000000000211511770705652013323 0ustar #ifndef IFACE_PARSER_H #define IFACE_PARSER_H /* * /etc/network/interfaces parser * * Copyright (C) 2003--2010 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "parser.h" #include "options.h" #include class IfaceParser { public: static void parseMapping(FILE* in); static void parse(FILE* in, const IfaceFilter& filter = IfaceFilter()); }; // vim:set ts=4 sw=4: #endif guessnet-0.55/src/ethtool-kernel.h0000644000000000000000000002626111770705652014103 0ustar /* * ethtool.h: Defines for Linux ethtool. * * Copyright (C) 1998 David S. Miller (davem@redhat.com) * Copyright 2001 Jeff Garzik * Portions Copyright 2001 Sun Microsystems (thockin@sun.com) * Portions Copyright 2002 Intel (eli.kupermann@intel.com, * christopher.leech@intel.com, * scott.feldman@intel.com) */ #ifndef _LINUX_ETHTOOL_H #define _LINUX_ETHTOOL_H /* This should work for both 32 and 64 bit userland. */ struct ethtool_cmd { u32 cmd; u32 supported; /* Features this interface supports */ u32 advertising; /* Features this interface advertises */ u16 speed; /* The forced speed, 10Mb, 100Mb, gigabit */ u8 duplex; /* Duplex, half or full */ u8 port; /* Which connector port */ u8 phy_address; u8 transceiver; /* Which tranceiver to use */ u8 autoneg; /* Enable or disable autonegotiation */ u32 maxtxpkt; /* Tx pkts before generating tx int */ u32 maxrxpkt; /* Rx pkts before generating rx int */ u32 reserved[4]; }; #define ETHTOOL_BUSINFO_LEN 32 /* these strings are set to whatever the driver author decides... */ struct ethtool_drvinfo { u32 cmd; char driver[32]; /* driver short name, "tulip", "eepro100" */ char version[32]; /* driver version string */ char fw_version[32]; /* firmware version string, if applicable */ char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ /* For PCI devices, use pci_dev->slot_name. */ char reserved1[32]; char reserved2[20]; u32 testinfo_len; u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */ u32 regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */ }; #define SOPASS_MAX 6 /* wake-on-lan settings */ struct ethtool_wolinfo { u32 cmd; u32 supported; u32 wolopts; u8 sopass[SOPASS_MAX]; /* SecureOn(tm) password */ }; /* for passing single values */ struct ethtool_value { u32 cmd; u32 data; }; /* for passing big chunks of data */ struct ethtool_regs { u32 cmd; u32 version; /* driver-specific, indicates different chips/revs */ u32 len; /* bytes */ u8 data[0]; }; /* for passing EEPROM chunks */ struct ethtool_eeprom { u32 cmd; u32 magic; u32 offset; /* in bytes */ u32 len; /* in bytes */ u8 data[0]; }; /* for configuring coalescing parameters of chip */ struct ethtool_coalesce { u32 cmd; /* ETHTOOL_{G,S}COALESCE */ /* How many usecs to delay an RX interrupt after * a packet arrives. If 0, only rx_max_coalesced_frames * is used. */ u32 rx_coalesce_usecs; /* How many packets to delay an RX interrupt after * a packet arrives. If 0, only rx_coalesce_usecs is * used. It is illegal to set both usecs and max frames * to zero as this would cause RX interrupts to never be * generated. */ u32 rx_max_coalesced_frames; /* Same as above two parameters, except that these values * apply while an IRQ is being services by the host. Not * all cards support this feature and the values are ignored * in that case. */ u32 rx_coalesce_usecs_irq; u32 rx_max_coalesced_frames_irq; /* How many usecs to delay a TX interrupt after * a packet is sent. If 0, only tx_max_coalesced_frames * is used. */ u32 tx_coalesce_usecs; /* How many packets to delay a TX interrupt after * a packet is sent. If 0, only tx_coalesce_usecs is * used. It is illegal to set both usecs and max frames * to zero as this would cause TX interrupts to never be * generated. */ u32 tx_max_coalesced_frames; /* Same as above two parameters, except that these values * apply while an IRQ is being services by the host. Not * all cards support this feature and the values are ignored * in that case. */ u32 tx_coalesce_usecs_irq; u32 tx_max_coalesced_frames_irq; /* How many usecs to delay in-memory statistics * block updates. Some drivers do not have an in-memory * statistic block, and in such cases this value is ignored. * This value must not be zero. */ u32 stats_block_coalesce_usecs; /* Adaptive RX/TX coalescing is an algorithm implemented by * some drivers to improve latency under low packet rates and * improve throughput under high packet rates. Some drivers * only implement one of RX or TX adaptive coalescing. Anything * not implemented by the driver causes these values to be * silently ignored. */ u32 use_adaptive_rx_coalesce; u32 use_adaptive_tx_coalesce; /* When the packet rate (measured in packets per second) * is below pkt_rate_low, the {rx,tx}_*_low parameters are * used. */ u32 pkt_rate_low; u32 rx_coalesce_usecs_low; u32 rx_max_coalesced_frames_low; u32 tx_coalesce_usecs_low; u32 tx_max_coalesced_frames_low; /* When the packet rate is below pkt_rate_high but above * pkt_rate_low (both measured in packets per second) the * normal {rx,tx}_* coalescing parameters are used. */ /* When the packet rate is (measured in packets per second) * is above pkt_rate_high, the {rx,tx}_*_high parameters are * used. */ u32 pkt_rate_high; u32 rx_coalesce_usecs_high; u32 rx_max_coalesced_frames_high; u32 tx_coalesce_usecs_high; u32 tx_max_coalesced_frames_high; /* How often to do adaptive coalescing packet rate sampling, * measured in seconds. Must not be zero. */ u32 rate_sample_interval; }; /* for configuring RX/TX ring parameters */ struct ethtool_ringparam { u32 cmd; /* ETHTOOL_{G,S}RINGPARAM */ /* Read only attributes. These indicate the maximum number * of pending RX/TX ring entries the driver will allow the * user to set. */ u32 rx_max_pending; u32 rx_mini_max_pending; u32 rx_jumbo_max_pending; u32 tx_max_pending; /* Values changeable by the user. The valid values are * in the range 1 to the "*_max_pending" counterpart above. */ u32 rx_pending; u32 rx_mini_pending; u32 rx_jumbo_pending; u32 tx_pending; }; /* for configuring link flow control parameters */ struct ethtool_pauseparam { u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */ /* If the link is being auto-negotiated (via ethtool_cmd.autoneg * being true) the user may set 'autonet' here non-zero to have the * pause parameters be auto-negotiated too. In such a case, the * {rx,tx}_pause values below determine what capabilities are * advertised. * * If 'autoneg' is zero or the link is not being auto-negotiated, * then {rx,tx}_pause force the driver to use/not-use pause * flow control. */ u32 autoneg; u32 rx_pause; u32 tx_pause; }; #define ETH_GSTRING_LEN 32 enum ethtool_stringset { ETH_SS_TEST = 0, ETH_SS_STATS, }; /* for passing string sets for data tagging */ struct ethtool_gstrings { u32 cmd; /* ETHTOOL_GSTRINGS */ u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/ u32 len; /* number of strings in the string set */ u8 data[0]; }; enum ethtool_test_flags { ETH_TEST_FL_OFFLINE = (1 << 0), /* online / offline */ ETH_TEST_FL_FAILED = (1 << 1), /* test passed / failed */ }; /* for requesting NIC test and getting results*/ struct ethtool_test { u32 cmd; /* ETHTOOL_TEST */ u32 flags; /* ETH_TEST_FL_xxx */ u32 reserved; u32 len; /* result length, in number of u64 elements */ u64 data[0]; }; /* CMDs currently supported */ #define ETHTOOL_GSET 0x00000001 /* Get settings. */ #define ETHTOOL_SSET 0x00000002 /* Set settings, privileged. */ #define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ #define ETHTOOL_GREGS 0x00000004 /* Get NIC registers, privileged. */ #define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ #define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options, priv. */ #define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */ #define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level, priv. */ #define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation, priv. */ #define ETHTOOL_GLINK 0x0000000a /* Get link status (ethtool_value) */ #define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */ #define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data, priv. */ #define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */ #define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config, priv. */ #define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */ #define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters, priv. */ #define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */ #define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters, priv. */ #define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */ #define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */ #define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */ #define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */ #define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable * (ethtool_value) */ #define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable * (ethtool_value), priv. */ #define ETHTOOL_TEST 0x0000001a /* execute NIC self-test, priv. */ #define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */ #define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */ /* compatibility with older code */ #define SPARC_ETH_GSET ETHTOOL_GSET #define SPARC_ETH_SSET ETHTOOL_SSET /* Indicates what features are supported by the interface. */ #define SUPPORTED_10baseT_Half (1 << 0) #define SUPPORTED_10baseT_Full (1 << 1) #define SUPPORTED_100baseT_Half (1 << 2) #define SUPPORTED_100baseT_Full (1 << 3) #define SUPPORTED_1000baseT_Half (1 << 4) #define SUPPORTED_1000baseT_Full (1 << 5) #define SUPPORTED_Autoneg (1 << 6) #define SUPPORTED_TP (1 << 7) #define SUPPORTED_AUI (1 << 8) #define SUPPORTED_MII (1 << 9) #define SUPPORTED_FIBRE (1 << 10) #define SUPPORTED_BNC (1 << 11) /* Indicates what features are advertised by the interface. */ #define ADVERTISED_10baseT_Half (1 << 0) #define ADVERTISED_10baseT_Full (1 << 1) #define ADVERTISED_100baseT_Half (1 << 2) #define ADVERTISED_100baseT_Full (1 << 3) #define ADVERTISED_1000baseT_Half (1 << 4) #define ADVERTISED_1000baseT_Full (1 << 5) #define ADVERTISED_Autoneg (1 << 6) #define ADVERTISED_TP (1 << 7) #define ADVERTISED_AUI (1 << 8) #define ADVERTISED_MII (1 << 9) #define ADVERTISED_FIBRE (1 << 10) #define ADVERTISED_BNC (1 << 11) /* The following are all involved in forcing a particular link * mode for the device for setting things. When getting the * devices settings, these indicate the current mode and whether * it was foced up into this mode or autonegotiated. */ /* The forced speed, 10Mb, 100Mb, gigabit. */ #define SPEED_10 10 #define SPEED_100 100 #define SPEED_1000 1000 /* Duplex, half or full. */ #define DUPLEX_HALF 0x00 #define DUPLEX_FULL 0x01 /* Which connector port. */ #define PORT_TP 0x00 #define PORT_AUI 0x01 #define PORT_MII 0x02 #define PORT_FIBRE 0x03 #define PORT_BNC 0x04 /* Which tranceiver to use. */ #define XCVR_INTERNAL 0x00 #define XCVR_EXTERNAL 0x01 #define XCVR_DUMMY1 0x02 #define XCVR_DUMMY2 0x03 #define XCVR_DUMMY3 0x04 /* Enable or disable autonegotiation. If this is set to enable, * the forced link modes above are completely ignored. */ #define AUTONEG_DISABLE 0x00 #define AUTONEG_ENABLE 0x01 /* Wake-On-Lan options. */ #define WAKE_PHY (1 << 0) #define WAKE_UCAST (1 << 1) #define WAKE_MCAST (1 << 2) #define WAKE_BCAST (1 << 3) #define WAKE_ARP (1 << 4) #define WAKE_MAGIC (1 << 5) #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */ #endif /* _LINUX_ETHTOOL_H */ guessnet-0.55/src/options.cc0000644000000000000000000001532311770705652012775 0ustar /* * Program options * * Copyright (C) 2003--2010 Enrico Zini * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include #define APPNAME PACKAGE #else #warning No config.h found: using fallback values #define APPNAME "missing appname" #define VERSION "unknown" #endif #include "options.h" #include "util/output.h" #include "util/netsender.h" #include "util/netwatcher.h" #include "scanner/iwscan.h" #include "GuessnetParser.h" #include "IfaceParser.h" #include #if 0 #include #include #include #endif using namespace std; namespace wibble { namespace commandline { struct GuessnetOptions : public StandardParserWithManpage { public: BoolOption* verbose; BoolOption* debug; BoolOption* syslog; BoolOption* ifupdown; BoolOption* autofilter; StringOption* defprof; IntOption* timeout; IntOption* inittime; IntOption* initdelay; IntOption* iwscan_tries; ExistingFileOption* configfile; GuessnetOptions() : StandardParserWithManpage(APPNAME, VERSION, 8, "enrico@enricozini.org") { usage = "[options] [iface]"; description = "Guess the current network location"; verbose = add("verbose", 'v', "verbose", "", "enable verbose output"); debug = add("debug", 0, "debug", "", "enable debugging output (including verbose output)"); syslog = add("syslog", 0, "syslog", "", "send messages to syslog facility DAEMON, in addition to stderr"); configfile = add("configfile", 'C', "config-file", "", "name of the configuration file to read (default: stdin or" "/etc/network/interfaces in ifupdown mode"); ifupdown = add("ifupdown", 'i', "ifupdown-mode", "", "use /etc/network/interfaces file instead of the usual" " guessnet configuration file"); defprof = add("defprof", 'd', "default", "name", "profile name to report if no known networks are found" " (defaults to \"none\")"); timeout = add("timeout", 't', "timeout", "seconds", "timeout (in seconds) used to wait for response packets" " (defaults to 5 seconds)"); inittime = add("inittime", 0, "init-time", "seconds", "time (in seconds) to wait for the interface to initialize" " when not found already up (defaults to 3 seconds)"); autofilter = add("autofilter", 0, "autofilter", "", "enable autofiltering interfaces based on their name (default: off)"); initdelay = add("initdelay", 0, "init-delay", "seconds", "sleep a given number of seconds before starting operations (default: 0)"); iwscan_tries = add("iwscantries", 0, "iwscan-tries", "", "number of tries for wireless network scanning (default: 1)"); } }; } } Options options; // Initialize the environment with default values Options::Options() : iface("eth0"), defprof("none"), timeout(5), init_timeout(3), iwscan_tries(1), iface_filter(0) { } Options::~Options() { if (iface_filter) delete iface_filter; } void Options::init(int argc, const char* argv[]) { wibble::commandline::GuessnetOptions opts; if (opts.parse(argc, (const char**)argv)) exit(0); // Set verbosity util::Output::get().verbose(opts.verbose->boolValue()); util::Output::get().debug(opts.debug->boolValue()); util::Output::get().syslog(opts.syslog->boolValue()); // Find out the interface to be tested if (opts.hasNext()) iface = opts.next(); else iface = "eth0"; // Find out the configuration file to use if (opts.hasNext()) config_file = opts.next(); else if (opts.configfile->isSet()) config_file = opts.configfile->stringValue(); // Find out the default profile name if (opts.defprof->boolValue()) { defprof = opts.defprof->stringValue(); ::verbose("Default profile set to `%s'\n", defprof.c_str()); } // Find out the test timeout if (opts.timeout->boolValue()) timeout = opts.timeout->intValue(); // Find out the init timeout if (opts.inittime->boolValue()) init_timeout = opts.inittime->intValue(); // Set autofiltering autofilter = opts.autofilter->boolValue(); // Set initial delay to avoid race conditions initdelay = opts.initdelay->intValue(); // Number of iwscan tries if (opts.iwscan_tries->boolValue()) iwscan_tries = opts.iwscan_tries->intValue(); // Check user id /* if (geteuid() != 0) fatal_error("You must run this command as root."); */ // Find out wether we should run in ifupdown mode bool ifupdown_mode = opts.ifupdown->boolValue(); if (!ifupdown_mode) { const char* pname = strrchr(argv[0], '/'); pname = pname ? pname + 1 : argv[0]; if (strcmp(pname, "guessnet-ifupdown") == 0) ifupdown_mode = true; } if (ifupdown_mode) init_ifupdown(opts); else init_standalone(opts); util::NetSender::configure(iface); util::NetWatcher::configure(iface); scanner::IWScan::configure(iface); if (ifupdown_mode) parse_ifupdown_config(); else parse_guessnet_config(); } void Options::init_standalone(wibble::commandline::GuessnetOptions& opts) { // Nothing to do } void Options::init_ifupdown(wibble::commandline::GuessnetOptions& opts) { // We have a default config file name in ifupdown mode if (options.config_file.empty()) options.config_file = "/etc/network/interfaces"; IfaceParser::parseMapping(stdin); } void Options::parse_guessnet_config() { /* Open the specified config file or stdin if not specified */ FILE* input = stdin; if (!config_file.empty()) { input = fopen(config_file.c_str(), "rt"); if (!input) throw wibble::exception::File(config_file, "opening file"); } GuessnetParser::parse(input); if (input != stdin) fclose(input); } void Options::parse_ifupdown_config() { /* Open the specified config file or stdin if not specified */ FILE* input = fopen(config_file.c_str(), "rt");; if (!input) throw wibble::exception::File(config_file, "opening file"); if (iface_filter) IfaceParser::parse(input, *iface_filter); else IfaceParser::parse(input); fclose(input); } // vim:set ts=4 sw=4: guessnet-0.55/src/GuessnetParser.h0000644000000000000000000000205111770705652014110 0ustar #ifndef GUESSNET_PARSER_H #define GUESSNET_PARSER_H /* * Parser for standard guessnet configuration file * * Copyright (C) 2003--2010 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "parser.h" #include namespace scanner { class Consumer; } class GuessnetParser { public: static void parse(FILE* in); }; // vim:set ts=4 sw=4: #endif guessnet-0.55/src/tests/0000755000000000000000000000000011770717500012124 5ustar guessnet-0.55/src/tests/tut-main.cpp0000644000000000000000000000361311770705652014376 0ustar #include #include #include #include namespace tut { test_runner_singleton runner; } using namespace wibble; void signal_to_exception(int) { throw std::runtime_error("killing signal catched"); } int main(int argc,const char* argv[]) { tut::reporter visi; signal(SIGSEGV,signal_to_exception); signal(SIGILL,signal_to_exception); if( (argc == 2 && (! strcmp ("help", argv[1]))) || argc > 3 ) { std::cout << "TUT example test application." << std::endl; std::cout << "Usage: example [regression] | [list] | [ group] [test]" << std::endl; std::cout << " List all groups: example list" << std::endl; std::cout << " Run all tests: example regression" << std::endl; std::cout << " Run one group: example std::auto_ptr" << std::endl; std::cout << " Run one test: example std::auto_ptr 3" << std::endl;; } // std::cout << "\nFAILURE and EXCEPTION in these tests are FAKE ;)\n\n"; tut::runner.get().set_callback(&visi); try { if( argc == 1 || (argc == 2 && std::string(argv[1]) == "regression") ) { tut::runner.get().run_tests(); } else if( argc == 2 && std::string(argv[1]) == "list" ) { std::cout << "registered test groups:" << std::endl; tut::groupnames gl = tut::runner.get().list_groups(); tut::groupnames::const_iterator i = gl.begin(); tut::groupnames::const_iterator e = gl.end(); while( i != e ) { std::cout << " " << *i << std::endl; ++i; } } else if( argc == 2 && std::string(argv[1]) != "regression" ) { tut::runner.get().run_tests(argv[1]); } else if( argc == 3 ) { tut::runner.get().run_test(argv[1],::atoi(argv[2])); } } catch( const std::exception& ex ) { std::cerr << "tut raised exception: " << ex.what() << std::endl; } return 0; } guessnet-0.55/src/tests/test-utils.h0000644000000000000000000000044411770705652014421 0ustar /** * @file test-utils.h * @author Peter Rockai (mornfall) * @brief Utility functions for the unit tests */ #ifndef XGRIBARCH_TEST_UTILS_H #define XGRIBARCH_TEST_UTILS_H #include #include namespace arki { namespace tests { } } #endif guessnet-0.55/src/parser.h0000644000000000000000000000322711770705652012440 0ustar #ifndef PARSER_H #define PARSER_H /* * Common facilities used by test data parsers * * Copyright (C) 2003 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "scanner/scan.h" #include "nettypes.h" namespace wibble { namespace exception { class Parser: public Consistency { protected: std::string m_file; int m_line; public: Parser(const std::string& file, int line, const std::string& error) throw (); Parser(int line, const std::string& error) throw (); Parser(const std::string& context, const std::string& error) throw (); ~Parser() throw () {} int line() const throw () { return m_line; } const std::string& file() const throw () { return m_file; } std::string file() throw () { return m_file; } void setLocation(const std::string file, int line = -1) throw (); void setLocation(int line) throw (); virtual const char* type() const throw () { return "Parser"; } }; } } // vim:set ts=4 sw=4: #endif guessnet-0.55/src/guessnet-scan.cc0000644000000000000000000001631611770705652014064 0ustar /* * Sniff network traffic to guess network data, and print it out as * an /etc/network/interfaces configuration profile * * Copyright (C) 2003 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include #define APPNAME PACKAGE #else #warning No config.h found: using fallback values #define APPNAME __FILE__ #define VERSION "unknown" #endif #include "scanner/TrafficScanner.h" #include "Environment.h" #include "IFace.h" #include #include #include #include /* errno */ #include // memcpy #include // socket #include // socket #include // ioctl #include #include // close #include #include #include #include #include namespace wibble { namespace commandline { struct GuessnetOptions : public StandardParserWithManpage { public: BoolOption* verbose; BoolOption* debug; IntOption* timeout; IntOption* inittime; GuessnetOptions() : StandardParserWithManpage(APPNAME, VERSION, 8, "enrico@enricozini.org") { usage = "[options] [iface]"; description = "Guess the current network location"; verbose = add("verbose", 'v', "verbose", "", "enable verbose output"); debug = add("debug", 0, "debug", "", "enable debugging output (including verbose output)"); timeout = add("timeout", 't', "timeout", "seconds", "timeout (in seconds) used to wait for response packets" " (defaults to 5 seconds)"); inittime = add("inittime", 0, "init-timeout", "seconds", "time (in seconds) to wait for the interface to initialize" " when not found already up (defaults to 3 seconds)"); } }; } } using namespace std; using namespace wibble::sys; class MainScanner { protected: Mutex waitMutex; Condition waitCond; string name; // Scanning services NetSender sender; NetWatcher watcher; TrafficScanner trafficScanner; int cand_count; inline string fmt_ip(unsigned int ip) throw () { unsigned char ipfmt[4]; memcpy(ipfmt, &ip, 4); stringstream str; str << (int)ipfmt[0] << '.' << (int)ipfmt[1] << '.' << (int)ipfmt[2] << '.' << (int)ipfmt[3]; return str.str(); } inline string fmt_mac(long long int mac) throw () { unsigned char macfmt[6]; memcpy(macfmt, &mac, 6); stringstream str; str << hex << setfill('0') << setw(2) << (int)macfmt[0] << ':' << (int)macfmt[1] << ':' << (int)macfmt[2] << ':' << (int)macfmt[3] << ':' << (int)macfmt[4] << ':' << (int)macfmt[5]; return str.str(); } unsigned int netaddr_to_netmask(unsigned int na) throw () { unsigned int res = 0; na = ntohl(na); // Count the trailing zeros int i = 0; for ( ; i < 32 && (na & (1 << i)) == 0; i++) ; // Add 1s to the start of res for ( ; i < 32; i++) res |= (1 << i); return htonl(res); } public: MainScanner() : sender(Environment::get().iface()), watcher(Environment::get().iface()), trafficScanner(sender), cand_count(0) { watcher.addEthernetListener(&trafficScanner); } int candidateCount() const throw () { return cand_count; } void shutdown() { watcher.shutdown(); } void printResults() throw () { string s; cout << "iface inet static" << endl; cout << "\taddress " << endl; unsigned int network = trafficScanner.guessed_netaddr; s = fmt_ip(network); cout << "\tnetwork " << s << endl; unsigned int netmask = netaddr_to_netmask(network); s = fmt_ip(netmask); cout << "\tnetmask " << s << endl; s = fmt_ip(network | ~netmask); cout << "\tbroadcast " << s << endl; for (set::const_iterator i = trafficScanner.guessed_gateways.begin(); i != trafficScanner.guessed_gateways.end(); i++) { TrafficScanner::HostData& od = trafficScanner.scanData[*i]; s = fmt_ip(od.addr); cout << "\tgateway " << s << endl; string m = fmt_mac(*i); cout << "\ttest-peer address " << s << " mac " << m << endl; } } }; int main (int argc, const char *argv[]) { // Access the interface try { wibble::commandline::GuessnetOptions opts; // Process the commandline if (opts.parse(argc, argv)) return 0; // Set verbosity Environment::get().verbose(opts.verbose->boolValue()); Environment::get().debug(opts.debug->boolValue()); // Check user id if (geteuid() != 0) fatal_error("You must run this command as root."); // Find out the interface to be tested if (opts.hasNext()) Environment::get().iface(opts.next()); // Find out the test timeout if (opts.timeout->boolValue()) Environment::get().timeout(opts.timeout->intValue()); // Find out the init timeout if (opts.inittime->boolValue()) Environment::get().initTimeout(opts.inittime->intValue()); IFace iface(Environment::get().iface()); bool iface_was_down; if_params saved_iface_cfg; try { // Install the handler for unexpected exceptions wibble::exception::InstallUnexpected installUnexpected; //FILE* input = 0; /* Check if we have to bring up the interface; if yes, do it */ //iface_was_down = iface_init(Environment::get().iface(), op_init_time); iface.update(); iface_was_down = !iface.up(); if (iface_was_down) saved_iface_cfg = iface.initBroadcast(Environment::get().initTimeout()); // Let the signals be caught by some other process sigset_t sigs, oldsigs; sigfillset(&sigs); sigdelset(&sigs, SIGFPE); sigdelset(&sigs, SIGILL); sigdelset(&sigs, SIGSEGV); sigdelset(&sigs, SIGBUS); sigdelset(&sigs, SIGABRT); sigdelset(&sigs, SIGIOT); sigdelset(&sigs, SIGTRAP); sigdelset(&sigs, SIGSYS); // Don't block the termination signals: we need them sigdelset(&sigs, SIGTERM); sigdelset(&sigs, SIGINT); sigdelset(&sigs, SIGQUIT); pthread_sigmask(SIG_BLOCK, &sigs, &oldsigs); // Scanning methods MainScanner scanner; debug("Started test subsystems\n"); sleep(Environment::get().timeout()); scanner.printResults(); /* // Wait for the first result from the tests string profile; if (scanner.candidateCount() > 0) profile = scanner.getResult(Environment::get().timeout() * 1000); */ // Shutdown the tests scanner.shutdown(); // We've shutdown the threads: restore original signals pthread_sigmask(SIG_SETMASK, &oldsigs, &sigs); } catch (std::exception& e) { fatal_error("%s", e.what()); return 1; } /* Bring down the interface if we need it */ if (iface_was_down) iface.setConfiguration(saved_iface_cfg); } catch (std::exception& e) { fatal_error("%s", e.what()); return 1; } return 0; } // vim:set ts=4 sw=4: guessnet-0.55/src/ethtool-local.h0000644000000000000000000000171711770705652013714 0ustar #ifndef fooethtoollocalhfoo #define fooethtoollocalhfoo /* $Id$ */ /* * This file is part of ifplugd. * * ifplugd is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * ifplugd is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ifplugd; if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ typedef unsigned long long u64; typedef __uint32_t u32; typedef __uint16_t u16; typedef __uint8_t u8; #include "ethtool-kernel.h" #endif guessnet-0.55/src/nettypes.h0000644000000000000000000000752611770705652013025 0ustar #ifndef NETTYPES_H #define NETTYPES_H /* * (sub-optimal) Platform independent encapsulation of network types and * addresses * * Copyright (C) 2003 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include #endif #include /* memcpy, memcmp */ #include #include /* needed to compile on S390 * (thanks to Gerhard Tonn ) */ #include #include extern "C" { #include } /* #ifdef WORD_BIGENDIAN */ /* TODO: check if byte ordering is ok here or if we need to do the ifdef and * byte swap a little bit */ #define IPv4_COPY(target, source) memcpy(target, source, 4) #define IPv4_FROM_ARP(target, source) memcpy(target, source, 4) #define IPv4_MATCHES(addr1, addr2) (memcmp((addr1), (addr2), 4) == 0) #define MAC_COPY(target, source) memcpy(target, source, 6) #define MAC_FROM_ARP(target, source) memcpy(target, source, 6) #define MAC_MATCHES(addr1, addr2) (memcmp((addr1), (addr2), 6) == 0) /* TODO: check if these four work well on big endian machines */ inline struct ether_addr* arp_get_sha(const struct libnet_arp_hdr* hdr) throw () { // Get the address of the start of variable-length data inside the packet char* base = (char*)&(hdr->ar_op) + sizeof(hdr->ar_op); return (ether_addr*)base; } inline struct in_addr* arp_get_sip(const struct libnet_arp_hdr* hdr) throw () { // Get the address of the start of variable-length data inside the packet char* base = (char*)&(hdr->ar_op) + sizeof(hdr->ar_op); return (struct in_addr*)(base + hdr->ar_hln); } inline struct ether_addr* arp_get_tha(const struct libnet_arp_hdr* hdr) throw () { // Get the address of the start of variable-length data inside the packet char* base = (char*)&(hdr->ar_op) + sizeof(hdr->ar_op); return (ether_addr*)(base + hdr->ar_hln + hdr->ar_pln); } inline struct in_addr* arp_get_tip(const struct libnet_arp_hdr* hdr) throw () { // Get the address of the start of variable-length data inside the packet char* base = (char*)&(hdr->ar_op) + sizeof(hdr->ar_op); return (struct in_addr*)(base + hdr->ar_hln * 2 + hdr->ar_pln); } class IPAddress { protected: struct in_addr addr; public: IPAddress(const in_addr& addr) throw () : addr(addr) {} // Parse an IPV4 address from a dotted-quad string IPAddress(const std::string& str) throw (wibble::exception::Consistency); unsigned long int s_addr() const throw () { return addr.s_addr; } const in_addr_t* s_addr_p() const throw () { return &(addr.s_addr); } operator const struct in_addr*() const { return &addr; } bool operator==(const IPAddress& addr) const; bool operator!=(const IPAddress& addr) const; std::string toString() const; }; /* Format an IPv4 address in a static char buffer */ std::string fmt(const IPAddress& addr) throw (); /* Format a MAC address in a static char buffer */ std::string fmt(const struct ether_addr& addr) throw (); bool parse_ipv4(struct in_addr* target, const std::string& str) throw (); /* Parse a MAC address from its canonical string representation */ bool parse_mac(struct ether_addr* target, const std::string& str) throw (); // vim:set ts=4 sw=4: #endif guessnet-0.55/src/options.h0000644000000000000000000000440711770705652012640 0ustar #ifndef OPTIONS_H #define OPTIONS_H /* * Program options * * Copyright (C) 2003--2010 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "parser.h" namespace wibble { namespace commandline { struct GuessnetOptions; } } /** * Base stanza filter, to decide what we want and what we don't */ struct IfaceFilter { virtual ~IfaceFilter() {} virtual bool operator()(const std::string& name) const { return true; } }; class Options { protected: void init_standalone(wibble::commandline::GuessnetOptions& opts); void init_ifupdown(wibble::commandline::GuessnetOptions& opts); void parse_guessnet_config(); void parse_ifupdown_config(); public: /// Default iterface to use std::string iface; /// Default tag to print when nothing is found std::string defprof; /// Timeout after which we decide we haven't found anything int timeout; /// Time we wait after initializing an interface int init_timeout; /// Filter in/out profiles based on their names bool autofilter; /// Initial delay to set in case of race conditions int initdelay; /// Number of tries for wireless scanning int iwscan_tries; /// Configuration file std::string config_file; /** * Filter that decides which tests we select from the configuration * file */ IfaceFilter* iface_filter; /// List of tests to perform std::vector scans; Options(); ~Options(); /** * Initialise options from any source implied from command line */ void init(int argc, const char* argv[]); }; extern Options options; // vim:set ts=4 sw=4: #endif guessnet-0.55/src/runner/0000755000000000000000000000000011770717500012273 5ustar guessnet-0.55/src/runner/runner.h0000644000000000000000000000267011770705652013767 0ustar #ifndef GUESSNET_RUNNER_RUNNER_H #define GUESSNET_RUNNER_RUNNER_H /* * Run scans and arbitrate the results * * Copyright (C) 2003--2007 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "scanner/scan.h" #include "scanner/scanbag.h" namespace runner { class Runner : public ScanBagListener { protected: wibble::sys::Mutex waitMutex; wibble::sys::Condition waitCond; public: Runner(); virtual ~Runner() {} /// Handle notification that the remaining candidate list changed virtual void candidatesChanged(); /// Wait for an answer from the tests for no more than `timeout' milliseconds std::string getResult(int timeout); }; } // vim:set ts=4 sw=4: #endif guessnet-0.55/src/runner/main.cc0000644000000000000000000000213511770705652013534 0ustar /* * Run scans and arbitrate the results * * Copyright (C) 2003--2007 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "runner/main.h" #include "util/starter.h" using namespace std; using namespace scanner; using namespace wibble::sys; namespace runner { void Main::shutdown() { util::Starter::get().stop(); } void Main::startScans() { util::Starter::get().start(); } } // vim:set ts=4 sw=4: guessnet-0.55/src/runner/runner.cc0000644000000000000000000000413311770705652014121 0ustar /* * Run scans and arbitrate the results * * Copyright (C) 2003--2007 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "runner/runner.h" #include #include using namespace std; using namespace scanner; using namespace wibble::sys; namespace runner { Runner::Runner() { ScanBag::get().setListener(this); } void Runner::candidatesChanged() { MutexLock lock(waitMutex); vector candidates = ScanBag::get().getRemaining(); if (candidates.size() == 1) waitCond.broadcast(); } /// Wait for an answer from the tests for no more than `timeout' milliseconds string Runner::getResult(int timeout) { struct timeval before; gettimeofday(&before, 0); struct timespec abstime; abstime.tv_sec = before.tv_sec; abstime.tv_nsec = before.tv_usec * 1000; abstime.tv_sec += timeout / 1000; abstime.tv_nsec += (timeout % 1000) * 1000000; if (abstime.tv_nsec > 1000000000) { abstime.tv_sec++; abstime.tv_nsec -= 1000000000; } MutexLock lock(waitMutex); // Try once before waiting, in case we have something already string final = ScanBag::get().getFinal(); if (final.empty()) { // Nothing yet, let's wait for something waitCond.wait(lock, abstime); // If we still don't have a winner, then we timed out and we use the // default final = ScanBag::get().getFinal(); if (final.empty()) final = ScanBag::get().getDefault(); } return final; } } // vim:set ts=4 sw=4: guessnet-0.55/src/runner/fake.h0000644000000000000000000000273311770705652013364 0ustar #ifndef GUESSNET_RUNNER_FAKE_H #define GUESSNET_RUNNER_FAKE_H /* * Run scans and arbitrate the results * * Copyright (C) 2003--2007 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "runner/runner.h" namespace runner { /** * Fake runner: ask the user if tests should pass instead of running them */ class Fake : public Runner, wibble::sys::Thread { protected: bool _canceled; virtual void* main() { interact(); return 0; } public: Fake() : _canceled(false) {} ~Fake() {} bool canceled() const { return _canceled; } bool canceled(bool val) { return _canceled = val; } void shutdown() { canceled(true); } void startScans(); void interact(); }; } // vim:set ts=4 sw=4: #endif guessnet-0.55/src/runner/fake.cc0000644000000000000000000000575611770705652013532 0ustar /* * Run scans and arbitrate the results * * Copyright (C) 2003--2007 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "runner/fake.h" #include #include using namespace std; using namespace scanner; using namespace wibble::sys; namespace runner { void Fake::startScans() { printf("Scans contents:\n"); ScanBag::get().dump(); /* for (list::const_iterator i = scanbag.getScans().begin(); i != scanbag.getScans().end(); i++) { const Scan* scan = *i; if (const PeerScan* s = dynamic_cast(scan)) { debug("Will check network %s for IP address %s (MAC %s)\n", s->name().c_str(), fmt(s->ip()).c_str(), fmt(s->mac()).c_str()); cand_count++; } else if (const LinkBeatScan* s = dynamic_cast(scan)) { //warning("Link-beat detection currently disabled\n"); debug("Will test for link beat. If absent, will return %s\n", s->name().c_str()); cand_count++; } else if (const ScriptScan* s = dynamic_cast(scan)) { debug("Will use command '%s' to test %s\n", s->cmdline().c_str(), s->name().c_str()); cand_count++; } if (const DHCPScan* s = dynamic_cast(scan)) { debug("Will check network %s for DHCP service\n", s->name().c_str()); cand_count++; } else if (const DefaultScan* s = dynamic_cast(scan)) { debug("Default test is %s\n", s->name().c_str()); cand_count++; } else //printf("Unknown test %p\n", scan); printf("Unknown test %s: %s\n", scan->name().c_str(), scan->signature().c_str()); } */ start(); } void Fake::interact() { FILE* in = fopen("/dev/tty", "rt"); // To be run in a separate thread while (!_canceled) { int num = 1; const list& cands = ScanBag::get().getScans(); for (list::const_iterator i = cands.begin(); i != cands.end(); i++) cout << num++ << ": " << (*i)->name() << " (" << (*i)->signature() << ")" << endl; cout << " 0: quit" << endl; cout << "> "; unsigned int res; fscanf(in, "%d", &res); if (res == 0) canceled(true); res--; if (res > 0 && res < cands.size()) { list::const_iterator i = cands.begin(); for (unsigned int j = 0; j < res; j++) i++; (*i)->success(); } } fclose(in); } } // vim:set ts=4 sw=4: guessnet-0.55/src/runner/main.h0000644000000000000000000000224711770705652013402 0ustar #ifndef GUESSNET_RUNNER_MAIN_H #define GUESSNET_RUNNER_MAIN_H /* * Run scans and arbitrate the results * * Copyright (C) 2003--2007 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "runner/runner.h" class IFace; namespace runner { class Main : public Runner { protected: // Scanning services IFace& iface; public: Main(IFace& iface) : Runner(), iface(iface) {} void startScans(); void shutdown(); }; } // vim:set ts=4 sw=4: #endif guessnet-0.55/src/GuessnetParser.cc0000644000000000000000000002123111770705652014247 0ustar /* * Parser for standard guessnet configuration file * * Copyright (C) 2003--2010 Enrico Zini * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "GuessnetParser.h" #include "scanner/scanbag.h" #include "scanner/dhcp.h" #include "scanner/peer.h" #include "scanner/iwscan.h" #include "scanner/script.h" #include "scanner/linkbeat.h" #include "util/output.h" #include "options.h" #include #include #include using namespace std; using namespace scanner; /* Parse the input from `input' * To make it simple, use regexps on input lines instead of implementing a real * parser. */ void GuessnetParser::parse(FILE* input) { #define MACPATTERN "[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}" #define IPPATTERN "[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+" wibble::ERegexp null_line("^[[:blank:]]*(#.*)?$"); wibble::ERegexp peer_line( "^[[:blank:]]*" "([^[:blank:]]+)[[:blank:]]+" "peer[[:blank:]]+" "(" IPPATTERN ")" "([[:blank:]]+(" MACPATTERN "))?" "([[:blank:]]+(" IPPATTERN "))?" "[[:blank:]]*$", 7); wibble::ERegexp cable_line( "^[[:blank:]]*" "([^[:blank:]]+)[[:blank:]]+" "missing-cable[[:blank:]]*$", 2); wibble::ERegexp script_line( "^[[:blank:]]*" "([^[:blank:]]+)[[:blank:]]+" "(script|command)[[:blank:]]+(.+)$", 4); wibble::ERegexp dhcp_line( "^[[:blank:]]*" "([^[:blank:]]+)[[:blank:]]+" "dhcp[[:blank:]]*$", 2); wibble::ERegexp pppoe_line( "^[[:blank:]]*" "([^[:blank:]]+)[[:blank:]]+" "pppoe[[:blank:]]*$", 2); wibble::ERegexp wireless_line( "^[[:blank:]]*" "([^[:blank:]]+)[[:blank:]]+" "wireless[[:blank:]]+" "(.+)?", 3); #if 0 wibble::ERegexp wireless_mac_essid_line( "^[[:blank:]]*" "([^[:blank:]]+)[[:blank:]]+" "wireless[[:blank:]]+mac[[:blank:]]+([^[:blank:]]+)[[:blank:]]+essid[[:blank:]](.+)$", 4); wibble::ERegexp wireless_mac_line( "^[[:blank:]]*" "([^[:blank:]]+)[[:blank:]]+" "wireless[[:blank:]]+mac[[:blank:]]+([^[:blank:]]+)[[:blank:]]*$", 3); wibble::ERegexp wireless_essid_line( "^[[:blank:]]*" "([^[:blank:]]+)[[:blank:]]+" "wireless[[:blank:]]+essid[[:blank:]](.+)$", 3); #endif wibble::ERegexp old_input_line( "^[[:blank:]]*(" IPPATTERN ")[[:blank:]]+" "(" MACPATTERN ")" "[[:blank:]]+(" IPPATTERN ")[[:blank:]]+([[:alnum:]_+-]+)" "[[:blank:]]*$", 4); string line; int linenum = 1; int found = 0; int c; while ((c = fgetc(input)) != EOF) { if (c != '\n') line += c; else { if (null_line.match(line)) { //fprintf(stderr, "EMPTY\n"); } else if (old_input_line.match(line)) { string src = old_input_line[1]; string mac = old_input_line[2]; string ip = old_input_line[3]; string name = old_input_line[4]; struct ether_addr macAddr; parse_mac(&macAddr, mac); debug("parse old input line %s %s %s %s", src.c_str(), mac.c_str(), ip.c_str(), name.c_str()); IPAddress ipAddr(ip); ScanBag::get().add(scanner::Peer::createScan(name, macAddr, ipAddr, src)); found++; } else if (peer_line.match(line)) { //fprintf(stderr, "0, %.*s\n", PFSTR(peer_line[0])); string name = peer_line[1]; string ip = peer_line[2]; string mac = peer_line[4]; string src = peer_line[6]; debug("parse peer line %s %s %s %s", name.c_str(), ip.c_str(), mac.c_str(), src.c_str()); IPAddress ipAddr(ip); struct ether_addr macAddr; if (mac.empty()) bzero(&macAddr, sizeof(struct ether_addr)); else parse_mac(&macAddr, mac); if (src.empty()) ScanBag::get().add(scanner::Peer::createScan(name, macAddr, ipAddr)); else ScanBag::get().add(scanner::Peer::createScan(name, macAddr, ipAddr, IPAddress(src))); found++; } else if (wireless_line.match(line)) { debug("parse wireless line"); //fprintf(stderr, "0, %.*s\n", PFSTR(peer_line[0])); string name = wireless_line[1]; wibble::Splitter tokens("[[:blank:]]\\+", 0); // split in a map of key->val map args; string key; for (wibble::Splitter::const_iterator i = tokens.begin(wireless_line[2]); i != tokens.end(); ++i) if (key.empty()) { if (*i == "open") args["open"] = "true"; else if (*i == "closed") args["open"] = "false"; else key = *i; } else { args.insert(make_pair(key, *i)); key.clear(); } if (!key.empty()) warning("Ignoring extra argument \"%s\" at the end of line %d\n", key.c_str(), linenum); map::const_iterator essid = args.find("essid"); map::const_iterator mac = args.find("mac"); map::const_iterator open = args.find("open"); auto_ptr s(new scanner::WirelessScan(name)); if (essid == args.end() && mac == args.end() && open == args.end()) { warning("Missing ESSID or MAC address or open/closed at line %d: skipping line\n", linenum); } else { if (essid != args.end()) s->setESSID(essid->second); if (mac != args.end()) { struct ether_addr macAddr; parse_mac(&macAddr, mac->second); s->setMAC(macAddr); } if (open != args.end()) { if (open->second == "true") s->setOpen(true); else if (open->second == "false") s->setOpen(false); else warning("Internal logic error: args[\"open\"] has been set to \"%s\" for line %d\n", open->second.c_str(), linenum); } s->finaliseInit(); ScanBag::get().add(s.release()); found++; } } else if (cable_line.match(line)) { string name = cable_line[1]; debug("parse cable line %s", name.c_str()); //fprintf(stderr, "TEST: %.*s\n", PFSTR(cmd)); //debug("Will use script %.*s to test %.*s\n", // PFSTR(cmd), PFSTR(name)); ScanBag::get().add(scanner::LinkBeat::createScan(name)); found++; } else if (script_line.match(line)) { string name = script_line[1]; string cmd = script_line[3]; debug("parse script line %s %s", name.c_str(), cmd.c_str()); //fprintf(stderr, "TEST: %.*s\n", PFSTR(cmd)); //debug("Will use script %.*s to test %.*s\n", // PFSTR(cmd), PFSTR(name)); ScanBag::get().add(scanner::Script::createScan(name, cmd)); found++; } else if (dhcp_line.match(line)) { string name = dhcp_line[1]; debug("parse dhcp line %s", name.c_str()); //fprintf(stderr, "TEST: %.*s\n", PFSTR(cmd)); //debug("Will use script %.*s to test %.*s\n", // PFSTR(cmd), PFSTR(name)); ScanBag::get().add(scanner::DHCP::createScan(name)); found++; } else if (pppoe_line.match(line)) { string name = script_line[1]; debug("parse pppoe line %s", name.c_str()); //fprintf(stderr, "TEST: %.*s\n", PFSTR(cmd)); //debug("Will use script %.*s to test %.*s\n", // PFSTR(cmd), PFSTR(name)); ScanBag::get().add(scanner::Script::createScan(name, string("pppoe -I ") + options.iface + " -A >/dev/null 2>&1")); found++; } #if 0 else if (wireless_mac_essid_line.match(line)) { string name = wireless_mac_essid_line[1]; ScanBag::get().add(scanner::Script::createScan(name, string(SCRIPTDIR "/test-wireless ") + Environment::get().iface() + " mac " + wireless_mac_essid_line[2] + " essid \"" + wireless_mac_essid_line[3] + "\"")); found++; } else if (wireless_mac_line.match(line)) { string name = wireless_mac_line[1]; ScanBag::get().add(scanner::Script::createScan(name, string(SCRIPTDIR "/test-wireless ") + Environment::get().iface() + " mac " + wireless_mac_line[2])); found++; } else if (wireless_essid_line.match(line)) { string name = wireless_essid_line[1]; ScanBag::get().add(scanner::Script::createScan(name, string(SCRIPTDIR "/test-wireless ") + Environment::get().iface() + " essid \"" + wireless_essid_line[2] + "\"" )); found++; } #endif else { warning("Parse error at line %d: line ignored\n", linenum); } line = string(); linenum++; } } debug("%d candidates found in input\n", found); } // vim:set ts=4 sw=4: guessnet-0.55/src/IfaceParser.cc0000644000000000000000000003600711770705652013470 0ustar /* * /etc/network/interfaces parser * * Copyright (C) 2003--2010 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include #define APPNAME PACKAGE #else #warning No config.h found: using fallback values #define APPNAME __FILE__ #define VERSION "unknown" #endif #include "IfaceParser.h" #include #include "util/output.h" #include "scanner/scanbag.h" #include "scanner/peer.h" #include "scanner/iwscan.h" #include "scanner/script.h" #include "scanner/dhcp.h" #include "scanner/linkbeat.h" #include "options.h" #include #include #include using namespace std; using namespace scanner; class Tokenizer { protected: std::string str; std::string::size_type s; public: Tokenizer(const std::string& str) throw () : str(str), s(0) {} std::string next() { // Skip leading spaces while (s < str.size() && isspace(str[s])) s++; if (s == str.size()) return string(); string::size_type start = s; while (s < str.size() && !isspace(str[s])) s++; return str.substr(start, s - start); } }; struct IfupdownFilter : public IfaceFilter { set ifupdownProfiles; bool ifupdownProfilesMatchInverted; IfupdownFilter() : ifupdownProfilesMatchInverted(false) { } virtual ~IfupdownFilter() {} virtual bool operator()(const std::string& name) const { bool hasmatch = false; if (options.autofilter) hasmatch = (name.substr(0, options.iface.size()+1) == options.iface+"-") ; else hasmatch = ifupdownProfilesMatchInverted || (ifupdownProfiles.size() == 0); if (ifupdownProfilesMatchInverted && ifupdownProfiles.find(name) != ifupdownProfiles.end()) { hasmatch = false; } else if (!ifupdownProfilesMatchInverted && ifupdownProfiles.find(name) != ifupdownProfiles.end()) { hasmatch = true; } return hasmatch; } }; void IfaceParser::parseMapping(FILE* in) { auto_ptr filter(new IfupdownFilter); ::debug("program name is guessnet-ifupdown: enabling ifupdown mode\n"); // Read stuff from stdin wibble::ERegexp null_line("^[[:blank:]]*(#.*)?$"); wibble::ERegexp parm_line("^[[:blank:]]*([A-Za-z_-]+):[[:blank:]]*(.+)$", 3); string line; int linenum = 1; int c; while ((c = fgetc(in)) != EOF) { if (c != '\n') line += c; else { if (null_line.match(line)) { //fprintf(stderr, "EMPTY\n"); } else if (parm_line.match(line)) { string name = parm_line[1]; Tokenizer t(parm_line[2]); string val = t.next(); if (name == "default") { if (!val.empty()) options.defprof = val; } else if (name == "verbose") { if (!val.empty()) util::Output::get().verbose(val == "true"); } else if (name == "debug") { if (!val.empty()) util::Output::get().debug(val == "true"); } else if (name == "syslog") { if (!val.empty()) util::Output::get().syslog(val == "true"); } else if (name == "timeout") { int v = atoi(val.c_str()); if (v > 0) options.timeout = v; } else if (name == "init-time") { int v = atoi(val.c_str()); if (v > 0) options.init_timeout = v; } else if (name == "autofilter") { options.autofilter = val == "true"; } else if (name == "init-delay") { int v = atoi(val.c_str()); if (v > 0) options.initdelay = v; } else if (name == "iwscan-tries") { int v = atoi(val.c_str()); if (v > 0) options.iwscan_tries = v; } } else { Tokenizer t(line); bool first = true; for (string w = t.next(); !w.empty(); w = t.next()) { if (first) { filter->ifupdownProfilesMatchInverted = w[0] == '!'; first = false; } if (w[0] == '!') { if (!filter->ifupdownProfilesMatchInverted) throw wibble::exception::Consistency( "parsing list of interfaces to use", "found negated interface "+w+" after a normal interface"); filter->ifupdownProfiles.insert(w.substr(1)); std::string dm = "Added " + w + "\n"; ::debug(dm.c_str()); } else { if (filter->ifupdownProfilesMatchInverted) throw wibble::exception::Consistency( "parsing list of interfaces to use", "found normal interface "+w+" after negated interface"); filter->ifupdownProfiles.insert(w); std::string dm = "Added " + w + "\n"; ::debug(dm.c_str()); } } } line = string(); linenum++; } } options.iface_filter = filter.release(); } /* Parse the input from `input' * To make it simple, use regexps on input lines instead of implementing a real * parser. */ void IfaceParser::parse(FILE* input, const IfaceFilter& filter) { #define ATLINESTART "^[[:blank:]]*(guessnet[0-9]*[[:blank:]]+)?test[0-9]*(-|[[:blank:]]+)" #define MACPATTERN "[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}" wibble::ERegexp null_line("^[[:blank:]]*(#.*)?$"); wibble::ERegexp iface_line( "^[[:blank:]]*iface[[:blank:]]+" "([^[:blank:]]+)[[:blank:]]+" "([^[:blank:]]+)[[:blank:]]+" "([^[:blank:]]+)[[:blank:]]*$", 4); wibble::ERegexp source_line( "^[[:blank:]]*source[[:blank:]]+(.+)$", 2); wibble::ERegexp peer_line( ATLINESTART "peer[[:blank:]]+(.+)$", 4); wibble::ERegexp cable_line( ATLINESTART "missing-cable[[:blank:]]*([[:blank:]]+.+)?$"); wibble::ERegexp script_line( ATLINESTART "(script|command)[[:blank:]]+(.+)$", 5); wibble::ERegexp dhcp_line( ATLINESTART "dhcp[[:blank:]]*([[:blank:]]+.+)?$"); wibble::ERegexp pppoe_line( ATLINESTART "pppoe[[:blank:]]*([[:blank:]]+.+)?$"); wibble::ERegexp wireless_line( ATLINESTART "wireless[[:blank:]]+(.+)$", 4); #if 0 wibble::ERegexp wireless_mac_essid_line( ATLINESTART "wireless[[:blank:]]+mac[[:blank:]]+([^[:blank:]]+)[[:blank:]]+essid[[:blank:]](.+)$", 5); wibble::ERegexp wireless_mac_line( ATLINESTART "wireless[[:blank:]]+mac[[:blank:]]+([^[:blank:]]+)[[:blank:]]*$", 4); wibble::ERegexp wireless_essid_line( ATLINESTART "wireless[[:blank:]]+essid[[:blank:]](.+)$", 4); #endif wibble::ERegexp old_default_line( "^[[:blank:]]*guessnet[[:blank:]]+" "default[[:blank:]]*$"); wibble::ERegexp generic_guessnet_line(ATLINESTART); wibble::ERegexp parm_line( "^[[:blank:]]*([^[:blank:]]+)[[:blank:]]+(.+)$", 2); string profileName; string line; int linenum = 1; int found = 0; int c; while ((c = fgetc(input)) != EOF) { if (c != '\n') line += c; else { if (null_line.match(line)) { //fprintf(stderr, "EMPTY\n"); } else if (iface_line.match(line)) { //string name(line, parts[1].rm_so, parts[1].rm_eo - parts[1].rm_so); //string net(line, parts[2].rm_so, parts[2].rm_eo - parts[2].rm_so); //string type(line, parts[3].rm_so, parts[3].rm_eo - parts[3].rm_so); //fprintf(stderr, "IFACE: %.*s/%.*s/%.*s\n", PFSTR(name), PFSTR(net), PFSTR(type)); if (filter(iface_line[1])) profileName = iface_line[1]; else profileName.clear(); } else if (source_line.match(line)) { /* process ifupdown's source directive, expand globs */ wordexp_t p; char ** w; size_t i; const char * rest = source_line[1].c_str(); int fail = wordexp(rest, &p, WRDE_NOCMD); if (!fail) { w = p.we_wordv; for (i = 0; i < p.we_wordc; i++) { FILE * f = fopen(w[i], "r"); if (f) { IfaceParser::parse(f, filter); fclose(f); } } wordfree(&p); } } else if (peer_line.match(line)) { //string ip(line, parts[1].rm_so, parts[1].rm_eo - parts[1].rm_so); //string mac(line, parts[2].rm_so, parts[2].rm_eo - parts[2].rm_so); //fprintf(stderr, "PEER: %.*s/%.*s\n", PFSTR(ip), PFSTR(mac)); if (profileName.size()) { string argstr = peer_line[3]; // split in a map of key->val map args; string key; string val; enum { SKEY, KEY, SVAL, VAL } state = KEY; for (string::const_iterator s = argstr.begin(); s != argstr.end(); s++) { //debug("Read `%c', state: %d\n", *s, (int)state); if (isspace(*s)) switch (state) { case SKEY: break; case KEY: state = SVAL; break; case SVAL: break; case VAL: state = SKEY; //debug("Found args: %.*s: %.*s\n", PFSTR(key), PFSTR(val)); args.insert(make_pair(key, val)); key = string(); val = string(); break; } else switch (state) { case SKEY: key += *s; state = KEY; break; case KEY: key += *s; break; case SVAL: val += *s; state = VAL; break; case VAL: val += *s; break; } } if (key.size() > 0 && val.size() > 0) args.insert(make_pair(key, val)); map::const_iterator ip = args.find("address"); map::const_iterator mac = args.find("mac"); map::const_iterator src = args.find("source"); auto_ptr s(new scanner::PeerScan(profileName)); if (ip == args.end() && mac == args.end()) { warning("Missing IP or MAC address at line %d: skipping line\n", linenum); } else { if (ip != args.end()) s->setIP(IPAddress(ip->second)); if (mac != args.end()) { struct ether_addr macAddr; parse_mac(&macAddr, mac->second); s->setMAC(macAddr); } else warning("No mac provided at line %d: scans will be less accurate\n", linenum); if (src != args.end()) s->setSource(IPAddress(src->second)); if (ip == args.end() && mac != args.end() && src == args.end()) warning("Mac-only peer test is likely to fail unless you provide a source IP address"); s->finaliseInit(); ScanBag::get().add(s.release()); found++; } } } else if (cable_line.match(line)) { if (profileName.size()) { ScanBag::get().add(scanner::LinkBeat::createScan(profileName)); found++; } } else if (script_line.match(line)) { if (profileName.size()) { ScanBag::get().add(scanner::Script::createScan(profileName, script_line[4])); found++; } } else if (dhcp_line.match(line)) { if (profileName.size()) { ScanBag::get().add(scanner::DHCP::createScan(profileName)); found++; } } else if (pppoe_line.match(line)) { if (profileName.size()) { ScanBag::get().add(scanner::Script::createScan(profileName, string("pppoe -I ") + options.iface + " -A >/dev/null 2>&1")); found++; } } else if (wireless_line.match(line)) { if (profileName.size()) { string str = wireless_line[3]; wibble::Tokenizer tokens(str, "[^\" \t][^ \t]+|\"[^\"]+\"", REG_EXTENDED); // split in a map of key->val map args; string key; for (wibble::Tokenizer::const_iterator i = tokens.begin(); i != tokens.end(); ++i) { // Remove quotes from around values, if present string token = *i; if (token.size() > 2 && token[0] == '"') token = token.substr(1, token.size() - 2); if (key.empty()) { if (token == "open") args["open"] = "true"; else if (token == "closed") args["open"] = "false"; else key = token; } else { args.insert(make_pair(key, token)); key.clear(); } } if (!key.empty()) warning("Ignoring extra argument \"%s\" at the end of line %d\n", key.c_str(), linenum); map::const_iterator essid = args.find("essid"); map::const_iterator mac = args.find("mac"); map::const_iterator open = args.find("open"); auto_ptr s(new scanner::WirelessScan(profileName)); if (essid == args.end() && mac == args.end() && open == args.end()) { warning("Missing ESSID or MAC address or open/closed at line %d: skipping line\n", linenum); } else { if (essid != args.end()) s->setESSID(essid->second); if (mac != args.end()) { struct ether_addr macAddr; parse_mac(&macAddr, mac->second); s->setMAC(macAddr); } if (open != args.end()) { if (open->second == "true") s->setOpen(true); else if (open->second == "false") s->setOpen(false); else warning("Internal logic error: args[\"open\"] has been set to \"%s\" for line %d\n", open->second.c_str(), linenum); } s->finaliseInit(); ScanBag::get().add(s.release()); found++; } } } #if 0 else if (wireless_mac_essid_line.match(line)) { if (profileName.size()) { ScanBag::get().add(scanner::Script::createScan(profileName, string(SCRIPTDIR "/test-wireless ") + Environment::get().iface() + " mac " + wireless_mac_essid_line[3] + " essid \"" + wireless_mac_essid_line[4] + "\"" )); found++; } } else if (wireless_mac_line.match(line)) { if (profileName.size()) { ScanBag::get().add(scanner::Script::createScan(profileName, string(SCRIPTDIR "/test-wireless ") + Environment::get().iface() + " mac " + wireless_mac_line[3] )); found++; } } else if (wireless_essid_line.match(line)) { if (profileName.size()) { ScanBag::get().add(scanner::Script::createScan(profileName, string(SCRIPTDIR "/test-wireless ") + Environment::get().iface() + " essid \"" + wireless_essid_line[3] + "\"" )); found++; } } #endif else if (old_default_line.match(line)) { warning("line %d: Use of \"guessnet default\" lines is obsolete and will be discontinued in the future. Use \"map default: profile\" in the \"mapping\" section instead.\n", linenum); //fprintf(stderr, "DEFAULT\n"); if (profileName.size()) { //debug("Will use tag %.*s as default\n", PFSTR(profileName)); options.defprof = profileName; } } else if (generic_guessnet_line.match(line)) { warning("Parse error at line %d: line ignored\n", linenum); } else if (parm_line.match(line)) { //string name(line, parts[1].rm_so, parts[1].rm_eo - parts[1].rm_so); //string parms(line, parts[2].rm_so, parts[2].rm_eo - parts[2].rm_so); //fprintf(stderr, "PARM: %.*s/%.*s\n", PFSTR(name), PFSTR(parms)); } else { warning("Parse error at line %d: line ignored\n", linenum); } line = string(); linenum++; } } debug("%d candidates found in input\n", found); } // vim:set ts=4 sw=4: guessnet-0.55/src/runtest0000755000000000000000000000212011770705652012414 0ustar #!/bin/sh -e TOP_SRCDIR=`pwd`/`dirname $0`/.. CMD=`pwd`/"$1" ## Set up the test environment #export ARKI_SCAN_GRIB1=$TOP_SRCDIR/conf/scan-grib1/ #export ARKI_SCAN_GRIB2=$TOP_SRCDIR/conf/scan-grib2/ TESTDIR="`mktemp -d`" cd "$TESTDIR" #mkdir inbound ## Put data in test inbound area #cp -a "$TOP_SRCDIR/test/data/"* inbound/ ## Create test dataset directories #mkdir test200 #mkdir test80 #mkdir error ##cp "$TOP_SRCDIR/ept/tests/testdata/"* . ##mv vocabulary test.voc ##mv package-tags test.tag ##mkdir empty ## Clean up the test environment at exit unless asked otherwise cleanup() { test -z "$PRESERVE" && rm -r "$TESTDIR" } trap cleanup EXIT ## Run the tests #id=`date +%y%m%d%H%M%S` #$DEBUGGER $BIN $ARGS 2>&1 | tee `pwd`/testrun-$id #echo Output saved in `pwd`/testrun-$id # Try to debug the libtool executable, if present DIR=`dirname $CMD` BASE=`basename $CMD` if [ ! -z "$DEBUGGER" ] && [ -x $DIR/.libs/lt-$BASE ] then echo "Running $DEBUGGER $DIR/.libs/lt-$BASE $ARGS" $DEBUGGER $DIR/.libs/lt-$BASE $ARGS else echo "Running $DEBUGGER $CMD $ARGS" $DEBUGGER $CMD $ARGS fi exit $? guessnet-0.55/src/scanner/0000755000000000000000000000000011770717500012413 5ustar guessnet-0.55/src/scanner/dhcp.h0000644000000000000000000000226111770705652013510 0ustar #ifndef GUESSNET_SCANNER_DHCP_H #define GUESSNET_SCANNER_DHCP_H /* * Scan for the existance of a DHCP server * * Copyright (C) 2004--2007 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #if 0 #include #include "Scanner.h" #include "NetWatcher.h" #include "NetSender.h" #include "nettypes.h" #include #endif namespace scanner { struct Scan; struct DHCP { static Scan* createScan(const std::string& name); }; } // vim:set ts=4 sw=4: #endif guessnet-0.55/src/scanner/linkbeat.cc0000644000000000000000000000421111770705652014516 0ustar /* * Test for link beat * * Copyright (C) 2003--2010 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "scanner/linkbeat.h" #include "scanner/scan.h" #include "util/output.h" #include "util/starter.h" #include "IFace.h" #include "options.h" #include using namespace std; namespace scanner { /* * Link beat test * * Succeeds if no link beat reported */ struct LinkBeatScan : public Scan, public util::Startable { static IFace* iface; LinkBeatScan(const std::string& name) : Scan(name) {} virtual ~LinkBeatScan() {} void startableStart() { //warning("Link-beat detection currently disabled\n"); debug("Will test for link beat. If absent, will return %s\n", name().c_str()); iface->update(); if (!iface->has_mii()) warning("Link beat test requested on an interface without link beat detection support: assuming we are always connected\n"); else if (!iface->connected()) { verbose("Link beat not detected\n"); success(); } } void startableStop() {} virtual std::string signature() const { return "linkbeat"; } }; IFace* LinkBeatScan::iface = 0; void LinkBeat::configure(IFace* iface) { LinkBeatScan::iface = iface; } Scan* LinkBeat::createScan(const std::string& name) { auto_ptr res(new LinkBeatScan(name)); verbose("adding candidate script LinkBeat with tag [%s]\n", res->signature().c_str()); util::Starter::get().add(res.get(), 10); return res.release(); } } // vim:set ts=4 sw=4: guessnet-0.55/src/scanner/iwscan.cc0000644000000000000000000001417011770705652014216 0ustar /* * Perform a wireless interface scan * * Copyright (C) 2007--2010 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "scanner/iwscan.h" #include "util/output.h" #include "options.h" #include // ntohs, htons, ... //extern "C" { #include //} using namespace std; using namespace wibble::sys; namespace scanner { WirelessScan::WirelessScan(const std::string& name) : Scan(name), _hasOpen(false) { bzero(&_mac, sizeof(struct ether_addr)); } bool WirelessScan::hasMAC() const { struct ether_addr zeromac; bzero(&zeromac, sizeof(struct ether_addr)); return !MAC_MATCHES(&_mac, &zeromac); } string WirelessScan::signature() const { string res = "wireless"; if (hasESSID()) { res += " essid "; res += essid(); } if (hasMAC()) { res += " mac "; res += fmt(mac()); } if (hasOpen()) { res += " "; res += (open() ? "open" : "closed"); } return res; } void WirelessScan::finaliseInit() { // Register with the NetWatcher IWScan::get().addCandidate(this); } bool WirelessScan::matches(const wireless_scan& data) { debug("Testing %s\n", signature().c_str()); if (hasESSID()) { if (!data.b.has_essid) { debug("Testing %s/essid: fail as scan did not report essid\n", signature().c_str()); return false; } if (_essid != data.b.essid) { debug("Testing %s/essid: fail as essid \"%s\" is not \"%s\"\n", signature().c_str(), data.b.essid, _essid.c_str()); return false; } debug("Testing %s: essid passed\n", signature().c_str()); } if (hasMAC()) { if (!data.has_ap_addr) { debug("Testing %s/mac: fail as scan did not report ap mac\n", signature().c_str()); return false; } if (data.ap_addr.sa_family != ARPHRD_ETHER) { debug("Testing %s/mac: fail reported ap mac seems to be an unknown address format (%d instead of %d, see AF_* macros in sys/socket.h)\n", signature().c_str(), data.ap_addr.sa_family, ARPHRD_ETHER); return false; } if (!MAC_MATCHES(&_mac, data.ap_addr.sa_data)) { debug("Testing %s/mac: fail as the two addresses are different (%s != %s)\n", signature().c_str(), fmt(_mac).c_str(), fmt(*(struct ether_addr*)data.ap_addr.sa_data).c_str()); return false; } debug("Testing %s: mac passed\n", signature().c_str()); } if (hasOpen()) { bool isOpen = data.b.key_flags & IW_ENCODE_DISABLED; debug("Testing %s: network %s isOpen is %d, flags %x\n", signature().c_str(), data.b.essid, isOpen, data.b.key_flags); if (open() && !isOpen) { debug("Testing %s/open: failed because network is closed\n", signature().c_str()); return false; } if (!open() && isOpen) { debug("Testing %s/closed: failed because network is open\n", signature().c_str()); return false; } debug("Testing %s: %s network passed\n", signature().c_str(), open() ? "open" : "closed"); } debug("Testing %s: match successful\n", signature().c_str()); return true; } static IWScan* instance = 0; static bool requested = false; void IWScan::configure(const std::string& iface) { if (instance) { delete instance; instance = 0; } instance = new IWScan(iface); } IWScan& IWScan::get() { if (!requested) { // Don't start unless something needs it util::Starter::get().add(instance, 10); requested = true; } return *instance; } IWScan::IWScan(const std::string& iface) : iface(iface) { } IWScan::~IWScan() { } static void free_scan(wireless_scan* scan) { if (scan) { free_scan(scan->next); free(scan); } } void* IWScan::main() { // Let the signals be caught by some other process sigset_t sigs, oldsigs; sigfillset(&sigs); sigdelset(&sigs, SIGFPE); sigdelset(&sigs, SIGILL); sigdelset(&sigs, SIGSEGV); sigdelset(&sigs, SIGBUS); sigdelset(&sigs, SIGABRT); sigdelset(&sigs, SIGIOT); sigdelset(&sigs, SIGTRAP); sigdelset(&sigs, SIGSYS); pthread_sigmask(SIG_SETMASK, &sigs, &oldsigs); try { // Apre il socket per parlare con il supporto di rete del kernel int skfd = iw_sockets_open(); if (skfd < 0) throw wibble::exception::System("opening a socket"); // Questo serve a iw_scan e iw_scan lo vuole passato perché non vuole // ricalcolarselo ogni volta int we_version = iw_get_kernel_we_version(); debug("Starting wireless scan\n"); // Fa lo scan, bloccante //(iw_process_scan è la non blocking) wireless_scan_head scan_context; int triesleft = options.iwscan_tries; int timeout = options.timeout; int ret; while ((ret = iw_scan(skfd, (char*)iface.c_str(), we_version, &scan_context)) < 0 && --triesleft > 0) { debug("scan failed, retrying\n"); sleep(timeout); } if (ret < 0) throw wibble::exception::System("running the scan"); if (util::Output::get().debug()) for (wireless_scan* i = scan_context.result; i != 0; i = i->next) debug("Found network %s\n", i->b.essid); vector matched; for (list::iterator j = candidates.begin(); j != candidates.end(); ++j) for (wireless_scan* i = scan_context.result; i != 0; i = i->next) if ((*j)->matches(*i)) { // Signal success on the first of the matching stanzas debug("%s matched network %s\n", (*j)->signature().c_str(), i->b.essid); (*j)->success(); goto outer_break; } outer_break: // Deallocate the result list free_scan(scan_context.result); debug("End of wireless scan\n"); } catch (std::exception& e) { error("%s. Quitting IWScan thread.\n", e.what()); } return 0; } void IWScan::addCandidate(WirelessScan* scan) { candidates.push_back(scan); } } // vim:set ts=4 sw=4: guessnet-0.55/src/scanner/TrafficScanner.h0000644000000000000000000000327011770705652015463 0ustar #ifndef TRAFFIC_SCANNER_H #define TRAFFIC_SCANNER_H /* * Sniff network traffic to guess network data * * Copyright (C) 2003 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include "Scanner.h" #include "NetWatcher.h" #include "NetSender.h" #include "nettypes.h" #include #include class TrafficScanner : public PacketListener { public: typedef long long int mac_key; typedef unsigned int ip_key; struct HostData { ip_key addr; std::set addr_sent; std::set addr_recv; HostData() throw () : addr(0) {} }; std::map scanData; std::map local_addrs; ip_key guessed_netaddr; std::set guessed_gateways; protected: NetSender sender; void requestArp(ip_key addr) throw (); public: TrafficScanner(NetSender sender) throw () : guessed_netaddr(0xffffffff), sender(sender) {} virtual void handleEthernet(struct libnet_ethernet_hdr* eth_header) throw (); }; // vim:set ts=4 sw=4: #endif guessnet-0.55/src/scanner/scanbag-tut.cc0000644000000000000000000001121611770705652015140 0ustar /* * Copyright (C) 2007--2008 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "tests/test-utils.h" #include "scanner/scanbag.h" #include "scanner/scan.h" #include "scanner/linkbeat.h" #include "scanner/script.h" #include namespace tut { using namespace std; using namespace scanner; struct scanner_scanbag_shar { Scan* scan_default; scanner_scanbag_shar() { scan_default = new DefaultScan("default"); } ~scanner_scanbag_shar() { delete scan_default; } }; TESTGRP(scanner_scanbag); void printCands(const vector& v) { for (vector::const_iterator i = v.begin(); i != v.end(); i++) if (i != v.begin()) cout << ", " << *i; else cout << *i; } // Test the case with no scans besides the default template<> template<> void to::test<1>() { ScanBag& sb = ScanBag::get(); sb.clear(); sb.add(scan_default); ensure(!sb.anySuccess()); ensure_equals(sb.getFinal(), string()); } // Test the case only one scan besides the default template<> template<> void to::test<2>() { ScanBag& sb = ScanBag::get(); sb.clear(); sb.add(scan_default); auto_ptr scan(Script::createScan("test0", "cmd-test0")); sb.add(scan.get()); ensure(!sb.anySuccess()); ensure_equals(sb.getFinal(), string()); // Upon success, we should get it sb.notifySuccess(scan.get()); ensure(sb.anySuccess()); ensure_equals(sb.getFinal(), "test0"); // Success could however be notified twice, without invalidating the // results sb.notifySuccess(scan.get()); ensure(sb.anySuccess()); ensure_equals(sb.getFinal(), "test0"); } // Messy scanbag test from before we had a proper test suite template<> template<> void to::test<3>() { ScanBag& sb = ScanBag::get(); Scan* s20 = LinkBeat::createScan("default"); Scan* s2 = LinkBeat::createScan("nolink"); Scan* s21 = Script::createScan("test0", "cmd-test0"); Scan* s3 = Script::createScan("test1", "cmd-test1"); Scan* s4 = Script::createScan("test2", "cmd-test2"); Scan* s5 = Script::createScan("test1", "cmd-test2"); Scan* s6 = Script::createScan("test3", "cmd-test3"); sb.clear(); sb.add(scan_default); sb.add(s20); sb.add(s2); sb.add(s21); sb.add(s3); sb.add(s4); sb.add(s5); sb.add(s6); ensure(!sb.anySuccess()); ensure_equals(sb.getFinal(), string()); ensure_equals(sb.getLessSpecific(), "default"); vector v; sb.notifySuccess(s21); v = sb.getRemaining(); ensure_equals(v.size(), 1); ensure_equals(v[0], "test0"); sb.clear(); sb.add(scan_default); sb.add(s20); sb.add(s2); sb.add(s21); sb.add(s3); sb.add(s4); sb.add(s5); sb.add(s6); ensure(!sb.anySuccess()); ensure_equals(sb.getFinal(), string()); sb.notifySuccess(s4); //printf("Notified %.*s: ", PFSTR(s4->signature())); printCands(v); printf("\n"); sb.notifySuccess(s3); //printf("Notified %.*s: ", PFSTR(s3->signature())); printCands(v); printf("\n"); v = sb.getRemaining(); ensure_equals(v.size(), 1); ensure_equals(v[0], "test1"); sb.clear(); sb.add(scan_default); sb.add(s20); sb.add(s2); sb.add(s21); sb.add(s3); sb.add(s4); sb.add(s5); sb.add(s6); sb.notifySuccess(s4); v = sb.getRemaining(); ensure_equals(sb.getLessSpecific(), "test2"); delete s20; delete s2; delete s21; delete s3; delete s4; delete s5; delete s6; } // Test what happens with a duplicate profile template<> template<> void to::test<4>() { ScanBag& sb = ScanBag::get(); sb.clear(); sb.add(scan_default); auto_ptr scan(Script::createScan("test0", "cmd-test0")); sb.add(scan.get()); auto_ptr scan1(Script::createScan("test0", "cmd-test1")); sb.add(scan1.get()); auto_ptr scan2(Script::createScan("test1", "cmd-test0")); sb.add(scan2.get()); ensure(!sb.anySuccess()); ensure_equals(sb.getFinal(), string()); // Report success on the common test sb.notifySuccess(scan.get()); ensure(sb.anySuccess()); ensure_equals(sb.getFinal(), string()); // Report success on the other test sb.notifySuccess(scan1.get()); ensure(sb.anySuccess()); ensure_equals(sb.getFinal(), "test0"); } } // vim:set ts=3 sw=3: guessnet-0.55/src/scanner/scanbag.h0000644000000000000000000000716611770705652014201 0ustar #ifndef SCANBAG_H #define SCANBAG_H /* * Copyright (C) 2005--2008 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include "scanner/scan.h" struct ScanBagListener { virtual ~ScanBagListener() {} virtual void candidatesChanged() = 0; }; /** * A collection of scans, with the selection logic. * * A scan will either succeed or time out, but never fail: this means that we * cannot use boolean logic. What we do instead is, when a success is * reported, we discard all profiles that do not contain the test that * succeeded. When only one profile is left, that is the resulting profile. * * Another important design point of ScanBag is that a decision must be taken * as soon as possible, and we need to do everything possible to avoid waiting * for scans to time out before taking a decision. Therefore a result is * produced as soon as a profile is matched in a non ambiguous way. * * The main data structure of ScanBag maps profile names to all their tests, * represented by the test signatures. For every test, a boolean is kept to * represent if that test has succeeded. */ class ScanBag : protected std::map< std::string, std::map > { wibble::sys::Mutex mutex; // List of scans in order of parsing std::list scans; // Name of the default profile to use when all others fail std::string defaultProfile; // True if at least one scan reported success bool any_success; ScanBagListener* listener; ScanBag() : any_success(false), listener(0) {} // TODO: deallocate scans ~ScanBag(); public: // These functions are unsafe to call after the scans start void setListener(ScanBagListener* listener) { this->listener = listener; } /// Add a new test to the candidate profiles void add(scanner::Scan* scan); /// Get the list of available tests const std::list& getScans() const { return scans; } /// Remove all items from this ScanBag void clear() { std::map >::clear(); scans.clear(); defaultProfile.clear(); any_success = false; } // These functions are safe to call after the scans start /// Notify the success of a test, returning the list of candidate profiles void notifySuccess(scanner::Scan* scan); /// Return true if at least one scanner has notified success so far bool anySuccess(); /// Get the less specific profile among the available ones std::string getLessSpecific(); /// Get the default profile std::string getDefault(); /** * If some success has been reported and only one candidate is left, return * it. Else, return the empty string */ std::string getFinal(); /// Get the remaning profiles std::vector getRemaining(); /// Debug method: dump the contents to stdout void dump(); /// Singleton access method static ScanBag& get(); }; // vim:set ts=3 sw=3: #endif guessnet-0.55/src/scanner/script.h0000644000000000000000000000211111770705652014070 0ustar #ifndef GUESSNET_SCANNER_SCRIPT_H #define GUESSNET_SCANNER_SCRIPT_H /* * Tester that delegates testing to an external script * * Copyright (C) 2003--2007 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include namespace scanner { struct Scan; struct Script { static Scan* createScan(const std::string& name, const std::string& cmdline); }; } // vim:set ts=4 sw=4: #endif guessnet-0.55/src/scanner/scan.cc0000644000000000000000000000254611770705652013662 0ustar #include "scanner/scan.h" #include "scanner/scanbag.h" #include using namespace std; namespace scanner { void Scan::success() { ScanBag::get().notifySuccess(this); } string DefaultScan::signature() const { return "default"; } } #ifdef COMPILE_TESTSUITE #include namespace tut { using namespace tut_guessnet; struct guessnet_scans_shar { }; TESTGRP(guessnet_scans); template<> template<> void to::test<1>() { PeerScan peer("test"); gen_ensure(peer.name() == "test"); //ensure_equals(peer.name(), "test"); gen_ensure(!peer.hasIP()); gen_ensure(!peer.hasMAC()); gen_ensure(!peer.hasSource()); peer.setIP(IPAddress("1.2.3.4")); gen_ensure(peer.hasIP()); gen_ensure(!peer.hasMAC()); gen_ensure(!peer.hasSource()); peer.setSource(IPAddress("10.20.30.40")); gen_ensure(peer.hasIP()); gen_ensure(!peer.hasMAC()); gen_ensure(peer.hasSource()); struct ether_addr testmac; parse_mac(&testmac, "11:22:33:44:55:66"); peer.setMAC(testmac); gen_ensure(peer.hasIP()); gen_ensure(peer.hasMAC()); gen_ensure(peer.hasSource()); gen_ensure(peer.ip() == IPAddress("1.2.3.4")); //ensure_equals(peer.ip(), IPAddress("1.2.3.4")); gen_ensure(MAC_MATCHES(&(peer.mac()), &testmac)); gen_ensure(peer.source() == IPAddress("10.20.30.40")); //ensure_equals(peer.source(), IPAddress("10.20.30.40")); } } #endif // vim:set ts=3 sw=3: guessnet-0.55/src/scanner/scanbag.cc0000644000000000000000000000771711770705652014341 0ustar /* * Copyright (C) 2005--2008 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "scanbag.h" #include "util/output.h" #include using namespace std; using namespace wibble::sys; using namespace scanner; static ScanBag* instance = 0; ScanBag& ScanBag::get() { if (instance == 0) instance = new ScanBag; return *instance; } void ScanBag::add(Scan* scan) { iterator i = find(scan->name()); if (i == end()) { if (DefaultScan* s = dynamic_cast(scan)) { //insert(pair >(scan->name(), set())); defaultProfile = s->name(); } else { map v; v.insert(make_pair(scan->signature(), false)); insert(make_pair(scan->name(), v)); } } else i->second.insert(make_pair(scan->signature(), false)); scans.push_back(scan); } void ScanBag::notifySuccess(Scan* scan) { bool changed = false; { MutexLock lock(mutex); debug("Notified success of scan %s\n", scan->signature().c_str()); any_success = true; // The candidate winnowing algorithm: // For every candidate profile: if the profile has the scan // with the signature of "scan" then remove that scan; // otherwise remove the candidate. // Return the list of candidates left. //defaultProfile = ""; string sig = scan->signature(); for (iterator i = begin(); i != end(); ) { map::iterator j = i->second.find(sig); if (j == i->second.end()) { debug("Removing candidate %s\n", i->first.c_str()); // This candidate has no scan with the signature // so remove the candidate iterator k = i; k++; erase(i); i=k; changed = true; } else { debug("Keeping candidate %s\n", i->first.c_str()); // This candidate has a scan with the signature // so remove the matching scan j->second = true; i++; } } } // Notify that the list of candidates changed if (changed && listener) { debug("We had changes, notifying the listener\n"); listener->candidatesChanged(); } } bool ScanBag::anySuccess() { MutexLock lock(mutex); return any_success; } std::string ScanBag::getFinal() { MutexLock lock(mutex); if (any_success && size() == 1) return begin()->first; return string(); } string ScanBag::getLessSpecific() { MutexLock lock(mutex); string cand; int count = -1; for (const_iterator i = begin(); i != end(); i++) { int unfired = 0; for (map::const_iterator j = i->second.begin(); j != i->second.end(); ++j) if (!j->second) ++unfired; if (count == -1 || unfired < count) { count = unfired; cand = i->first; } } return cand; } string ScanBag::getDefault() { MutexLock lock(mutex); return defaultProfile; } std::vector ScanBag::getRemaining() { MutexLock lock(mutex); vector res; for (iterator i = begin(); i != end(); ++i) { res.push_back(i->first); } return res; } void ScanBag::dump() { MutexLock lock(mutex); stringstream str; for (const_iterator i = begin(); i != end(); i++) { str << i->first << ": "; for (map::const_iterator j = i->second.begin(); j != i->second.end(); j++) { if (j != i->second.begin()) str << ", "; str << j->first << (j->second ? "(ok)" : ""); } str << endl; } output("%s", str.str().c_str()); } // vim:set ts=3 sw=3: guessnet-0.55/src/scanner/linkbeat.h0000644000000000000000000000225711770705652014370 0ustar #ifndef GUESSNET_SCANNER_LINKBEAT_H #define GUESSNET_SCANNER_LINKBEAT_H /* * Test for link beat * * Copyright (C) 2003--2007 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include struct IFace; namespace scanner { struct Scan; struct LinkBeat { // Set the interface for the link beat scans static void configure(IFace* iface); // Beware: the scan succeeds when there is NO link beat static Scan* createScan(const std::string& name); }; } // vim:set ts=4 sw=4: #endif guessnet-0.55/src/scanner/TrafficScanner.cc0000644000000000000000000001635111770705652015625 0ustar /* * Sniff network traffic to guess network data * * Copyright (C) 2003 Enrico Zini * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "TrafficScanner.h" #include "util/output.h" #include // ntohs, htons, ... extern "C" { #include } using namespace std; using namespace wibble::sys; /* static string fmt_ip(unsigned int ip) throw () { unsigned char ipfmt[4]; memcpy(ipfmt, &ip, 4); return fmt("%d.%d.%d.%d", (int)ipfmt[0], (int)ipfmt[1], (int)ipfmt[2], (int)ipfmt[3]); } static void memdump(const string& prefix, unsigned char* mem, int size) throw () { warning("%.*s", PFSTR(prefix)); for (int i = 0; i < size; i++) { warning(" %02x", (int)mem[i]); } warning("\n"); } static unsigned int netaddr_to_netmask(unsigned int na) throw () { unsigned int res = 0; na = ntohl(na); // Count the trailing zeros int i = 0; for ( ; i < 32 && (na & (1 << i)) == 0; i++) ; // Add 1s to the start of res for ( ; i < 32; i++) res |= (1 << i); return htonl(res); } */ static unsigned int merge_netmasks(unsigned int nm1, unsigned int nm2) throw () { if (nm1 == nm2) return nm1; unsigned int dpat = nm1 ^ nm2; dpat = ntohl(dpat); // Count the leading zeros int i = 0; for ( ; i < 32 && (dpat & (0x80000000 >> i)) == 0; i++) ; if (i < 8) return 0; int res = 0; for (int j = 0; j < i; j++) { res >>= 1; res |= 0x80000000; } return htonl(res) & (nm1 | nm2); } void TrafficScanner::handleEthernet(struct libnet_ethernet_hdr* eth_header) throw () { //warning("packet "); if (ntohs (eth_header->ether_type) == ETHERTYPE_ARP) { //warning("arp "); // Parse and check the arp header struct libnet_arp_hdr* arp_header = (struct libnet_arp_hdr *)((char*)eth_header + LIBNET_ETH_H); if (ntohs (arp_header->ar_op) == ARPOP_REPLY) { ip_key ipkey = 0; memcpy(&ipkey, arp_get_sip(arp_header), 4); mac_key mkey = 0; memcpy(&mkey, arp_get_sha(arp_header), 6); scanData[mkey].addr = ipkey; //string fmtip = fmt_ip(ipkey); //warning("got address: %.*s\n", PFSTR(fmtip)); }// else // warning("no arp reply\n"); } else if (ntohs (eth_header->ether_type) == ETHERTYPE_IP) { //warning("ip "); // Parse and check the ip header struct libnet_ipv4_hdr* ip_header = (struct libnet_ipv4_hdr *)((char*)eth_header + LIBNET_ETH_H); mac_key msrc = 0; mac_key mdst = 0; ip_key isrc = 0; ip_key idst = 0; memcpy(&msrc, &(eth_header->ether_shost), 6); memcpy(&mdst, &(eth_header->ether_dhost), 6); memcpy(&isrc, &(ip_header->ip_src), 4); memcpy(&idst, &(ip_header->ip_dst), 4); /* // Bad: could give a bad addr to the gw map::iterator iter_src = scanData.find(msrc); if (iter_src != scanData.end() && iter_src->second.addr == 0) iter_src->second.addr = isrc; // Bad: could give a bad addr to the gw map::iterator iter_dst = scanData.find(mdst); if (iter_dst != scanData.end() && iter_dst->second.addr == 0) iter_dst->second.addr = idst; */ scanData[msrc].addr_sent.insert(isrc); scanData[mdst].addr_recv.insert(idst); if (local_addrs.find(isrc) == local_addrs.end()) { requestArp(isrc); local_addrs[isrc] = 0; } if (local_addrs.find(idst) == local_addrs.end()) { requestArp(idst); local_addrs[idst] = 0; } //string fmtsrc = fmt_ip(isrc); //string fmtdst = fmt_ip(idst); //warning(" %.*s -> %.*s\n", PFSTR(fmtsrc), PFSTR(fmtdst)); //memdump("pkt data:", (unsigned char*)ip_header, 64); } //else //warning("other\n"); // Get the network mask unsigned int netaddr = 0xffffffff; bool first = true; for (map::const_iterator h = scanData.begin(); h != scanData.end(); h++) if (h->second.addr != 0) if (first) { netaddr = h->second.addr; first = false; } else netaddr = merge_netmasks(netaddr, h->second.addr); if (guessed_netaddr != netaddr) { guessed_netaddr = netaddr; /* string fmt_na = fmt_ip(guessed_netaddr); warning("Network address: %.*s\n", PFSTR(fmt_na)); string fmt_nm = fmt_ip(netaddr_to_netmask(guessed_netaddr)); warning("Network mask: %.*s\n", PFSTR(fmt_nm)); */ } // Find out the gateway for (map::const_iterator h = scanData.begin(); h != scanData.end(); h++) { if (h->second.addr != 0) { //string fmt_rec = fmt_ip(h->second.addr); unsigned int gwaddr = netaddr; //warning("Names for %.*s:", PFSTR(fmt_rec)); for (set::const_iterator i = h->second.addr_sent.begin(); i != h->second.addr_sent.end(); i++) { gwaddr = merge_netmasks(gwaddr, *i); //string f = fmt_ip(*i); //warning(" %.*s", PFSTR(f)); } //warning("\n"); for (set::const_iterator i = h->second.addr_recv.begin(); i != h->second.addr_recv.end(); i++) gwaddr = merge_netmasks(gwaddr, *i); if (gwaddr == 0) { //int ogws = guessed_gateways.size(); guessed_gateways.insert(h->first); /* if (ogws != guessed_gateways.size()) { for (set::const_iterator i = guessed_gateways.begin(); i != guessed_gateways.end(); i++) { string fmt_gw = fmt_ip(scanData[*i].addr); if (i == guessed_gateways.begin()) warning("Gateway: %.*s", PFSTR(fmt_gw)); else warning(", %.*s", PFSTR(fmt_gw)); } warning("\n"); } */ } } } } void TrafficScanner::requestArp(ip_key addr) throw () { // Build and send the arp probe // Using ip_no_addr as the source ip address seems to be a good idea: see // -D switch to arping, which points to Duplicate Address Detection mode // and RFC2131, 4.4.1. unsigned char ether_broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; unsigned char ether_no_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; unsigned char ip_no_addr[4] = {0x00, 0x00, 0x00, 0x00}; struct libnet_ether_addr* localmac = sender.getMACAddress(); libnet_t *ln_context = sender.getLibnetContext(); libnet_build_arp ( ARPHRD_ETHER, ETHERTYPE_IP, ETHER_ADDR_LEN, 4, ARPOP_REQUEST, localmac->ether_addr_octet, (u_char *)ip_no_addr, ether_no_addr, (u_char *)&addr, NULL, 0, ln_context, 0); libnet_build_ethernet ( ether_broadcast_addr, localmac->ether_addr_octet, ETHERTYPE_ARP, NULL, 0, ln_context, 0); u_char* buf; u_int32_t len; libnet_adv_cull_packet(ln_context, &buf, &len); Buffer pkt(buf, len, false); // FIXME: How is a sane way of deallocating buf? if (ln_context->aligner > 0) buf -= ln_context->aligner; free(buf); libnet_clear_packet(ln_context); // Enqueue the packet for sending sender.post(pkt, 1000, 10000); } // vim:set ts=4 sw=4: guessnet-0.55/src/scanner/dhcp.cc0000644000000000000000000000664311770705652013656 0ustar /* * Scan for the existance of a DHCP server * * Copyright (C) 2004--2007 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "scanner/dhcp.h" #include "scanner/scan.h" #include "util/packetmaker.h" #include "util/netsender.h" #include "util/netwatcher.h" #include "util/output.h" #include // ntohs, htons, ... #include /* extern "C" { #include } */ using namespace std; using namespace wibble::sys; using namespace util; namespace scanner { /* * DHCP test * * Succeeds if a DHCP server makes an offer */ class DHCPScan : public Scan, public PacketListener, public Startable { public: DHCPScan(const std::string& name) : Scan(name) {} void startableStart() { // Build and send the DHCP request Buffer pkt = PacketMaker::makeDHCPRequest(); verbose("Sending 5 DHCP probes, 1 every 2 seconds...\n"); // Enqueue the probe packets for sending NetSender& sender = NetSender::get(); // Enqueue the packet for sending sender.post(pkt, 2000, 10000); } void startableStop() {} void handleDHCP(const NetBuffer& dhcp); virtual std::string signature() const { return "dhcp";// + fmt(ip()) + " " + fmt(mac()); } }; void DHCPScan::handleDHCP(const NetBuffer& dhcp) { const libnet_dhcpv4_hdr* dhcp_header = dhcp.cast(); // Parse and check the DHCP header if (dhcp_header->dhcp_opcode == LIBNET_DHCP_REPLY) { debug("Got DHCP reply\n"); #if 0 //in_addr* ipv4_him = arp_get_tip(arp_header); in_addr* ipv4_him = arp_get_sip(arp_header); ether_addr* mac_him = arp_get_sha(arp_header); debug("Got ARP reply from %.*s %.*s\n", PFSTR(fmt(IPAddress(*ipv4_him))), PFSTR(fmt(*mac_him))); //IPv4_FROM_LIBNET(ipv4_me, arp_header->ar_tpa); //IPv4_FROM_ARP(ipv4_him, arp_header->ar_spa); #endif #if 0 // Check if IP and MAC addresses match if (IPv4_MATCHES(&(*i)->ip(), ipv4_him)) { if (MAC_MATCHES(&(*i)->mac(), mac_him)) { debug("ARP reply from %.*s %.*s matches\n", PFSTR(fmt(IPAddress(*ipv4_him))), PFSTR(fmt(*mac_him))); succeeded(*i); } else { // If only the IP matches, check if the test is IP-only struct ether_addr zeroAddr; bzero(&zeroAddr, sizeof(struct ether_addr)); if (MAC_MATCHES(&(*i)->mac(), &zeroAddr)) { debug("ARP reply from %.*s %.*s matches\n", PFSTR(fmt(IPAddress(*ipv4_him))), PFSTR(fmt(*mac_him))); succeeded(*i); } } } #endif success(); } } Scan* DHCP::createScan(const std::string& name) { auto_ptr res(new DHCPScan(name)); // Register with the NetWatcher NetWatcher& watcher = NetWatcher::get(); watcher.addDHCPListener(res.get()); // Access the NetSender to show that we need it NetSender& sender = NetSender::get(); return res.release(); } } // vim:set ts=4 sw=4: guessnet-0.55/src/scanner/peer.h0000644000000000000000000000543511770705652013533 0ustar #ifndef GUESSNET_SCANNER_PEER_H #define GUESSNET_SCANNER_PEER_H /* * Scan for the existance of a specific peer using fake ARP requests * * Copyright (C) 2003--2007 Enrico Zini * Originally based on laptop-netconf.c by Matt Kern * Which in turn was nased on divine.c by Felix von Leitner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "nettypes.h" #include "scanner/scan.h" #include "util/netwatcher.h" #include namespace scanner { struct Scan; /* * Peer test * * Succeeds if host replies to ARP request */ class PeerScan : public Scan, public util::PacketListener, public util::Startable { protected: struct ether_addr _mac; IPAddress _ip; IPAddress _source; public: PeerScan(const std::string& name); PeerScan(const std::string& name, const ether_addr& mac, const IPAddress& ip) : Scan(name), _mac(mac), _ip(ip), _source("0.0.0.0") {} PeerScan(const std::string& name, const ether_addr& mac, const IPAddress& ip, const IPAddress& source) : Scan(name), _mac(mac), _ip(ip), _source(source) {} /** * After all the fields have been set, call this function to finalise the * creation of the scan */ void finaliseInit(); void startableStart(); void startableStop(); const ether_addr& mac() const { return _mac; } const IPAddress& ip() const { return _ip; } const IPAddress& source() const { return _source; } void setMAC(const ether_addr& mac) { _mac = mac; } void setIP(const IPAddress& ip) { _ip = ip; } void setSource(const IPAddress& source) { _source = source; } bool hasMAC() const; bool hasIP() const { return _ip != IPAddress("0.0.0.0"); } bool hasSource() const { return _source != IPAddress("0.0.0.0"); } void handleEthernet(const wibble::sys::NetBuffer& pkt); void handleARP(const wibble::sys::NetBuffer& arp); virtual std::string signature() const; }; struct Peer { static Scan* createScan(const std::string& name, const ether_addr& mac, const IPAddress& ip); static Scan* createScan(const std::string& name, const ether_addr& mac, const IPAddress& ip, const IPAddress& source); }; } // vim:set ts=4 sw=4: #endif guessnet-0.55/src/scanner/scan.h0000644000000000000000000000116711770705652013522 0ustar #ifndef GUESSNET_SCANNER_SCAN_H #define GUESSNET_SCANNER_SCAN_H #include #include namespace scanner { /* * Scan */ class Scan { protected: std::string _name; public: Scan(const std::string& name) : _name(name) {} virtual ~Scan() {} /// Notify success for this scan void success(); const std::string& name() const { return _name; } virtual std::string signature() const = 0; }; /* * Default test * * Always succeeds */ class DefaultScan : public Scan { public: DefaultScan(const std::string& name) : Scan(name) {} virtual std::string signature() const; }; } // vim:set ts=3 sw=3: #endif guessnet-0.55/src/scanner/script.cc0000644000000000000000000000431011770705652014231 0ustar /* * Tester that delegates testing to an external script * * Copyright (C) 2003--2010 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "scanner/script.h" #include "scanner/scan.h" #include "util/processrunner.h" #include "util/output.h" #include "options.h" #include using namespace std; using namespace wibble::sys; namespace scanner { /* * Script test * * Runs program and succeeds if exit status is zero */ class ScriptScan : public Scan, public ProcessListener { protected: std::string _cmdline; public: ScriptScan(const std::string& name, const std::string& cmdline) : Scan(name), _cmdline(cmdline) {} std::string signature() const { return "command '" + _cmdline + "'"; } void handleTermination(const std::string& signature, int status) { verbose("script [%s] terminated with status %d\n", signature.c_str(), status); if (status != 0) return; success(); } }; Scan* Script::createScan(const std::string& name, const std::string& cmdline) { auto_ptr res(new ScriptScan(name, cmdline)); verbose("adding candidate script [%s] with tag [%s]\n", cmdline.c_str(), res->signature().c_str()); vector env; env.push_back("NAME=" + res->signature()); env.push_back("IFACE=" + options.iface); env.push_back("GUESSNET=true"); env.push_back(string("PATH=") + SCRIPTDIR + ":/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"); ProcessRunner::get().addProcess(res->signature(), cmdline, env, res.get()); return res.release(); } } // vim:set ts=4 sw=4: guessnet-0.55/src/scanner/peer.cc0000644000000000000000000001043211770705652013662 0ustar /* * Scan for the existance of a specific peer using fake ARP requests * * Copyright (C) 2003--2007 Enrico Zini * Originally based on laptop-netconf.c by Matt Kern * Which in turn was nased on divine.c by Felix von Leitner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "scanner/peer.h" #include "util/netsender.h" #include "util/packetmaker.h" #include "util/output.h" #include // ntohs, htons, ... #include /* extern "C" { #include } */ using namespace std; using namespace wibble::sys; using namespace util; namespace scanner { PeerScan::PeerScan(const std::string& name) : Scan(name), _ip("0.0.0.0"), _source("0.0.0.0") { bzero(&_mac, sizeof(struct ether_addr)); } void PeerScan::startableStart() { // Enqueue the probe packets for sending NetSender& sender = NetSender::get(); // Build and send the arp probe Buffer pkt; if (hasIP()) { pkt = PacketMaker::makeARPRequest(ip(), source()); verbose("Sending 10 ARP probes, 1 every second...\n"); } else { pkt = PacketMaker::makePingRequest(mac(), source()); verbose("Sending 10 Ping probes, 1 every second...\n"); } // Enqueue the packet for sending sender.post(pkt, 1000, 10000); } void PeerScan::startableStop() { } bool PeerScan::hasMAC() const { struct ether_addr zeromac; bzero(&zeromac, sizeof(struct ether_addr)); return !MAC_MATCHES(&_mac, &zeromac); } string PeerScan::signature() const { return "peer " + fmt(ip()) + " " + fmt(mac()); } void PeerScan::handleEthernet(const NetBuffer& pkt) { // Parse and check the ethernet header const libnet_ethernet_hdr* packet_header = pkt.cast(); //debug("Got eth packet\n"); // Just check that it comes from the MAC we're looking for if (!hasIP() && MAC_MATCHES(&mac(), packet_header->ether_shost)) { debug("Got reply from %s\n", fmt(mac()).c_str()); success(); } } void PeerScan::handleARP(const NetBuffer& arp) { // Parse and check the arp header const libnet_arp_hdr* arp_header = arp.cast(); if (ntohs (arp_header->ar_op) == ARPOP_REPLY) { //in_addr* ipv4_him = arp_get_tip(arp_header); in_addr* ipv4_him = arp_get_sip(arp_header); ether_addr* mac_him = arp_get_sha(arp_header); debug("Got ARP reply from %s %s\n", fmt(IPAddress(*ipv4_him)).c_str(), fmt(*mac_him).c_str()); //IPv4_FROM_LIBNET(ipv4_me, arp_header->ar_tpa); //IPv4_FROM_ARP(ipv4_him, arp_header->ar_spa); bool match = true; // Check if IP matches if (hasIP() && ! IPv4_MATCHES(&ip(), ipv4_him)) match = false; // Check if MAC matches if (hasMAC() && ! MAC_MATCHES(&mac(), mac_him)) match = false; if (match) { debug("ARP reply from %s %s matches\n", fmt(IPAddress(*ipv4_him)).c_str(), fmt(*mac_him).c_str()); success(); } } } void PeerScan::finaliseInit() { // Register with the NetWatcher NetWatcher& watcher = NetWatcher::get(); if (hasIP()) { //debug("Listen ARP\n"); watcher.addARPListener(this); } else { //debug("Listen Ethernet\n"); watcher.addEthernetListener(this); } // Access the NetSender to show that we depend on it NetSender& sender = NetSender::get(); util::Starter::get().add(this); } Scan* Peer::createScan(const std::string& name, const ether_addr& mac, const IPAddress& ip) { auto_ptr res(new PeerScan(name, mac, ip)); res->finaliseInit(); return res.release(); } Scan* Peer::createScan(const std::string& name, const ether_addr& mac, const IPAddress& ip, const IPAddress& source) { auto_ptr res(new PeerScan(name, mac, ip, source)); res->finaliseInit(); return res.release(); } } // vim:set ts=4 sw=4: guessnet-0.55/src/scanner/iwscan.h0000644000000000000000000000470311770705652014061 0ustar #ifndef GUESSNET_SCANNER_IWSCAN_H #define GUESSNET_SCANNER_IWSCAN_H /* * Perform a wireless interface scan * * Copyright (C) 2007 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "scanner/scan.h" #include "util/starter.h" #include "IFace.h" #include "nettypes.h" #include struct wireless_scan; namespace scanner { class WirelessScan : public Scan { protected: struct ether_addr _mac; std::string _essid; bool _hasOpen; bool _open; public: WirelessScan(const std::string& name); /** * After all the fields have been set, call this function to finalise the * creation of the scan */ void finaliseInit(); const ether_addr& mac() const { return _mac; } const std::string& essid() const { return _essid; } bool open() const { return _open; } void setMAC(const ether_addr& mac) { _mac = mac; } void setESSID(const std::string& essid) { _essid = essid; } void setOpen(bool open) { _hasOpen = true; _open = open; } bool hasMAC() const; bool hasESSID() const { return !_essid.empty(); } bool hasOpen() const { return _hasOpen; } /** * Return true if this scan matches the given scan data */ bool matches(const wireless_scan& data); virtual std::string signature() const; }; class IWScan : public wibble::sys::Thread, public util::Startable { protected: std::string iface; std::list candidates; virtual void* main(); IWScan(const std::string& iface); public: virtual ~IWScan(); void startableStart() { start(); /* Start the thread */ } void startableStop() { join(); } // Don't call this after start void addCandidate(WirelessScan* scan); static void configure(const std::string& iface); static IWScan& get(); }; } // vim:set ts=4 sw=4: #endif guessnet-0.55/src/Makefile.in0000644000000000000000000006772111770705723013050 0ustar # Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ #DEFINES := $(shell libnet-config --defines) #LIBS := $(shell libnet-config --libs) -lpcap -lpthread -lpopt #CFLAGS := $(shell libnet-config --cflags) $(CFLAGS) #SUBDIRS = gnparser ifparser . #SUBDIRS = ipexpr VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : sbin_PROGRAMS = guessnet$(EXEEXT) noinst_PROGRAMS = testscan$(EXEEXT) TESTS = tests/guessnet-test$(EXEEXT) check_PROGRAMS = tests/guessnet-test$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libguessnet_a_AR = $(AR) $(ARFLAGS) libguessnet_a_LIBADD = am__dirstamp = $(am__leading_dot)dirstamp am_libguessnet_a_OBJECTS = nettypes.$(OBJEXT) util/output.$(OBJEXT) \ util/starter.$(OBJEXT) util/processrunner.$(OBJEXT) \ util/packetmaker.$(OBJEXT) util/netsender.$(OBJEXT) \ util/netwatcher.$(OBJEXT) scanner/scan.$(OBJEXT) \ scanner/scanbag.$(OBJEXT) scanner/script.$(OBJEXT) \ scanner/peer.$(OBJEXT) scanner/dhcp.$(OBJEXT) \ scanner/linkbeat.$(OBJEXT) scanner/iwscan.$(OBJEXT) libguessnet_a_OBJECTS = $(am_libguessnet_a_OBJECTS) am__installdirs = "$(DESTDIR)$(sbindir)" PROGRAMS = $(noinst_PROGRAMS) $(sbin_PROGRAMS) am_guessnet_OBJECTS = parser.$(OBJEXT) IFace.$(OBJEXT) \ options.$(OBJEXT) GuessnetParser.$(OBJEXT) \ IfaceParser.$(OBJEXT) runner/runner.$(OBJEXT) \ runner/fake.$(OBJEXT) runner/main.$(OBJEXT) guessnet.$(OBJEXT) guessnet_OBJECTS = $(am_guessnet_OBJECTS) guessnet_DEPENDENCIES = libguessnet.a am_tests_guessnet_test_OBJECTS = IFace.$(OBJEXT) options.$(OBJEXT) \ GuessnetParser.$(OBJEXT) IfaceParser.$(OBJEXT) \ util/starter-tut.$(OBJEXT) util/processrunner-tut.$(OBJEXT) \ scanner/scanbag-tut.$(OBJEXT) tests/tut-main.$(OBJEXT) tests_guessnet_test_OBJECTS = $(am_tests_guessnet_test_OBJECTS) tests_guessnet_test_DEPENDENCIES = libguessnet.a am_testscan_OBJECTS = testscan.$(OBJEXT) testscan_OBJECTS = $(am_testscan_OBJECTS) testscan_DEPENDENCIES = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(libguessnet_a_SOURCES) $(guessnet_SOURCES) \ $(tests_guessnet_test_SOURCES) $(testscan_SOURCES) DIST_SOURCES = $(libguessnet_a_SOURCES) $(guessnet_SOURCES) \ $(tests_guessnet_test_SOURCES) $(testscan_SOURCES) ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ IFCONFIG = @IFCONFIG@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBNET_CFLAGS = @LIBNET_CFLAGS@ LIBNET_CONFIG = @LIBNET_CONFIG@ LIBNET_LIBS = @LIBNET_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBWIBBLE_CFLAGS = @LIBWIBBLE_CFLAGS@ LIBWIBBLE_LIBS = @LIBWIBBLE_LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SH = @SH@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ scriptdir = @scriptdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LIBRARIES = libguessnet.a libguessnet_a_SOURCES = \ nettypes.cc \ util/output.cc \ util/starter.cc \ util/processrunner.cc \ util/packetmaker.cc \ util/netsender.cc \ util/netwatcher.cc \ scanner/scan.cc \ scanner/scanbag.cc \ scanner/script.cc \ scanner/peer.cc \ scanner/dhcp.cc \ scanner/linkbeat.cc \ scanner/iwscan.cc testscan_SOURCES = testscan.cc testscan_LDADD = -liw guessnet_SOURCES = \ parser.cc \ IFace.cc \ options.cc \ GuessnetParser.cc \ IfaceParser.cc \ runner/runner.cc \ runner/fake.cc \ runner/main.cc \ guessnet.cc guessnet_LDADD = libguessnet.a @LIBNET_LIBS@ @LIBWIBBLE_LIBS@ #guessnet_scan_SOURCES = \ # IFace.cc \ # options.cc \ # nettypes.cc \ # scanner/TrafficScanner.cc \ # guessnet-scan.cc #guessnet_scan_LDADD = libguessnet.a @LIBNET_LIBS@ @LIBWIBBLE_LIBS@ #install-exec-hook: # ln -s guessnet $(sbindir)/guessnet-ifupdown INCLUDES = @LIBNET_CFLAGS@ @LIBWIBBLE_CFLAGS@ -DSCRIPTDIR=\"@scriptdir@\" EXTRA_DIST = \ util/output.h \ util/processrunner.h \ util/starter.h \ util/netsender.h \ util/netwatcher.h \ util/packetmaker.h \ scanner/scan.h \ scanner/scanbag.h \ scanner/TrafficScanner.h \ scanner/TrafficScanner.cc \ scanner/dhcp.h \ scanner/peer.h \ scanner/script.h \ scanner/iwscan.h \ scanner/linkbeat.h \ runner/runner.h \ runner/fake.h \ runner/main.h \ tests/test-utils.h \ options.h \ ethtool-kernel.h \ ethtool-local.h \ GuessnetParser.h \ IFace.h \ IfaceParser.h \ nettypes.h \ parser.h \ guessnet-scan.cc \ runtest TESTS_ENVIRONMENT = $(top_srcdir)/src/runtest tests_guessnet_test_SOURCES = \ IFace.cc \ options.cc \ GuessnetParser.cc \ IfaceParser.cc \ util/starter-tut.cc \ util/processrunner-tut.cc \ scanner/scanbag-tut.cc \ tests/tut-main.cpp tests_guessnet_test_LDADD = libguessnet.a @LIBNET_LIBS@ @LIBWIBBLE_LIBS@ all: all-am .SUFFIXES: .SUFFIXES: .cc .cpp .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) util/$(am__dirstamp): @$(MKDIR_P) util @: > util/$(am__dirstamp) util/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) util/$(DEPDIR) @: > util/$(DEPDIR)/$(am__dirstamp) util/output.$(OBJEXT): util/$(am__dirstamp) \ util/$(DEPDIR)/$(am__dirstamp) util/starter.$(OBJEXT): util/$(am__dirstamp) \ util/$(DEPDIR)/$(am__dirstamp) util/processrunner.$(OBJEXT): util/$(am__dirstamp) \ util/$(DEPDIR)/$(am__dirstamp) util/packetmaker.$(OBJEXT): util/$(am__dirstamp) \ util/$(DEPDIR)/$(am__dirstamp) util/netsender.$(OBJEXT): util/$(am__dirstamp) \ util/$(DEPDIR)/$(am__dirstamp) util/netwatcher.$(OBJEXT): util/$(am__dirstamp) \ util/$(DEPDIR)/$(am__dirstamp) scanner/$(am__dirstamp): @$(MKDIR_P) scanner @: > scanner/$(am__dirstamp) scanner/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) scanner/$(DEPDIR) @: > scanner/$(DEPDIR)/$(am__dirstamp) scanner/scan.$(OBJEXT): scanner/$(am__dirstamp) \ scanner/$(DEPDIR)/$(am__dirstamp) scanner/scanbag.$(OBJEXT): scanner/$(am__dirstamp) \ scanner/$(DEPDIR)/$(am__dirstamp) scanner/script.$(OBJEXT): scanner/$(am__dirstamp) \ scanner/$(DEPDIR)/$(am__dirstamp) scanner/peer.$(OBJEXT): scanner/$(am__dirstamp) \ scanner/$(DEPDIR)/$(am__dirstamp) scanner/dhcp.$(OBJEXT): scanner/$(am__dirstamp) \ scanner/$(DEPDIR)/$(am__dirstamp) scanner/linkbeat.$(OBJEXT): scanner/$(am__dirstamp) \ scanner/$(DEPDIR)/$(am__dirstamp) scanner/iwscan.$(OBJEXT): scanner/$(am__dirstamp) \ scanner/$(DEPDIR)/$(am__dirstamp) libguessnet.a: $(libguessnet_a_OBJECTS) $(libguessnet_a_DEPENDENCIES) -rm -f libguessnet.a $(libguessnet_a_AR) libguessnet.a $(libguessnet_a_OBJECTS) $(libguessnet_a_LIBADD) $(RANLIB) libguessnet.a clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)" @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && rm -f $$files clean-sbinPROGRAMS: -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) runner/$(am__dirstamp): @$(MKDIR_P) runner @: > runner/$(am__dirstamp) runner/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) runner/$(DEPDIR) @: > runner/$(DEPDIR)/$(am__dirstamp) runner/runner.$(OBJEXT): runner/$(am__dirstamp) \ runner/$(DEPDIR)/$(am__dirstamp) runner/fake.$(OBJEXT): runner/$(am__dirstamp) \ runner/$(DEPDIR)/$(am__dirstamp) runner/main.$(OBJEXT): runner/$(am__dirstamp) \ runner/$(DEPDIR)/$(am__dirstamp) guessnet$(EXEEXT): $(guessnet_OBJECTS) $(guessnet_DEPENDENCIES) @rm -f guessnet$(EXEEXT) $(CXXLINK) $(guessnet_OBJECTS) $(guessnet_LDADD) $(LIBS) util/starter-tut.$(OBJEXT): util/$(am__dirstamp) \ util/$(DEPDIR)/$(am__dirstamp) util/processrunner-tut.$(OBJEXT): util/$(am__dirstamp) \ util/$(DEPDIR)/$(am__dirstamp) scanner/scanbag-tut.$(OBJEXT): scanner/$(am__dirstamp) \ scanner/$(DEPDIR)/$(am__dirstamp) tests/$(am__dirstamp): @$(MKDIR_P) tests @: > tests/$(am__dirstamp) tests/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) tests/$(DEPDIR) @: > tests/$(DEPDIR)/$(am__dirstamp) tests/tut-main.$(OBJEXT): tests/$(am__dirstamp) \ tests/$(DEPDIR)/$(am__dirstamp) tests/guessnet-test$(EXEEXT): $(tests_guessnet_test_OBJECTS) $(tests_guessnet_test_DEPENDENCIES) tests/$(am__dirstamp) @rm -f tests/guessnet-test$(EXEEXT) $(CXXLINK) $(tests_guessnet_test_OBJECTS) $(tests_guessnet_test_LDADD) $(LIBS) testscan$(EXEEXT): $(testscan_OBJECTS) $(testscan_DEPENDENCIES) @rm -f testscan$(EXEEXT) $(CXXLINK) $(testscan_OBJECTS) $(testscan_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f runner/fake.$(OBJEXT) -rm -f runner/main.$(OBJEXT) -rm -f runner/runner.$(OBJEXT) -rm -f scanner/dhcp.$(OBJEXT) -rm -f scanner/iwscan.$(OBJEXT) -rm -f scanner/linkbeat.$(OBJEXT) -rm -f scanner/peer.$(OBJEXT) -rm -f scanner/scan.$(OBJEXT) -rm -f scanner/scanbag-tut.$(OBJEXT) -rm -f scanner/scanbag.$(OBJEXT) -rm -f scanner/script.$(OBJEXT) -rm -f tests/tut-main.$(OBJEXT) -rm -f util/netsender.$(OBJEXT) -rm -f util/netwatcher.$(OBJEXT) -rm -f util/output.$(OBJEXT) -rm -f util/packetmaker.$(OBJEXT) -rm -f util/processrunner-tut.$(OBJEXT) -rm -f util/processrunner.$(OBJEXT) -rm -f util/starter-tut.$(OBJEXT) -rm -f util/starter.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GuessnetParser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IFace.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IfaceParser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/guessnet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nettypes.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testscan.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@runner/$(DEPDIR)/fake.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@runner/$(DEPDIR)/main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@runner/$(DEPDIR)/runner.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@scanner/$(DEPDIR)/dhcp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@scanner/$(DEPDIR)/iwscan.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@scanner/$(DEPDIR)/linkbeat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@scanner/$(DEPDIR)/peer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@scanner/$(DEPDIR)/scan.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@scanner/$(DEPDIR)/scanbag-tut.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@scanner/$(DEPDIR)/scanbag.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@scanner/$(DEPDIR)/script.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tut-main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/netsender.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/netwatcher.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/output.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/packetmaker.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/processrunner-tut.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/processrunner.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/starter-tut.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@util/$(DEPDIR)/starter.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.o: @am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile $(LIBRARIES) $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(sbindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f runner/$(DEPDIR)/$(am__dirstamp) -rm -f runner/$(am__dirstamp) -rm -f scanner/$(DEPDIR)/$(am__dirstamp) -rm -f scanner/$(am__dirstamp) -rm -f tests/$(DEPDIR)/$(am__dirstamp) -rm -f tests/$(am__dirstamp) -rm -f util/$(DEPDIR)/$(am__dirstamp) -rm -f util/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-noinstLIBRARIES \ clean-noinstPROGRAMS clean-sbinPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) runner/$(DEPDIR) scanner/$(DEPDIR) tests/$(DEPDIR) util/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-sbinPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) runner/$(DEPDIR) scanner/$(DEPDIR) tests/$(DEPDIR) util/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sbinPROGRAMS .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-noinstLIBRARIES \ clean-noinstPROGRAMS clean-sbinPROGRAMS ctags distclean \ distclean-compile distclean-generic distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-sbinPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: guessnet-0.55/src/testscan.cc0000644000000000000000000000420511770705652013123 0ustar /* * Guess the current network location * * Copyright (C) 2003 Enrico Zini * Mostly rewritten by Enrico Zini on May 2003 * Originally based on laptop-netconf.c by Matt Kern * That was in turn based on divine.c by Felix von Leitner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #if 0 #include #include /* errno */ #include // memcpy #include // socket, getpwuid, geteuid #include // socket #include // ioctl #include #include // close, geteuid #include // getpwuid #endif using namespace std; int main (int argc, const char *argv[]) { // Access the interface const char* iface = argv[1]; // Apre il socket per parlare con il supporto di rete del kernel int skfd = iw_sockets_open(); if (skfd < 0) { perror("socket"); exit(1); } // Questo serve a iw_scan e iw_scan lo vuole passato perché non vuole // ricalcolarselo ogni volta int we_version = iw_get_kernel_we_version(); // Fa lo scan, bloccante //(iw_process_scan è la non blocking) wireless_scan_head scan_context; if (iw_scan(skfd, (char*)iface, we_version, &scan_context) < 0) { perror("iw_scan"); exit(1); } for (wireless_scan* i = scan_context.result; i != 0; i = i->next) { printf("name %s essid %s\n", i->b.name, i->b.essid); } // TODO: deallocare la lista return 0; } // vim:set ts=4 sw=4: guessnet-0.55/src/Makefile.am0000644000000000000000000000421711770705652013027 0ustar #DEFINES := $(shell libnet-config --defines) #LIBS := $(shell libnet-config --libs) -lpcap -lpthread -lpopt #CFLAGS := $(shell libnet-config --cflags) $(CFLAGS) #SUBDIRS = gnparser ifparser . #SUBDIRS = ipexpr sbin_PROGRAMS = guessnet # guessnet-scan noinst_PROGRAMS = testscan noinst_LIBRARIES = libguessnet.a libguessnet_a_SOURCES = \ nettypes.cc \ util/output.cc \ util/starter.cc \ util/processrunner.cc \ util/packetmaker.cc \ util/netsender.cc \ util/netwatcher.cc \ scanner/scan.cc \ scanner/scanbag.cc \ scanner/script.cc \ scanner/peer.cc \ scanner/dhcp.cc \ scanner/linkbeat.cc \ scanner/iwscan.cc testscan_SOURCES = testscan.cc testscan_LDADD = -liw guessnet_SOURCES = \ parser.cc \ IFace.cc \ options.cc \ GuessnetParser.cc \ IfaceParser.cc \ runner/runner.cc \ runner/fake.cc \ runner/main.cc \ guessnet.cc guessnet_LDADD = libguessnet.a @LIBNET_LIBS@ @LIBWIBBLE_LIBS@ #guessnet_scan_SOURCES = \ # IFace.cc \ # options.cc \ # nettypes.cc \ # scanner/TrafficScanner.cc \ # guessnet-scan.cc #guessnet_scan_LDADD = libguessnet.a @LIBNET_LIBS@ @LIBWIBBLE_LIBS@ #install-exec-hook: # ln -s guessnet $(sbindir)/guessnet-ifupdown INCLUDES=@LIBNET_CFLAGS@ @LIBWIBBLE_CFLAGS@ -DSCRIPTDIR=\"@scriptdir@\" EXTRA_DIST = \ util/output.h \ util/processrunner.h \ util/starter.h \ util/netsender.h \ util/netwatcher.h \ util/packetmaker.h \ scanner/scan.h \ scanner/scanbag.h \ scanner/TrafficScanner.h \ scanner/TrafficScanner.cc \ scanner/dhcp.h \ scanner/peer.h \ scanner/script.h \ scanner/iwscan.h \ scanner/linkbeat.h \ runner/runner.h \ runner/fake.h \ runner/main.h \ tests/test-utils.h \ options.h \ ethtool-kernel.h \ ethtool-local.h \ GuessnetParser.h \ IFace.h \ IfaceParser.h \ nettypes.h \ parser.h \ guessnet-scan.cc \ runtest # Tests TESTS = tests/guessnet-test TESTS_ENVIRONMENT = $(top_srcdir)/src/runtest check_PROGRAMS = tests/guessnet-test tests_guessnet_test_SOURCES = \ IFace.cc \ options.cc \ GuessnetParser.cc \ IfaceParser.cc \ util/starter-tut.cc \ util/processrunner-tut.cc \ scanner/scanbag-tut.cc \ tests/tut-main.cpp tests_guessnet_test_LDADD = libguessnet.a @LIBNET_LIBS@ @LIBWIBBLE_LIBS@ guessnet-0.55/src/IFace.h0000644000000000000000000001001311770705652012102 0ustar #ifndef IFACE_H #define IFACE_H /* * Encapsulate access to a network interface * * Copyright (C) 2003--2007 Enrico Zini * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* * Provide the class and exceptions required to access interface data */ #include #include #include struct ifreq; namespace wibble { namespace exception { /// Exception raised when an error occurs accessing an interface class IFace : public System { public: IFace(const std::string& context) throw () : System(context) {} IFace(int code, const std::string& context) throw () : System(code, context) {} virtual const char* type() const throw () { return "IFace"; } }; /// Exception raised when an error occurs accessing the MII functionality of an /// interface class MII : public IFace { public: MII(const std::string& context) throw () : IFace(context) {} MII(int code, const std::string& context) throw () : IFace(code, context) {} virtual const char* type() const throw () { return "MII"; } }; } } /// Configuration data for a network interface struct if_params { short flags; unsigned int addr_flags; struct sockaddr_in addr; struct sockaddr_in dstaddr; struct sockaddr_in broadaddr; struct sockaddr_in netmask; struct sockaddr hwaddr; // Debugging function, not thread safe void print(); }; /// Access the informations on an interface class IFace { protected: int _socket; struct ifreq* _ifr; bool _up; bool _run; bool _conn; bool _has_iface; bool _has_mii; void read_interface_configuration(struct if_params *ifp) throw (wibble::exception::IFace); void write_interface_configuration(const struct if_params& ifp) throw (wibble::exception::IFace); int mdio_read(int location) throw (wibble::exception::MII); public: /// Create an object to access informations of the interface whose name /// is in `name' IFace(const std::string& name) throw (wibble::exception::System, wibble::exception::IFace, wibble::exception::MII); ~IFace() throw (); /// Tell if the interface was up at the time of the last update() bool up() const throw () { return _up; } /// Tell if the interface was running at the time of the last update() bool running() const throw () { return _run; } /// Tell if the interface was connected at the time of the last update() bool connected() const throw () { return _conn; } /// Tell if the interface exists bool has_iface() const throw () { return _has_iface; } /// Tell if the interface MII interface is working bool has_mii() const throw () { return _has_mii; } /// Get the interface name std::string name() const throw (); /// Update the interface status void update() throw (wibble::exception::IFace, wibble::exception::MII); /// Bring the interface up in broadcast mode /** * Returns a struct if_params descriving the previous interface configuration */ if_params initBroadcast(int timeout) throw (wibble::exception::IFace); /// Get the interface configuration /** * Returns a struct if_params descriving the current interface configuration */ if_params getConfiguration() throw (wibble::exception::IFace); /// Set the interface configuration /** * Returns a struct if_params descriving the previous interface configuration */ if_params setConfiguration(const if_params& config) throw (wibble::exception::IFace); }; // vim:set ts=4 sw=4: #endif guessnet-0.55/src/nettypes.cc0000644000000000000000000000620011770705652013147 0ustar /* * (sub-optimal) Platform independent encapsulation of network types and * addresses * * * Copyright (C) 2003 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "nettypes.h" #include #include using namespace std; /* Format an IPv4 address in a static char buffer */ string fmt(const IPAddress& addr) throw () { stringstream buf; for (int i = 0; i < 4; i++) { if (i > 0) buf << '.'; buf << (int)(((const unsigned char*)(const in_addr*)addr)[i]); } return buf.str(); } /* Format a MAC address in a static char buffer */ string fmt(const struct ether_addr& addr) throw () { stringstream buf; for (int i = 0; i < 6; i++) { if (i > 0) buf << ':'; buf << hex << setfill('0') << setw(2) << (int)(((const unsigned char*)&addr)[i]); } return buf.str(); } IPAddress::IPAddress(const std::string& str) throw (wibble::exception::Consistency) { if (inet_aton(str.c_str(), &addr) == 0) // Not valid throw wibble::exception::Consistency("parsing IP address \"" + str + "\"", "not a valid IP address"); } bool IPAddress::operator==(const IPAddress& ip) const { return IPv4_MATCHES(&this->addr, &ip.addr); } bool IPAddress::operator!=(const IPAddress& ip) const { return !IPv4_MATCHES(&this->addr, &ip.addr); } /* Parse a MAC address from its canonical string representation */ bool parse_mac(struct ether_addr* target, const string& str) throw () { unsigned int a, b, c, d, e, f; if (sscanf(str.c_str(), "%x:%x:%x:%x:%x:%x", &a, &b, &c, &d, &e, &f) == 6) { ((unsigned char*)target)[0] = a; ((unsigned char*)target)[1] = b; ((unsigned char*)target)[2] = c; ((unsigned char*)target)[3] = d; ((unsigned char*)target)[4] = e; ((unsigned char*)target)[5] = f; return true; } else return false; } #ifdef COMPILE_TESTSUITE #include namespace tut { using namespace tut_guessnet; struct guessnet_nettypes_shar { }; TESTGRP(guessnet_nettypes); template<> template<> void to::test<1>() { IPAddress zero("0.0.0.0"); IPAddress host("1.2.3.4"); gen_ensure(zero == IPAddress("0.0.0.0")); gen_ensure(zero != IPAddress("1.2.3.4")); //ensure_equals(zero, IPAddress("0.0.0.0")); gen_ensure(host == IPAddress("1.2.3.4")); gen_ensure(host != IPAddress("0.0.0.0")); //ensure_equals(host, IPAddress("1.2.3.4")); gen_ensure(zero == zero); gen_ensure(host == host); gen_ensure(zero != host); gen_ensure(fmt(zero) == "0.0.0.0"); gen_ensure(fmt(host) == "1.2.3.4"); } } #endif // vim:set ts=4 sw=4: guessnet-0.55/src/guessnet.cc0000644000000000000000000001316311770705652013137 0ustar /* * Guess the current network location * * Copyright (C) 2003--2010 Enrico Zini * Mostly rewritten by Enrico Zini on May 2003 * Originally based on laptop-netconf.c by Matt Kern * That was in turn based on divine.c by Felix von Leitner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H #include #define APPNAME PACKAGE #else #warning No config.h found: using fallback values #define APPNAME __FILE__ #define VERSION "unknown" #endif #include "scanner/scan.h" #include "options.h" #include "runner/fake.h" #include "runner/main.h" #include "util/output.h" #include "util/starter.h" #include "scanner/linkbeat.h" #include "IFace.h" #include #include #include #include #include /* errno */ #include // memcpy #include // socket, getpwuid, geteuid #include // socket #include // ioctl #include #include // close, geteuid #include // getpwuid #include #include using namespace std; using namespace wibble::sys; using namespace scanner; using namespace util; /* bool detectIfupdown() { pid_t ppid = getppid(); string exe = "/proc/" + fmt(ppid) + "/exe"; char buf[15]; int size; if ((size = readlink(exe.c_str(), buf, 15)) == -1) { if (debug) fprintf(stderr, "Readlink of %.*s failed\n", PFSTR(exe)); return false; } if (debug) fprintf(stderr, "Readlink of %.*s gave \"%.*s\"\n", PFSTR(exe), size, buf); return strncmp(buf, "/sbin/ifup", size) == 0; } */ int main (int argc, const char *argv[]) { // Install the handler for unexpected exceptions wibble::exception::InstallUnexpected installUnexpected; // Access the interface try { options.init(argc, argv); debug("Guessnet " VERSION " starting...\n"); IFace iface(options.iface); LinkBeat::configure(&iface); // After the interface is up, we need another try run to be able to // shut it down, if needed, in case of problems bool iface_was_down; if_params saved_iface_cfg; try { vector scans = options.scans; verbose("%d candidate profiles\n", scans.size()); // FIXME: is this needed? ScanBag::get().add(new DefaultScan(options.defprof)); debug("Added \"default\" test %s\n", options.defprof.c_str()); // if requested to do so, sleep for a while before starting our // work. may be needed in order to let the interface settle down // before bringing it up if (options.initdelay) { debug("Sleeping lazyly...\n"); sleep(options.initdelay); } /* Check if we have to bring up the interface; if yes, do it */ //iface_was_down = iface_init(Environment::get().iface(), op_init_time); iface.update(); iface_was_down = !iface.up(); if (iface_was_down) { verbose("Interface %s was down: initializing for broadcast\n", iface.name().c_str()); saved_iface_cfg = iface.initBroadcast(options.init_timeout); } // Let the signals be caught by some other process sigset_t sigs, oldsigs; sigfillset(&sigs); sigdelset(&sigs, SIGFPE); sigdelset(&sigs, SIGILL); sigdelset(&sigs, SIGSEGV); sigdelset(&sigs, SIGBUS); sigdelset(&sigs, SIGABRT); sigdelset(&sigs, SIGIOT); sigdelset(&sigs, SIGTRAP); sigdelset(&sigs, SIGSYS); // Don't block the termination signals: we need them sigdelset(&sigs, SIGTERM); sigdelset(&sigs, SIGINT); sigdelset(&sigs, SIGQUIT); pthread_sigmask(SIG_BLOCK, &sigs, &oldsigs); // Scanning methods runner::Main scanner(iface); //runner::Fake scanner; debug("Initialized test subsystems\n"); // Start the tests Starter::get().start(); debug("Started tests\n"); // Wait for the test results string profile; unsigned scanCount = ScanBag::get().getScans().size(); if (scanCount > 1) { debug("%d candidates\n", scanCount); profile = scanner.getResult(options.timeout * 1000); } else { warning("No candidates provided: skipping detection\n"); } // Shutdown the tests scanner.shutdown(); // We've shutdown the threads: restore original signals pthread_sigmask(SIG_SETMASK, &oldsigs, &sigs); // Output the profile name we found if (profile.size()) { output("%s\n", profile.c_str()); } else { output("%s\n", options.defprof.c_str()); } } catch (std::exception& e) { error("%s\n", e.what()); if (geteuid() != 0) { struct passwd *p = getpwuid(geteuid()); error("You can try invoking guessnet as user root instead of %s\n", p->pw_name); } return 1; } /* Bring down the interface if we need it */ if (iface_was_down) iface.setConfiguration(saved_iface_cfg); } catch (std::exception& e) { error("%s\n", e.what()); if (geteuid() != 0) { struct passwd *p = getpwuid(geteuid()); error("You can try invoking guessnet as user root instead of %s\n", p->pw_name); } return 1; } return 0; } // vim:set ts=4 sw=4: guessnet-0.55/src/parser.cc0000644000000000000000000000370511770705652012577 0ustar /* * Common facilities used by test data parsers * * Copyright (C) 2003 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "parser.h" #include namespace wibble { namespace exception { static std::string parserContext(const std::string& file, int line) throw () { std::stringstream str; if (line == -1) str << "parsing file " << file; else str << file << ":" << line; return str.str(); } static std::string parserContext(int line) throw () { std::stringstream str; str << "parsing line " << line; return str.str(); } Parser::Parser(const std::string& file, int line, const std::string& error) throw () : Consistency(parserContext(file, line), error), m_file(file), m_line(line) {} Parser::Parser(int line, const std::string& error) throw () : Consistency(parserContext(line), error), m_line(line) {} Parser::Parser(const std::string& context, const std::string& error) throw () : Consistency(context, error), m_line(-1) {} void Parser::setLocation(const std::string file, int line) throw () { m_file = file; if (line != -1) m_line = line; m_context[0] = parserContext(m_file, m_line); } void Parser::setLocation(int line) throw () { if (line != -1) m_line = line; m_context[0] = parserContext(m_file, m_line); } } } // vim:set ts=4 sw=4: guessnet-0.55/src/util/0000755000000000000000000000000011770717500011737 5ustar guessnet-0.55/src/util/starter-tut.cc0000644000000000000000000000606311770705652014556 0ustar /* * Copyright (C) 2007 Enrico Zini * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "tests/test-utils.h" #include "util/starter.h" #include #include namespace tut { using namespace std; using namespace util; struct starter_shar { }; TESTGRP(starter); struct TestStarter : public Startable { static unsigned seq; bool started; unsigned startedWhen; unsigned stoppedWhen; TestStarter() : started(false), startedWhen(0), stoppedWhen(0) {}; virtual void startableStart() { started = true; startedWhen = ++seq; } virtual void startableStop() { started = false; stoppedWhen = ++seq; } }; unsigned TestStarter::seq = 0; // Check that reset also stops the starters template<> template<> void to::test<1>() { TestStarter first; Starter& s = Starter::get(); s.reset(); s.add(&first, 10); s.start(); ensure(first.started); s.reset(); ensure(!first.started); } // Check that start and stop happen, and in order template<> template<> void to::test<2>() { TestStarter first, second, third; Starter& s = Starter::get(); s.reset(); // Add the starters s.add(&third, 30u); s.add(&second, 20); s.add(&first, 10); // Start everything s.start(); // Ensure that everything is started ensure(first.started); ensure(second.started); ensure(third.started); // Ensure that everything is started in the right order ensure(first.startedWhen < second.startedWhen); ensure(second.startedWhen < third.startedWhen); // Stop everything s.stop(); // Ensure that everything is stopped ensure(!first.started); ensure(!second.started); ensure(!third.started); // Ensure that everything is stopped in the right order ensure(third.stoppedWhen < second.stoppedWhen); ensure(second.stoppedWhen < first.stoppedWhen); } // Check that adding a Startable when the Starter is started, starts it. template<> template<> void to::test<3>() { TestStarter first, second, third; Starter& s = Starter::get(); s.reset(); s.add(&second, 20); s.start(); ensure(!first.started); ensure(second.started); ensure(!third.started); s.add(&first, 10); ensure(first.started); ensure(second.started); ensure(!third.started); s.stop(); ensure(!first.started); ensure(!second.started); ensure(!third.started); s.add(&third, 10); ensure(!first.started); ensure(!second.started); ensure(!third.started); } } // vim:set ts=4 sw=4: guessnet-0.55/src/util/output.cc0000644000000000000000000000571011770705652013616 0ustar /* * Verbose/debug output functions * * Copyright (C) 2003--2007 Enrico Zini * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "util/output.h" #include #include #include #include #include using namespace std; namespace util { static Output* instance = 0; static wibble::sys::Mutex outputMutex; Output& Output::get() throw () { if (!instance) instance = new Output; return *instance; } Output::Output() throw () : _verbose(false), _debug(false), _syslog(false) {} } using namespace util; void fatal_error(const char* fmt, ...) ATTR_PRINTF(1, 2) { wibble::sys::MutexLock lock(outputMutex); fprintf(stderr, "guessnet: "); va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); if (Output::get().syslog()) { va_start(ap, fmt); vsyslog(LOG_INFO, fmt, ap); } va_end(ap); fprintf(stderr, "\n"); exit(1); } void error(const char* fmt, ...) ATTR_PRINTF(1, 2) { wibble::sys::MutexLock lock(outputMutex); va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); if (Output::get().syslog()) { va_start(ap, fmt); vsyslog(LOG_INFO, fmt, ap); } va_end(ap); } void warning(const char* fmt, ...) ATTR_PRINTF(1, 2) { wibble::sys::MutexLock lock(outputMutex); va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); if (Output::get().syslog()) { va_start(ap, fmt); vsyslog(LOG_INFO, fmt, ap); } va_end(ap); } void output(const char* fmt, ...) ATTR_PRINTF(1, 2) { wibble::sys::MutexLock lock(outputMutex); va_list ap; va_start(ap, fmt); vfprintf(stdout, fmt, ap); va_end(ap); } void verbose(const char* fmt, ...) ATTR_PRINTF(1, 2) { wibble::sys::MutexLock lock(outputMutex); if (Output::get().verbose()) { va_list ap; va_start(ap, fmt); fprintf(stderr, "guessnet: "); vfprintf(stderr, fmt, ap); if (Output::get().syslog()) { va_start(ap, fmt); vsyslog(LOG_INFO, fmt, ap); } va_end(ap); } } void debug(const char* fmt, ...) ATTR_PRINTF(1, 2) { wibble::sys::MutexLock lock(outputMutex); if (Output::get().debug()) { va_list ap; va_start(ap, fmt); fprintf(stderr, "guessnet: "); vfprintf(stderr, fmt, ap); if (Output::get().syslog()) { va_start(ap, fmt); vsyslog(LOG_INFO, fmt, ap); } va_end(ap); } } // vim:set ts=4 sw=4: guessnet-0.55/src/util/netsender.h0000644000000000000000000000703211770705652014106 0ustar #ifndef GUESSNET_UTIL_NETSENDER_H #define GUESSNET_UTIL_NETSENDER_H /* * Thread to inject packets to a network * * Copyright (C) 2003--2007 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "nettypes.h" #include "util/starter.h" #include #include #include extern "C" { #include } namespace wibble { namespace exception { class Libnet : public Generic { protected: std::string _libnet_errmsg; public: Libnet(const libnet_t* ln_context, const std::string& context) throw () : Generic(context) { const char* msg = libnet_geterror(const_cast(ln_context)); _libnet_errmsg = msg ? msg : "(can't provide an error message: libnet returned null from libnet_geterror!)"; } Libnet(const char* ln_errbuf, const std::string& context) throw () : Generic(context), _libnet_errmsg(ln_errbuf) {} Libnet(const std::string& context) throw () : Generic(context), _libnet_errmsg() {} ~Libnet() throw () {} virtual const char* type() const throw () { return "libnet"; } virtual std::string desc() const throw () { if (_libnet_errmsg.size()) return _libnet_errmsg; else return "Unknown libnet error"; } }; } } namespace util { /* * Injects ethernet packets to a given interface. * * Every public method is thread-safe */ class NetSender : public wibble::sys::Thread, public util::Startable { protected: class TimedPacket { public: int delay; wibble::sys::Buffer packet; TimedPacket(int delay, wibble::sys::Buffer packet) throw () : delay(delay), packet(packet) {} }; bool quitRequested; std::string iface; struct libnet_ether_addr* local_hardware_addr; wibble::sys::Mutex macMutex; wibble::sys::Mutex pktMutex; wibble::sys::Condition pktCond; std::queue immediatePackets; // Delta-list of scheduled packets with their send delay std::list scheduledPackets; // Libnet error buffer char ln_errbuf[LIBNET_ERRBUF_SIZE]; // Libnet context libnet_t* ln_context; virtual void* main(); wibble::sys::Buffer nextPacket(); void requestQuit(); NetSender(const std::string& iface); public: ~NetSender(); void startableStart(); void startableStop() { requestQuit(); } struct libnet_ether_addr* getMACAddress(); libnet_t *getLibnetContext(); // Send packet once void post(wibble::sys::Buffer packet); // Send packet at regular intervals. // msinterval: interval between sends (in milliseconds) // mstimeout: keep sending for mstimeout time (in millisecond) void post(wibble::sys::Buffer packet, int msinterval, int mstimeout); // Post a packet after the given delay void post(wibble::sys::Buffer packet, int delay); static void configure(const std::string& iface); static NetSender& get(); }; } // vim:set ts=4 sw=4: #endif guessnet-0.55/src/util/netsender.cc0000644000000000000000000001360611770705652014250 0ustar /* * Thread to inject packets to a network * * Copyright (C) 2003--2007 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "util/netsender.h" #include "util/output.h" #include #include extern "C" { #include } #include #include //#define DEBUG(args...) fprintf(stderr, ##args) #define DEBUG(args...) do {} while(0) using namespace std; using namespace wibble::sys; namespace util { static NetSender* instance = 0; static bool requested = false; void NetSender::configure(const std::string& iface) { if (instance) { delete instance; instance = 0; } instance = new NetSender(iface); } NetSender& NetSender::get() { if (!requested) { // Don't start unless something needs it util::Starter::get().add(instance, 200); requested = true; } return *instance; } NetSender::NetSender(const string& iface) : quitRequested(false), iface(iface), local_hardware_addr(0), ln_context(0) { } NetSender::~NetSender() { try { requestQuit(); DEBUG("NS~-Canceled\n"); } catch (wibble::exception::System& e) { warning("%s in NetSender destructor\n", e.what()); } DEBUG("LN-Deleting %p\n", ln_context); try { if (ln_context) libnet_destroy(ln_context); } catch (exception& e) { DEBUG(e.what()); } DEBUG("LN-Deleted\n"); } void NetSender::startableStart() { debug("Starting net sender\n"); if (!(ln_context = libnet_init(LIBNET_LINK_ADV, const_cast(iface.c_str()), ln_errbuf))) throw wibble::exception::Libnet(ln_errbuf, "opening link interface"); start(); } struct libnet_ether_addr* NetSender::getMACAddress() { MutexLock lock(macMutex); if (!local_hardware_addr) if (!(local_hardware_addr = libnet_get_hwaddr(ln_context))) throw wibble::exception::Libnet(ln_context, "trying to determine local hardware address"); return local_hardware_addr; } libnet_t* NetSender::getLibnetContext() { return ln_context; } void NetSender::post(Buffer packet) { MutexLock lock(pktMutex); immediatePackets.push(packet); pktCond.broadcast(); } void NetSender::post(Buffer packet, int msinterval, int mstimeout) { post(packet); for (int i = msinterval; i < mstimeout; i += msinterval) post(packet, i); } void NetSender::post(Buffer packet, int delay) { MutexLock lock(pktMutex); //int totDelay = 0; for (list::iterator i = scheduledPackets.begin(); i != scheduledPackets.end(); i++) { if (delay < i->delay) { scheduledPackets.insert(i, TimedPacket(delay, packet)); i->delay -= delay; pktCond.broadcast(); return; } delay -= i->delay; } scheduledPackets.push_back(TimedPacket(delay, packet)); pktCond.broadcast(); } void NetSender::requestQuit() { MutexLock lock(pktMutex); quitRequested = true; pktCond.broadcast(); } Buffer NetSender::nextPacket() { DEBUG("NS-NP-PreLock\n"); MutexLock lock(pktMutex); DEBUG("NS-NP-PreLocked\n"); while (true) { if (!immediatePackets.empty()) { DEBUG("NS-NP-Immediate\n"); Buffer res = immediatePackets.front(); immediatePackets.pop(); return res; } if (!scheduledPackets.empty()) { DEBUG("NS-NP-Scheduled\n"); int wtime = scheduledPackets.front().delay; // Compute the absolute waiting timeout struct timeval before; gettimeofday(&before, 0); struct timespec abstime; abstime.tv_sec = before.tv_sec; abstime.tv_nsec = before.tv_usec * 1000; abstime.tv_sec += wtime / 1000; abstime.tv_nsec += (wtime % 1000) * 1000000; if (abstime.tv_nsec > 1000000000) { abstime.tv_sec++; abstime.tv_nsec -= 1000000000; } pktCond.wait(lock, abstime); if (quitRequested) { DEBUG("NS-NP-QUIT0\n"); return Buffer(0); } struct timeval after; gettimeofday(&after, 0); int elapsed = (after.tv_sec * 1000 + after.tv_usec / 1000) - (before.tv_sec * 1000 + before.tv_usec / 1000); scheduledPackets.front().delay -= elapsed; while (!scheduledPackets.empty() && scheduledPackets.front().delay <= 0) { immediatePackets.push(scheduledPackets.front().packet); scheduledPackets.pop_front(); } } else { DEBUG("NS-NP-Wait\n"); pktCond.wait(lock); if (quitRequested) { DEBUG("NS-NP-QUIT1\n"); return Buffer(0); } DEBUG("NS-NP-Waited\n"); } } } void* NetSender::main() { // Let the signals be caught by some other process DEBUG("NS-Main-Start\n"); sigset_t sigs, oldsigs; sigfillset(&sigs); sigdelset(&sigs, SIGFPE); sigdelset(&sigs, SIGILL); sigdelset(&sigs, SIGSEGV); sigdelset(&sigs, SIGBUS); sigdelset(&sigs, SIGABRT); sigdelset(&sigs, SIGIOT); sigdelset(&sigs, SIGTRAP); sigdelset(&sigs, SIGSYS); pthread_sigmask(SIG_SETMASK, &sigs, &oldsigs); DEBUG("NS-Main-Start1\n"); try { while (true) { DEBUG("NS-Main-Loop\n"); Buffer b = nextPacket(); if (quitRequested) { DEBUG("NS-Main-QUIT0\n"); return 0; } DEBUG("NS-Main-GotPacket\n"); if (libnet_write_link(ln_context, (u_char*)b.data(), b.size()) == -1) throw wibble::exception::Libnet(ln_context, "writing raw ethernet packet"); DEBUG("NS-Main-Written\n"); //fprintf(stderr, "Sent packet\n"); } } catch (std::exception& e) { error("%s. Quitting NetSender thread.\n", e.what()); } DEBUG("NS-Main-Quit\n"); return 0; } } // vim:set ts=4 sw=4: guessnet-0.55/src/util/packetmaker.cc0000644000000000000000000001577311770705652014557 0ustar #include "util/packetmaker.h" #include "util/netsender.h" extern "C" { #include } using namespace wibble::sys; namespace util { static Buffer buffer_from_libnet(libnet_t* ln_context) { // Construct the packet u_char* buf; u_int32_t len; libnet_adv_cull_packet(ln_context, &buf, &len); Buffer pkt(buf, len, false); // Waiting for libnet 1.2... // FIXME: we HAVE libnet 1.2! //libnet_adv_free_packet(ln_context, buf); // In the meantime... if (ln_context->aligner > 0) buf -= ln_context->aligner; free(buf); libnet_clear_packet(ln_context); return pkt; } Buffer PacketMaker::makeARPRequest(const IPAddress& ip, const IPAddress& src) { NetSender& sender = NetSender::get(); unsigned char ether_broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; //unsigned char ether_no_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; struct libnet_ether_addr* localmac = sender.getMACAddress(); libnet_t* ln_context = sender.getLibnetContext(); // Build the pieces of the packet libnet_build_arp ( ARPHRD_ETHER, ETHERTYPE_IP, ETHER_ADDR_LEN, 4, ARPOP_REQUEST, localmac->ether_addr_octet, (u_char *)src.s_addr_p(), // FIXME: what's in here? The broadcast addr maybe? ether_broadcast_addr, (u_char *)ip.s_addr_p(), NULL, 0, ln_context, 0); libnet_build_ethernet ( ether_broadcast_addr, localmac->ether_addr_octet, ETHERTYPE_ARP, NULL, 0, ln_context, 0); // Construct the packet return buffer_from_libnet(ln_context); } Buffer PacketMaker::makePingRequest(const ether_addr& mac, const IPAddress& src) { NetSender& sender = NetSender::get(); //unsigned char ether_broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; //unsigned char ether_no_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; struct libnet_ether_addr* localmac = sender.getMACAddress(); libnet_t* ln_context = sender.getLibnetContext(); int id = rand(); IPAddress noaddr("0.0.0.0"); // Build the pieces of the packet /* libnet_build_arp ( ARPHRD_ETHER, ETHERTYPE_IP, ETHER_ADDR_LEN, 4, ARPOP_REVREQUEST, localmac->ether_addr_octet, (u_char *)src.s_addr_p(), // FIXME: what's in here? The broadcast addr maybe? (u_char *)&mac, (u_char *)noaddr.s_addr_p(), NULL, 0, ln_context, 0); */ if (libnet_build_icmpv4_echo( ICMP_ECHO, // type 0, // code 0, // checksum id, // id 0, // seq NULL, // payload 0, // payload len ln_context, 0) == -1) throw wibble::exception::Libnet(ln_context, "Building ICMPv4 echo packet"); if (libnet_build_ipv4( LIBNET_IPV4_H + LIBNET_ICMPV4_ECHO_H + 0, 0, // ToS id, // id 0, // frag 64, // ttl IPPROTO_ICMP, 0, // checksum src.s_addr(), // Source IP 0xffffffff, // Destination IP NULL, // payload 0, ln_context, 0) == -1) throw wibble::exception::Libnet(ln_context, "Building IPv4 packet"); if (libnet_build_ethernet( (u_char*)&mac, localmac->ether_addr_octet, ETHERTYPE_IP, NULL, 0, ln_context, 0) == -1) throw wibble::exception::Libnet(ln_context, "Building Ethernet packet"); // Construct the packet return buffer_from_libnet(ln_context); } Buffer PacketMaker::makeDHCPRequest() { NetSender& sender = NetSender::get(); unsigned char ether_broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; //unsigned char ether_no_addr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; struct libnet_ether_addr* localmac = sender.getMACAddress(); libnet_t* ln_context = sender.getLibnetContext(); // Packet building taken from dhcp_discover libnet example u_char options_req[] = { LIBNET_DHCP_SUBNETMASK , LIBNET_DHCP_BROADCASTADDR , LIBNET_DHCP_TIMEOFFSET , LIBNET_DHCP_ROUTER , LIBNET_DHCP_DOMAINNAME , LIBNET_DHCP_DNS , LIBNET_DHCP_HOSTNAME }; // Source and destination IP address for discovery u_long src_ip = 0; u_long dst_ip = 0xffffffff; // DHCP Options length const int wanted_options_len = 3 // Initial size + sizeof(options_req) + 2 // Options + 1; // Packet end const int options_len = wanted_options_len + LIBNET_DHCPV4_H < LIBNET_BOOTP_MIN_LEN ? LIBNET_BOOTP_MIN_LEN - LIBNET_DHCPV4_H : wanted_options_len; // build options packet int i = 0; u_char* options = new u_char[options_len]; bzero(options, options_len); // we are a discover packet options[i++] = LIBNET_DHCP_MESSAGETYPE; // type options[i++] = 1; // len options[i++] = LIBNET_DHCP_MSGDISCOVER; // data // we are going to request some parameters options[i++] = LIBNET_DHCP_PARAMREQUEST; // type options[i++] = sizeof(options_req); // len memcpy(options + i, options_req, sizeof(options_req)); // data i += sizeof(options_req); /* // if we have an ip already, let's request it. if (src_ip) { orig_len = options_len; options_len += 2 + sizeof(src_ip); // workaround for realloc on old machines options = realloc(options, options_len); options[i++] = LIBNET_DHCP_DISCOVERADDR; // type options[i++] = sizeof(src_ip); // len memcpy(options + i, (char *)&src_ip, sizeof(src_ip));// data i += sizeof(src_ip); } */ // end our options packet options[i++] = LIBNET_DHCP_END; // Build the DHCP request packet libnet_build_dhcpv4( LIBNET_DHCP_REQUEST, // opcode 1, // hardware type ETHER_ADDR_LEN, // hardware address length 0, // hop count 0xdeadbeef, // transaction id 0, // seconds since bootstrap 0x8000, // flags 0, // client ip 0, // your ip 0, // server ip 0, // gateway ip localmac->ether_addr_octet, // client hardware addr NULL, // server host name NULL, // boot file options, // dhcp options stuck in payload since it is dynamic options_len, // length of options ln_context, // libnet handle 0); // libnet id // wrap in UDP libnet_build_udp( 68, // source port 67, // destination port LIBNET_UDP_H + LIBNET_DHCPV4_H + options_len, // packet size 0, // checksum NULL, // payload 0, // payload size ln_context, // libnet handle 0); // libnet id // then in IPv4 libnet_build_ipv4( LIBNET_IPV4_H + LIBNET_UDP_H + LIBNET_DHCPV4_H + options_len, // length 0x10, // TOS 0, // IP ID 0, // IP Frag 16, // TTL IPPROTO_UDP, // protocol 0, // checksum src_ip, // src ip dst_ip, // destination ip NULL, // payload 0, // payload size ln_context, // libnet handle 0); // libnet id // we can just autobuild since we arent doing anything tricky libnet_autobuild_ethernet( ether_broadcast_addr, // ethernet destination ETHERTYPE_IP, // protocol type ln_context); // libnet handle // Construct the packet return buffer_from_libnet(ln_context); } } // vim:set ts=4 sw=4: guessnet-0.55/src/util/packetmaker.h0000644000000000000000000000100511770705652014400 0ustar #ifndef GUESSNET_UTIL_PACKET_MAKER_H #define GUESSNET_UTIL_PACKET_MAKER_H #include #include "nettypes.h" namespace util { struct PacketMaker { static wibble::sys::Buffer makeARPRequest(const IPAddress& ip, const IPAddress& src); static wibble::sys::Buffer makeARPRequest(const ether_addr& mac, const IPAddress& src); static wibble::sys::Buffer makePingRequest(const ether_addr& mac, const IPAddress& src); static wibble::sys::Buffer makeDHCPRequest(); }; } // vim:set ts=4 sw=4: #endif guessnet-0.55/src/util/processrunner.cc0000644000000000000000000001576711770705652015203 0ustar /* * Run scripts in parallel * * Copyright (C) 2003--2007 Enrico Zini * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "processrunner.h" #include "starter.h" #include "util/output.h" #include #include #include // pid_t #include // wait #include #include #include using namespace std; using namespace wibble::sys; using namespace util; static ProcessRunner* instance = 0; ProcessRunner& ProcessRunner::get() { if (!instance) { instance = new ProcessRunner; Starter::get().add(instance); } return *instance; } void ProcessRunner::reset() { if (instance) { delete instance; instance = 0; } } namespace processrunner { /** * ChildProcess used to run a script in the background */ class Script : public ChildProcess { protected: string tag; vector env; string cmdline; public: Script(const std::string& tag, const std::vector& env, const std::string& cmdline) throw () : tag(tag), env(env), cmdline(cmdline) {} virtual ~Script() throw () {} virtual int main(); }; int Script::main() { try { ShellCommand cmd(cmdline); cmd.envFromParent = false; std::copy(env.begin(), env.end(), back_inserter(cmd.env)); #if 0 cmd.env.push_back("NAME=" + tag); cmd.env.push_back("IFACE=" + iface); cmd.env.push_back("GUESSNET=true"); cmd.env.push_back(string("PATH=") + SCRIPTDIR + ":/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"); #endif //debug("SCRIPT MAIN Running %s\n", cmdline.c_str()); cmd.exec(); } catch (std::exception& e) { error("%s\n", e.what()); } return 1; } ProcData::ProcData( const string& tag, const string& cmdline, const std::vector& env, ProcessListener* listener) : tag(tag), listener(listener) { script = new Script(tag, env, cmdline); } void ProcData::run() { script->fork(); } } ProcessRunner::ProcessRunner() : requested_shutdown(false), running(false) { } ProcessRunner::~ProcessRunner() { if (running) shutdown(); } void ProcessRunner::addProcess( const std::string& tag, const std::string& cmdline, const std::vector& env, ProcessListener* pl) { { MutexLock lock(listenersMutex); queuedForRunning.push(processrunner::ProcData(tag, cmdline, env, pl)); listenersCond.broadcast(); debug("PRI added process %s: %s\n", tag.c_str(), cmdline.c_str()); } } void ProcessRunner::shutdown() { if (running) { { MutexLock lock(listenersMutex); requested_shutdown = true; debug("PRI asked for shutdown\n"); } // FIXME: if someone has a cleaner ideas... //kill(SIGCHLD); /* cancel(); */ join(); running = false; } } void* ProcessRunner::main() { using namespace processrunner; running = true; // FIXME: Whatever the man pages tell about wait, it seems that all // process handling needs to be done in the same thread. With the bad // consequence that we can't use wait to sleep, since we have to keep track // of other things happening >:-((( // The wait(2) manpage states that wait should also wait for the children // of other threads with 2.4 kernels, but I have 2.4.20 and it didn't seem // to work (or I had other problems and made a wrong observation). // Let the signals be caught by some other process sigset_t sigs, oldsigs; sigfillset(&sigs); sigdelset(&sigs, SIGFPE); sigdelset(&sigs, SIGILL); sigdelset(&sigs, SIGSEGV); sigdelset(&sigs, SIGBUS); sigdelset(&sigs, SIGABRT); sigdelset(&sigs, SIGIOT); sigdelset(&sigs, SIGTRAP); sigdelset(&sigs, SIGSYS); // Don't block sigchld: we need it //sigdelset(&sigs, SIGCHLD); pthread_sigmask(SIG_SETMASK, &sigs, &oldsigs); map proclist; while (true) { debug("PRI Main Loop\n"); bool want_shutdown = false; try { { // Wait for some child process to be run MutexLock lock(listenersMutex); debug("PRI Check Requested Shutdown\n"); if (requested_shutdown) { debug("PRI Requested Shutdown\n"); want_shutdown = true; requested_shutdown = false; } else { debug("PRI Run queued processes\n"); while (!queuedForRunning.empty()) { debug("PRI Run a queued process\n"); ProcData d = queuedForRunning.front(); queuedForRunning.pop(); d.run(); proclist.insert(make_pair(d.script->pid(), d)); //debug("run process %s pid: %d\n", d.tag.c_str(), d.script->pid()); } } } if (want_shutdown) { debug("PRI Perform shutdown\n"); //debug("Requested shutdown\n"); for (map::iterator i = proclist.begin(); i != proclist.end(); i++) { debug("PRI Perform shutdown of %s\n", i->second.tag.c_str()); //debug("still running: %s (%d)\n", i->second.tag.c_str(), i->second.script->pid()); i->second.script->kill(9); i->second.script->wait(); delete i->second.script; debug("PRI Performed shutdown of %s\n", i->second.tag.c_str()); } proclist.clear(); debug("PRI Performed shutdown\n"); return 0; } //fprintf(stderr, "There are %d processes\n", proclist.size()); debug("PRI Checking Children\n"); pid_t pid = 0; int status; if (!proclist.empty()) pid = waitpid(-1, &status, WNOHANG); //debug("Wait gave %d\n", pid); if (pid == -1) throw wibble::exception::System("Waiting for a child to terminate"); if (pid == 0) { /* sigset_t wsigs; sigemptyset(&wsigs); sigaddset(&wsigs, SIGCHLD); int sig; debug("sigwaiting\n"); sigwait(&wsigs, &sig); debug("sigwaited\n"); */ struct timespec sleep_time = { 0, 100000000 }; nanosleep(&sleep_time, 0); } else { //debug("Process %d has terminated\n", pid); map::iterator i = proclist.find(pid); if (i == proclist.end()) { stringstream str; str << "Child pid " << pid << " exited, but has not been found in the child pid list"; throw wibble::exception::Consistency(str.str()); } //debug("Notifying termination of %s\n", i->second.tag.c_str()); string tag = i->second.tag; // Notify the listener i->second.listener->handleTermination(tag, status); // Remove the process from the proclist delete i->second.script; proclist.erase(i); } } catch (std::exception& e) { error("%s\n", e.what()); } } } // vim:set ts=4 sw=4: guessnet-0.55/src/util/processrunner-tut.cc0000644000000000000000000000533311770705652016001 0ustar /* * Copyright (C) 2007 Enrico Zini * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "tests/test-utils.h" #include "processrunner.h" #include #include #include #include #include #include namespace tut { using namespace std; using namespace util; struct util_processrunner_shar { util_processrunner_shar() { //util::Output::get().debug(true); Starter::get().reset(); ProcessRunner::reset(); } }; TESTGRP(util_processrunner); struct TestListener : public ProcessListener { protected: wibble::sys::Mutex mutex; string m_tag; int m_status; bool m_fired; public: TestListener() : m_status(-1), m_fired(false) {}; void handleTermination(const std::string& tag, int status) { wibble::sys::MutexLock lock(mutex); m_tag = tag; m_status = status; m_fired = true; } string tag() { wibble::sys::MutexLock lock(mutex); return m_tag; } int status() { wibble::sys::MutexLock lock(mutex); return m_status; } bool fired() { wibble::sys::MutexLock lock(mutex); return m_fired; } }; // Check that simple key = val items are parsed correctly template<> template<> void to::test<1>() { TestListener ltrue, lfalse; vector env; Starter& s = Starter::get(); // Start everything s.start(); // We can add after starting, it will work nicely ProcessRunner::get().addProcess("true", "/bin/true", env, <rue); ProcessRunner::get().addProcess("false", "/bin/false", env, &lfalse); // Wait at most 3 seconds until all processes terminate unsigned maxwait; for (maxwait = 30; !ltrue.fired() && !lfalse.fired() && maxwait > 0; --maxwait) usleep(100000); // Check that we didn't time out ensure(maxwait > 0); // Check that we got the right information to the listeners ensure_equals(ltrue.tag(), "true"); ensure_equals(ltrue.status(), 0); ensure_equals(lfalse.tag(), "false"); int status = lfalse.status(); ensure(WIFEXITED(status)); ensure(WEXITSTATUS(status) != 0); s.stop(); } } // vim:set ts=4 sw=4: guessnet-0.55/src/util/starter.h0000644000000000000000000000357611770705652013614 0ustar #ifndef GUESSNET_UTIL_STARTER_H #define GUESSNET_UTIL_STARTER_H /* * Coordinate starting and stopping of subsystems * * Copyright (C) 2007 Enrico Zini * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include namespace util { /** * Interface for subsystems that can be started and stopped */ struct Startable { virtual ~Startable() {} virtual void startableStart() = 0; virtual void startableStop() = 0; }; class Starter { std::map< unsigned, std::list > members; bool started; Starter(); public: /** * Add a Startable to be started and stopped by this Starter. * * If start() has already been called, the Started will also be started. */ void add(Startable* s, unsigned prio = std::numeric_limits::max()); /** * Start all the Startables, in increasing priority order */ void start(); /** * Stop all the Startables, in the opposite order as start */ void stop(); /** * Remove all the Startables from the Starter. * * If they are running, they are stopped before removal. */ void reset(); /** * Singleton access instance */ static Starter& get(); }; } // vim:set ts=4 sw=4: #endif guessnet-0.55/src/util/starter.cc0000644000000000000000000000430211770705652013736 0ustar /* * Coordinate starting and stopping of subsystems * * Copyright (C) 2007 Enrico Zini * * Interface configuration routines are adapted from * Laptop-net, Copyright 2002 Massachusetts Institute of Technology * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "util/starter.h" #include "util/output.h" using namespace std; namespace util { static Starter* instance = 0; Starter& Starter::get() { if (!instance) instance = new Starter; return *instance; } Starter::Starter() : started(false) { } void Starter::add(Startable* s, unsigned prio) { debug("Added startable with priority %u\n", prio); members[prio].push_back(s); if (started) { debug("Starting right away regardless of priority\n"); s->startableStart(); } } void Starter::start() { debug("Starting all %d startables\n", members.size()); for (map< unsigned, list >::const_iterator i = members.begin(); i != members.end(); ++i) { debug("Starting elements with priority %u\n", i->first); for (list::const_iterator j = i->second.begin(); j != i->second.end(); ++j) (*j)->startableStart(); } started = true; } void Starter::stop() { for (map< unsigned, list >::const_reverse_iterator i = members.rbegin(); i != members.rend(); ++i) for (list::const_reverse_iterator j = i->second.rbegin(); j != i->second.rend(); ++j) (*j)->startableStop(); started = false; } void Starter::reset() { if (started) stop(); members.clear(); } } // vim:set ts=4 sw=4: guessnet-0.55/src/util/netwatcher.h0000644000000000000000000000606611770705652014271 0ustar #ifndef GUESSNET_UTIL_NETWATCHER_H #define GUESSNET_UTIL_NETWATCHER_H /* * Thread to capture packets from a network * * Copyright (C) 2003--2007 Enrico Zini * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "nettypes.h" #include "util/starter.h" #include #include struct pcap; typedef struct pcap pcap_t; struct libnet_link_int; namespace wibble { namespace exception { class Pcap : public Generic { protected: std::string _pcap_errmsg; public: Pcap(const std::string& pcap_errmsg, const std::string& context) throw () : Generic(context), _pcap_errmsg(pcap_errmsg) {} Pcap(const std::string& context) throw () : Generic(context), _pcap_errmsg() {} ~Pcap() throw () {} virtual const char* type() const throw () { return "pcap"; } virtual std::string desc() const throw () { if (_pcap_errmsg.size()) return _pcap_errmsg; else return "Unknown pcap error"; } }; } } namespace util { class PacketListener { public: virtual ~PacketListener() {} virtual void handleARP(const wibble::sys::NetBuffer& pkt) {} virtual void handleDHCP(const wibble::sys::NetBuffer& pkt) {} virtual void handleICMP(const wibble::sys::NetBuffer& pkt) {} virtual void handleEthernet(const wibble::sys::NetBuffer& pkt) {} }; /* * Injects ethernet packets to a given interface. * * Every method is thread-safe */ class NetWatcher : public wibble::sys::Thread, public util::Startable { protected: static const int captureSize; std::string iface; pcap_t *pcap_interface; bool _canceled; wibble::sys::Mutex listenersMutex; std::list listeners_arp; std::list listeners_ethernet; std::list listeners_dhcp; std::list listeners_icmp; struct libnet_link_int* link_interface; virtual void* main(); NetWatcher(const std::string& iface); public: ~NetWatcher(); void shutdown(); struct ether_addr* getMACAddress(); void addARPListener(PacketListener* pl); void addDHCPListener(PacketListener* pl); void addICMPListener(PacketListener* pl); void addEthernetListener(PacketListener* pl); void startableStart(); void startableStop() { shutdown(); } static void configure(const std::string& iface); static NetWatcher& get(); }; } // vim:set ts=4 sw=4: #endif guessnet-0.55/src/util/processrunner.h0000644000000000000000000000601211770705652015024 0ustar #ifndef GUESSNET_UTIL_PROCESS_RUNNER_H #define GUESSNET_UTIL_PROCESS_RUNNER_H /* * Run scripts in parallel * * Copyright (C) 2003--2007 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "starter.h" #include #include #include class ProcessListener { public: virtual ~ProcessListener() {} virtual void handleTermination(const std::string& tag, int status) {} }; namespace processrunner { class Script; /** * Information that we keep about a process */ struct ProcData { std::string tag; processrunner::Script* script; ProcessListener* listener; ProcData( const std::string& tag, const std::string& cmdline, const std::vector& env, ProcessListener* listener); void run(); }; } /* * Injects ethernet packets to a given interface. * * Every method is thread-safe */ class ProcessRunner : public util::Startable, public wibble::sys::Thread { protected: wibble::sys::Mutex listenersMutex; wibble::sys::Condition listenersCond; std::queue queuedForRunning; bool requested_shutdown; bool running; virtual void* main(); ProcessRunner(); public: ~ProcessRunner(); /** * Enqueue a process for running. * * Tag is a tag that will be notified to the listener * Cmdline is a string with the command line to run. It will be run using "sh -c" * Env is a list of "VAR=value" that defines the environment. No * environment variables are copied from the parent process. */ void addProcess(const std::string& tag, const std::string& cmdline, const std::vector& env, ProcessListener* pl); void shutdown(); virtual void startableStart() { start(); /* start the thread */ } virtual void startableStop() { shutdown(); } /** * Get the singleton ProcessRunner instance. * * The instance is automatically registered with the starter. */ static ProcessRunner& get(); /** * Reset the singleton instance. * * This is useful only for the tests, that may need to test registering the * processrunner with a starter multiple times. * * Note that this *must* follow a reset of the Starter, otherwise the * starter will be left with a dangling pointer. */ static void reset(); }; // vim:set ts=4 sw=4: #endif guessnet-0.55/src/util/netwatcher.cc0000644000000000000000000001465211770705652014427 0ustar /* * Thread to capture packets from a network * * Copyright (C) 2003--2007 Enrico Zini * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "util/netwatcher.h" #include "util/output.h" #include #include extern "C" { #include #include } #include #include #include // ntohs, htons, ... using namespace std; using namespace wibble::sys; namespace util { static NetWatcher* instance = 0; static bool requested = false; void NetWatcher::configure(const std::string& iface) { if (instance) { delete instance; instance = 0; } instance = new NetWatcher(iface); } NetWatcher& NetWatcher::get() { if (!requested) { // Don't start unless something needs it util::Starter::get().add(instance, 100); requested = true; } return *instance; } const int NetWatcher::captureSize = LIBNET_ETH_H + \ (LIBNET_ARP_H > LIBNET_IPV4_H ? LIBNET_ARP_H : LIBNET_IPV4_H) + \ (LIBNET_UDP_H > ICMP_ECHO ? LIBNET_UDP_H : ICMP_ECHO) + 300; NetWatcher::NetWatcher(const string& iface) : iface(iface), pcap_interface(0), _canceled(false) { } NetWatcher::~NetWatcher() { shutdown(); if (pcap_interface) pcap_close(pcap_interface); } void NetWatcher::startableStart() { char errbuf[PCAP_ERRBUF_SIZE]; // TODO: Try to use 1 from "promisc": maybe there won't be a need to setup an // address on the interface if (!(pcap_interface = pcap_open_live ( (char*)iface.c_str(), captureSize, 1, 1000, errbuf))) throw wibble::exception::Pcap (errbuf, "initializing pcap packet capture library"); return start(); } void NetWatcher::shutdown() { if (!_canceled) try { cancel(); join(); _canceled = true; } catch (wibble::exception::System& e) { warning("%s when shutting down NetWatcher\n", e.what()); } } void NetWatcher::addARPListener(PacketListener* pl) { MutexLock lock(listenersMutex); listeners_arp.push_back(pl); } void NetWatcher::addEthernetListener(PacketListener* pl) { MutexLock lock(listenersMutex); listeners_ethernet.push_back(pl); } void NetWatcher::NetWatcher::addDHCPListener(PacketListener* pl) { MutexLock lock(listenersMutex); listeners_dhcp.push_back(pl); } void NetWatcher::addICMPListener(PacketListener* pl) { MutexLock lock(listenersMutex); listeners_icmp.push_back(pl); } /* static void memdump(const string& prefix, unsigned char* mem, int size) throw () { warning("%.*s", PFSTR(prefix)); for (int i = 0; i < size; i++) { warning(" %02x", (int)mem[i]); } warning("\n"); } */ void* NetWatcher::main() { // Let the signals be caught by some other process sigset_t sigs, oldsigs; sigfillset(&sigs); sigdelset(&sigs, SIGFPE); sigdelset(&sigs, SIGILL); sigdelset(&sigs, SIGSEGV); sigdelset(&sigs, SIGBUS); sigdelset(&sigs, SIGABRT); sigdelset(&sigs, SIGIOT); sigdelset(&sigs, SIGTRAP); sigdelset(&sigs, SIGSYS); pthread_sigmask(SIG_SETMASK, &sigs, &oldsigs); try { while (true) { struct pcap_pkthdr* pcap_header; unsigned char* packet; int err = pcap_next_ex(pcap_interface, &pcap_header, (const u_char**)&packet); switch (err) { case 1: break; // ok case 0: continue; // timeout expired, try again default: throw wibble::exception::Pcap( pcap_geterr(pcap_interface), "getting a new packet from the network"); } NetBuffer pkt(packet, captureSize, false); MutexLock lock(listenersMutex); if (!listeners_ethernet.empty()) for (list::iterator i = listeners_ethernet.begin(); i != listeners_ethernet.end(); i++) (*i)->handleEthernet(pkt); const libnet_ethernet_hdr* packet_header = pkt.cast(); if (ntohs (packet_header->ether_type) == ETHERTYPE_ARP) { if (!listeners_arp.empty()) { // ARP packet NetBuffer arp = pkt.after(LIBNET_ETH_H); for (list::iterator i = listeners_arp.begin(); i != listeners_arp.end(); i++) (*i)->handleARP(arp); } } else if (ntohs (packet_header->ether_type) == ETHERTYPE_IP) { if (!(listeners_dhcp.empty() || listeners_icmp.empty())) { // IPv4 packet NetBuffer ipv4 = pkt.after(LIBNET_ETH_H); const libnet_ipv4_hdr* ipv4_header = ipv4.cast(); /* If needed again, add a memdump method to NetBuffer debug("--IP proto %d src %x dst %x len %d\n", (int)ipv4_header->ip_p, *(int*)&(ipv4_header->ip_src), *(int*)&(ipv4_header->ip_dst), (int)(ipv4_header->ip_hl*4)); memdump("IP: ", (unsigned char*)ipv4_header, (int)(ipv4_header->ip_hl*4) + LIBNET_UDP_H + 200); */ if (ipv4_header->ip_p == IPPROTO_UDP && *(uint32_t*)&(ipv4_header->ip_dst) == 0xffffffff) { // UDP packet NetBuffer udp = ipv4.after(ipv4_header->ip_hl*4); const libnet_udp_hdr* udp_header = udp.cast(); int sport = ntohs(udp_header->uh_sport); int dport = ntohs(udp_header->uh_dport); //memdump("UDP: ", (unsigned char*)udp_header, LIBNET_UDP_H + 20); //debug("---UDP %d->%d len %d\n", sport, dport, ntohs(udp_header->uh_ulen)); if (sport == 67 && dport == 68) { //debug("----DHCP\n"); // DHCP packet NetBuffer dhcp = udp.after(LIBNET_UDP_H); for (list::iterator i = listeners_dhcp.begin(); i != listeners_dhcp.end(); i++) (*i)->handleDHCP(dhcp); } } else if (ipv4_header->ip_p == IPPROTO_ICMP) { // ICMP packet NetBuffer icmp = ipv4.after(ipv4_header->ip_hl*4); for (list::iterator i = listeners_icmp.begin(); i != listeners_icmp.end(); i++) (*i)->handleICMP(icmp); } } } } } catch (std::exception& e) { error("%s. Quitting NetWatcher thread.\n", e.what()); } return 0; } } // vim:set ts=4 sw=4: guessnet-0.55/src/util/output.h0000644000000000000000000000441511770705652013461 0ustar #ifndef GUESSNET_UTIL_OUTPUT_H #define GUESSNET_UTIL_OUTPUT_H /* * Verbose/debug output functions * * Copyright (C) 2003--2007 Enrico Zini * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include namespace util { class Output { // True when operations should be verbose bool _verbose; // True when operations should be very verbose bool _debug; // True when debugging messages should be sent to syslog bool _syslog; Output() throw (); public: static Output& get() throw (); bool verbose() const throw () { return _verbose; } bool verbose(bool verbose) throw () { return _verbose = verbose; } bool debug() const throw () { return _debug; } bool debug(bool debug) throw () { // Debug implies verbose if (debug) _verbose = true; return _debug = debug; } bool syslog() const throw () { return _syslog; } bool syslog(bool syslog) throw () { // Initialize syslog support, if needed openlog("guessnet", LOG_PID, LOG_DAEMON); return _syslog = syslog; } }; } // Commodity output functions #ifndef ATTR_PRINTF #ifdef GCC #define ATTR_PRINTF(string, first) __attribute__((format (printf, string, first))) #else #define ATTR_PRINTF(string, first) #endif #endif void fatal_error(const char* fmt, ...) ATTR_PRINTF(1, 2); void error(const char* fmt, ...) ATTR_PRINTF(1, 2); void warning(const char* fmt, ...) ATTR_PRINTF(1, 2); // Normal output to stdout void output(const char* fmt, ...) ATTR_PRINTF(1, 2); void verbose(const char* fmt, ...) ATTR_PRINTF(1, 2); void debug(const char* fmt, ...) ATTR_PRINTF(1, 2); // vim:set ts=4 sw=4: #endif guessnet-0.55/compile0000755000000000000000000000727111770705722011563 0ustar #! /bin/sh # Wrapper for compilers which do not understand `-c -o'. scriptversion=2009-10-06.20; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software # Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand `-c -o'. Remove `-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file `INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; esac ofile= cfile= eat= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as `compile cc -o foo foo.c'. # So we strip `-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no `-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # `.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use `[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: guessnet-0.55/examples/0000755000000000000000000000000011770705652012016 5ustar guessnet-0.55/examples/getmac0000644000000000000000000000441511770705652013205 0ustar #!/usr/bin/perl -w # (C) Copyright 2001 Enrico Zini # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # # This script prints the macaddres of the network interface correspoding to the # given address. use strict; # Print usage informations and exit sub usage () { print qq{Usage: $0 [interface] Print the macaddress corresponding to the network interface of the address , reached through network interface [interface]. If omitted, [interface] defaults to 'eth0' }; exit 1; } # Notify that the MAC was not found. Prints a message only if running # interactive. sub notfound (@) { (-t STDOUT) && print @_, "\n"; exit 1; } # Paths to the commands we use (they are not in users path by default) my $arp = '/usr/sbin/arp'; my $arping = '/usr/bin/arping'; # Get commandline options my $host = shift @ARGV or usage(); my $interface = (shift @ARGV or 'eth0'); # # First try using arp -a to see if we have it cached # (more efficient, no network output) # open (IN, "$arp -a '$host'|") or die "Can't run $arp: $!"; while () { if (/at (\S+) .+ on $interface/ && $1 ne '') { print "$1\n"; exit 0; } } close (IN); notfound("No match for $host with $arp through $interface, and $arping not found") if not -x $arping; # # No match with arp, let's try to discover it with arping # (We use the iputils-arping version of arping here.) # open (IN, "$arping -f -c 1 -w 3 -I $interface '$host'|") or die "Can't run $arping: $!"; while () { if (/\[([^]]+)\]/) { print "$1\n"; exit 0; } } notfound("No match for $host with neither $arp nor $arping through $interface"); guessnet-0.55/examples/interfaces0000644000000000000000000000616211770705652014071 0ustar # NOTE: this file presents a few configurations in order to show various # applications of guessnet options. Do not use it as-is, just take some # hints and write your own. This file is not guaranteed to work as-is, # and it probably won't anyway. :P auto lo iface lo inet loopback auto eth0 mapping eth0 script /usr/sbin/guessnet-ifupdown # List of stanzas guessnet should scan for # If none is specified, scans for all stanzas #map home work map default: dhcp map timeout: 3 map verbose: true # Home network configuration iface home inet static address 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.1 dns-search home.loc dns-nameservers 192.168.1.1 # Check for one of these hosts: test1-peer address 192.168.1.1 mac 00:01:02:03:04:05 test2-peer address 192.168.1.3 mac 00:01:02:03:04:06 # Work network configuration iface work inet static address 10.1.1.42 netmask 255.255.255.0 broadcast 10.1.1.255 gateway 10.1.1.1 dns-search work.loc dns-nameservers 10.1.1.1 # the other guessnet scan: test-command /usr/local/bin/check_work # Second job network configuration iface work2 inet static address 192.168.2.23 netmask 255.255.255.0 broadcast 192.168.2.255 gateway 192.168.2.1 dns-search work2.loc dns-nameservers 192.168.2.1 # Specify a source address in case the peer doesn't reply to # ARP packets coming from 0.0.0.0 test-peer address 192.168.2.1 mac 00:01:02:03:04:05 source 192.168.2.23 # PPPOE network configuration iface pppoe inet ppp test pppoe # It could also be: #test-pppoe please # I'd really appreciate a 'disabled' method for iface (#275326) iface interface inet manual test missing-cable pre-up echo No link present. pre-up false # guessnet default iface none inet dhcp # Example configuration for a wireless card, named eth1 # Here we're using the new autofilter option to identify "valid" profiles # depending on their name. auto eth1 mapping eth1 script /usr/sbin/guessnet-ifupdown # We don't want to automatically connect to every open network. # To change this behaviour, just comment the line below or issue # ifup eth1=eth1-auto manually map !eth1-auto map autofilter: true # Since this is a wireless interface, we prefer not to a have a # catchall stanza, so we don't specify any "default:" option. iface eth1-home inet dhcp test wireless essid HomeNet wireless-essid HomeNet wireless-key s:MyVeryOwnPwd iface eth1-work inet dhcp test wireless essid WorkNet # At work they use wpa auth for wireless, so we have to use # wpa_supplicant in order to associate with wireless network wpa-ssid WorkNet # Passkey generated with wpa_passphrase wpa-psk ffecc9dc25716243282643026cdae436231fdd1a757beb948c1a10cf2fafa109 # Eventually, we could use plaintext, such as # wpa-psk MySecretKey # Following stanza will never be matched since we are using !eth1-auto # directive in guessnet mapping. Useful if we want to enable it on # permanent basis or to be called manually like ifup eth1=eth1-auto iface eth1-auto inet dhcp # Matches any open network (meaning wifi nets not using encryption) test wireless open wireless-essid any wireless-mode auto guessnet-0.55/examples/laptop-netconf0000644000000000000000000000646011770705652014700 0ustar #!/usr/bin/perl -w # (C) Copyright 2001 Enrico Zini # Based on laptop-netconf by Matt Kern # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # # This is a rewrite of laptop-netconf in perl using guessnet. # # This program should be an exact clone of laptop-netconf, using the same # configuration files, having the same options, producing the same results. # # Please see the original laptop-netconf for documentation and examples. use IPC::Open2; my $cfgdir = '/etc/laptop-netconf'; my $cfgfile = $cfgdir.'/opts'; my $guessnet = '/usr/bin/guessnet'; # Read the config file from the given file sub readcfg ($) { my ($fname) = @_; (-e $fname) or die "$fname does not exist"; open(IN, "<$fname") or die "Can't read $fname: $!"; my %cfg; while() { # Skip empty lines and comments next if (/^\s*(?:#.*)?$/); if (/^\s*debug\s*(?:#.*)?$/) { $cfg{debug} = 1; } elsif (/^\s*device\s+(\w+)\s*(?:#.*)?$/) { $cfg{device} = $1; } elsif (/^\s* host\s+((?:\d{1,3}\.){3}\d{1,3})\s+ probe\s+((?:\d{1,3}\.){3}\d{1,3})\s+ hwaddress\s+((?:[0-9A-Fa-f]{2}\:){5}[0-9A-Fa-f]{2})\s+ profile\s+(\w+)\s*(?:\#.*)?$/x) { $cfg{hosts}{$4} = { host => $1, probe => $2, hwaddr => $3, profile => $4 }; } else { die "Syntax error on line $. of $fname"; } } close(IN); $cfg{device} = 'eth0' if not defined $cfg{device}; die "No hosts found in config file $fname" if ! %{$cfg{hosts}}; return \%cfg; } # Return the current network profile as found by guessnet, using the given # configuration sub guessnet ($) { my ($cfg) = @_; my ($rd, $wr); my @invoc = ($guessnet, '-d', 'default'); push(@invoc, '-v') if ($cfg->{debug}); push(@invoc, $cfg->{device}); print STDERR "Invoking `", join(' ', @invoc), "' with input:\n" if ($cfg->{debug}); $pid = open2($rd, $wr, @invoc); for my $prof (keys %{$cfg->{hosts}}) { my $h = $cfg->{hosts}{$prof}; printf $wr "%s %s %s %s\n", $h->{host}, $h->{hwaddr}, $h->{probe}, $h->{profile}; printf STDERR "%s %s %s %s\n", $h->{host}, $h->{hwaddr}, $h->{probe}, $h->{profile} if ($cfg->{debug}); } close($wr); my $profile = <$rd>; chomp($profile); close($rd); waitpid($pid, 0); die "guessnet invocation was not successful" if $? == 256; die "guessnet exited with unknown status $?" if $? != 0; return $profile; } my $cfg = readcfg($cfgfile); my $profile = guessnet($cfg); print STDERR "Selected profile: $profile\n" if $cfg->{debug}; my $cmd = "$cfgdir/$profile"; my $arg = $cfg->{hosts}{$profile}{host}; print STDERR "Executing `$cmd $arg'\n" if $cfg->{debug}; # Exec already complains on its own exec $cmd, $arg or exit 1; exit 0; guessnet-0.55/examples/README0000644000000000000000000000140711770705652012700 0ustar README file for the guessnet examples ===================================== I've tried to reimplement using guessnet the other network detection tools found in Debian. Here are the results: * laptop-netconf guessnet was derived from laptop-netconf and should fully implement the latter's features. * divine and intuitively Implementing all their features is not yet possible because they allow checking for IP addresses without ensuring that the adapters that have those addresses have certain MAC addresses. This check method is not currently supported by guessnet and I don't plan to add it unless I receive explicit requests to do so. I've included the getmac script to easily get the macaddress for a given remote network interface. guessnet-0.55/Makefile.in0000644000000000000000000006310011770705723012244 0ustar # Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL TODO \ compile depcomp install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' man8dir = $(mandir)/man8 am__installdirs = "$(DESTDIR)$(man8dir)" NROFF = nroff MANS = $(man_MANS) $(nodist_man_MANS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d "$(distdir)" \ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr "$(distdir)"; }; } am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ IFCONFIG = @IFCONFIG@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBNET_CFLAGS = @LIBNET_CFLAGS@ LIBNET_CONFIG = @LIBNET_CONFIG@ LIBNET_LIBS = @LIBNET_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBWIBBLE_CFLAGS = @LIBWIBBLE_CFLAGS@ LIBWIBBLE_LIBS = @LIBWIBBLE_LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SH = @SH@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ scriptdir = @scriptdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src scripts tests man_MANS = guessnet.8 guessnet-scan.8 nodist_man_MANS = guessnet-ifupdown.8 EXTRA_DIST = $(man_MANS) autogen.sh testnets FAQ doc/Saner-Defaults-HOWTO \ examples/README examples/getmac examples/interfaces examples/laptop-netconf all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-man8: $(man_MANS) $(nodist_man_MANS) @$(NORMAL_INSTALL) test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)" @list=''; test -n "$(man8dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS) $(nodist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ done; } uninstall-man8: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man8dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS) $(nodist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man8dir)" && rm -f $$files; } # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(MANS) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(man8dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-man install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-man8 install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man8 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ clean-local ctags ctags-recursive dist dist-all dist-bzip2 \ dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-man8 \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-recursive uninstall uninstall-am uninstall-man \ uninstall-man8 guessnet-ifupdown.8: guessnet.8 ln -s guessnet.8 guessnet-ifupdown.8 FAQ.html: FAQ rst2html --no-doc-title --stylesheet=main.css $< > $@ web: FAQ.html scp $^ "alioth.debian.org:/org/alioth.debian.org/chroot/home/groups/guessnet/htdocs/" clean-local: -rm -f guessnet-ifupdown.8 FAQ.html # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: guessnet-0.55/configure0000755000000000000000000072016611770705721012120 0ustar #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for guessnet 0.54. # # Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and enrico@debian.org $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='guessnet' PACKAGE_TARNAME='guessnet' PACKAGE_VERSION='0.54' PACKAGE_STRING='guessnet 0.54' PACKAGE_BUGREPORT='enrico@debian.org' PACKAGE_URL='' ac_unique_file="configure.ac" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS IFCONFIG SH scriptdir LIBNET_CFLAGS LIBNET_LIBS LIBNET_CONFIG LIBWIBBLE_LIBS LIBWIBBLE_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG YFLAGS YACC LEXLIB LEX_OUTPUT_ROOT LEX RANLIB EGREP GREP CPP CXXCPP am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_libnet_config enable_dependency_tracking ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CXX CXXFLAGS CCC CXXCPP CPP YACC YFLAGS PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR LIBWIBBLE_CFLAGS LIBWIBBLE_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures guessnet 0.54 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/guessnet] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of guessnet 0.54:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-libnet-config=PFX Specify location of libnet-config Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor CPP C preprocessor YACC The `Yet Another Compiler Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. This script will default YFLAGS to the empty string to avoid a default value of `-d' given by some make applications. PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path LIBWIBBLE_CFLAGS C compiler flags for LIBWIBBLE, overriding pkg-config LIBWIBBLE_LIBS linker flags for LIBWIBBLE, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF guessnet configure 0.54 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_cxx_try_cpp LINENO # ------------------------ # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_cpp # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## -------------------------------- ## ## Report this to enrico@debian.org ## ## -------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by guessnet $as_me 0.54, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" am__api_version='1.11' 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 as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='guessnet' VERSION='0.54' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' LIBNET_CONFIG=no # Check whether --with-libnet-config was given. if test "${with_libnet_config+set}" = set; then : withval=$with_libnet_config; LIBNET_CONFIG=$withval fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= 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 -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #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; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 $as_echo_n "checking for library containing strerror... " >&6; } if ${ac_cv_search_strerror+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strerror (); int main () { return strerror (); ; return 0; } _ACEOF for ac_lib in '' cposix; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_strerror=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_strerror+:} false; then : break fi done if ${ac_cv_search_strerror+:} false; then : else ac_cv_search_strerror=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5 $as_echo "$ac_cv_search_strerror" >&6; } ac_res=$ac_cv_search_strerror if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if ${ac_cv_prog_cxx_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CXX_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 $as_echo_n "checking how to run the C++ preprocessor... " >&6; } if test -z "$CXXCPP"; then if ${ac_cv_prog_CXXCPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 $as_echo "$CXXCPP" >&6; } ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_cxx_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #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; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in unistd.h do : ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" if test "x$ac_cv_header_unistd_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UNISTD_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac if test "x$CC" != xcc; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 $as_echo_n "checking whether cc understands -c and -o together... " >&6; } fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if { ac_try='cc -c conftest.$ac_ext >&5' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -f conftest2.$ac_objext && { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # cc works too. : else # cc exists but doesn't like -o. eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fi else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi rm -f core conftest* fi if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h fi # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LEX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LEX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 $as_echo "$LEX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test "x$LEX" != "x:"; then cat >conftest.l <<_ACEOF %% a { ECHO; } b { REJECT; } c { yymore (); } d { yyless (1); } e { yyless (input () != 0); } f { unput (yytext[0]); } . { BEGIN INITIAL; } %% #ifdef YYTEXT_POINTER extern char *yytext; #endif int main (void) { return ! yylex () + ! yywrap (); } _ACEOF { { ac_try="$LEX conftest.l" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$LEX conftest.l") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 $as_echo_n "checking lex output file root... " >&6; } if ${ac_cv_prog_lex_root+:} false; then : $as_echo_n "(cached) " >&6 else if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 $as_echo "$ac_cv_prog_lex_root" >&6; } LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root if test -z "${LEXLIB+set}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 $as_echo_n "checking lex library... " >&6; } if ${ac_cv_lib_lex+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_LIBS=$LIBS ac_cv_lib_lex='none needed' for ac_lib in '' -lfl -ll; do LIBS="$ac_lib $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_lex=$ac_lib fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext test "$ac_cv_lib_lex" != 'none needed' && break done LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 $as_echo "$ac_cv_lib_lex" >&6; } test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 $as_echo_n "checking whether yytext is a pointer... " >&6; } if ${ac_cv_prog_lex_yytext_pointer+:} false; then : $as_echo_n "(cached) " >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no ac_save_LIBS=$LIBS LIBS="$LEXLIB $ac_save_LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define YYTEXT_POINTER 1 `cat $LEX_OUTPUT_ROOT.c` _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_prog_lex_yytext_pointer=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 $as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } if test $ac_cv_prog_lex_yytext_pointer = yes; then $as_echo "#define YYTEXT_POINTER 1" >>confdefs.h fi rm -f conftest.l $LEX_OUTPUT_ROOT.c fi if test "$LEX" = :; then LEX=${am_missing_run}flex fi for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_YACC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_YACC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 $as_echo "$YACC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBWIBBLE" >&5 $as_echo_n "checking for LIBWIBBLE... " >&6; } if test -n "$LIBWIBBLE_CFLAGS"; then pkg_cv_LIBWIBBLE_CFLAGS="$LIBWIBBLE_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libwibble >= 0.1.16\""; } >&5 ($PKG_CONFIG --exists --print-errors "libwibble >= 0.1.16") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBWIBBLE_CFLAGS=`$PKG_CONFIG --cflags "libwibble >= 0.1.16" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$LIBWIBBLE_LIBS"; then pkg_cv_LIBWIBBLE_LIBS="$LIBWIBBLE_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libwibble >= 0.1.16\""; } >&5 ($PKG_CONFIG --exists --print-errors "libwibble >= 0.1.16") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBWIBBLE_LIBS=`$PKG_CONFIG --libs "libwibble >= 0.1.16" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then LIBWIBBLE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libwibble >= 0.1.16" 2>&1` else LIBWIBBLE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libwibble >= 0.1.16" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBWIBBLE_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (libwibble >= 0.1.16) were not met: $LIBWIBBLE_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables LIBWIBBLE_CFLAGS and LIBWIBBLE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables LIBWIBBLE_CFLAGS and LIBWIBBLE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else LIBWIBBLE_CFLAGS=$pkg_cv_LIBWIBBLE_CFLAGS LIBWIBBLE_LIBS=$pkg_cv_LIBWIBBLE_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi #AC_CHECK_HEADER(libnet.h, AC_DEFINE(HAVE_LIBNET_H, 1, libnet.h has been found), # AC_MSG_ERROR([ #*** libnet.h not found. Check 'config.log' for more details.])) # #AC_CHECK_LIB(net, libnet_open_link_interface, x_libs="-lnet", # AC_MSG_ERROR([ #*** libnet not found. Check 'config.log' for more details.])) if test "$LIBNET_CONFIG" = "no" then # Extract the first word of "libnet-config", so it can be a program name with args. set dummy libnet-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_LIBNET_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $LIBNET_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_LIBNET_CONFIG="$LIBNET_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_LIBNET_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_LIBNET_CONFIG" && ac_cv_path_LIBNET_CONFIG="no" ;; esac fi LIBNET_CONFIG=$ac_cv_path_LIBNET_CONFIG if test -n "$LIBNET_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBNET_CONFIG" >&5 $as_echo "$LIBNET_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libnet libraries" >&5 $as_echo_n "checking for libnet libraries... " >&6; } if test "$LIBNET_CONFIG" != "no" then if ! $LIBNET_CONFIG --help > /dev/null 2>&1 then as_fn_error $? "Could not find libnet-config anywhere (see config.log for details)." "$LINENO" 5 fi LIBNET_LIBS="`$LIBNET_CONFIG --libs`" LIBNET_CFLAGS="`$LIBNET_CONFIG --cflags` `$LIBNET_CONFIG --defines`" { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 $as_echo "found" >&6; } else as_fn_error $? "No libnet-config was specified (see config.log for details)." "$LINENO" 5 fi fi ac_fn_c_check_header_mongrel "$LINENO" "pcap.h" "ac_cv_header_pcap_h" "$ac_includes_default" if test "x$ac_cv_header_pcap_h" = xyes; then : $as_echo "#define HAVE_PCAP_H 1" >>confdefs.h else as_fn_error $? " *** pcap.h not found. Check 'config.log' for more details." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcap_open_live in -lpcap" >&5 $as_echo_n "checking for pcap_open_live in -lpcap... " >&6; } if ${ac_cv_lib_pcap_pcap_open_live+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpcap $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pcap_open_live (); int main () { return pcap_open_live (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pcap_pcap_open_live=yes else ac_cv_lib_pcap_pcap_open_live=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcap_pcap_open_live" >&5 $as_echo "$ac_cv_lib_pcap_pcap_open_live" >&6; } if test "x$ac_cv_lib_pcap_pcap_open_live" = xyes; then : LIBS="-lpcap $LIBS" else as_fn_error $? " *** libpcap not found. Check 'config.log' for more details." "$LINENO" 5 fi ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" if test "x$ac_cv_header_pthread_h" = xyes; then : $as_echo "#define HAVE_PTHREAD_H 1" >>confdefs.h else as_fn_error $? " *** pthread.h not found. Check 'config.log' for more details." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_create=yes else ac_cv_lib_pthread_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : LIBS="-lpthread $LIBS" else as_fn_error $? " *** libpthread not found. Check 'config.log' for more details." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iw_scan in -liw" >&5 $as_echo_n "checking for iw_scan in -liw... " >&6; } if ${ac_cv_lib_iw_iw_scan+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-liw $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char iw_scan (); int main () { return iw_scan (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_iw_iw_scan=yes else ac_cv_lib_iw_iw_scan=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iw_iw_scan" >&5 $as_echo "$ac_cv_lib_iw_iw_scan" >&6; } if test "x$ac_cv_lib_iw_iw_scan" = xyes; then : LIBS="-liw $LIBS" else as_fn_error $? " *** libiw not found. Check 'config.log' for more details." "$LINENO" 5 fi scriptdir="$datadir/$PACKAGE/test" # Extract the first word of "sh", so it can be a program name with args. set dummy sh; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_SH+:} false; then : $as_echo_n "(cached) " >&6 else case $SH in [\\/]* | ?:[\\/]*) ac_cv_path_SH="$SH" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_SH="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi SH=$ac_cv_path_SH if test -n "$SH"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SH" >&5 $as_echo "$SH" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi cat >>confdefs.h <<_ACEOF #define SH "$SH" _ACEOF # Extract the first word of "ifconfig", so it can be a program name with args. set dummy ifconfig; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_IFCONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $IFCONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_IFCONFIG="$IFCONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_dummy=""$PATH:/sbin:/usr/sbin"" for as_dir in $as_dummy do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_IFCONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_IFCONFIG" && ac_cv_path_IFCONFIG="/sbin/ifconfig" ;; esac fi IFCONFIG=$ac_cv_path_IFCONFIG if test -n "$IFCONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $IFCONFIG" >&5 $as_echo "$IFCONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi cat >>confdefs.h <<_ACEOF #define IFCONFIG "$IFCONFIG" _ACEOF # Extract the first word of "grep", so it can be a program name with args. set dummy grep; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else case $GREP in [\\/]* | ?:[\\/]*) ac_cv_path_GREP="$GREP" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_GREP="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi GREP=$ac_cv_path_GREP if test -n "$GREP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GREP" >&5 $as_echo "$GREP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi cat >>confdefs.h <<_ACEOF #define GREP "$GREP" _ACEOF CFLAGS="-Wall $CFLAGS" ac_config_files="$ac_config_files Makefile src/Makefile scripts/Makefile tests/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by guessnet $as_me 0.54, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ guessnet config.status 0.54 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi guessnet-0.55/INSTALL0000644000000000000000000002203011770705652011226 0ustar Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. guessnet-0.55/Makefile.am0000644000000000000000000000114711770705652012237 0ustar ## Process this file with automake to produce Makefile.in SUBDIRS = src scripts tests man_MANS = guessnet.8 guessnet-scan.8 nodist_man_MANS = guessnet-ifupdown.8 guessnet-ifupdown.8: guessnet.8 ln -s guessnet.8 guessnet-ifupdown.8 FAQ.html: FAQ rst2html --no-doc-title --stylesheet=main.css $< > $@ web: FAQ.html scp $^ "alioth.debian.org:/org/alioth.debian.org/chroot/home/groups/guessnet/htdocs/" clean-local: -rm -f guessnet-ifupdown.8 FAQ.html EXTRA_DIST=$(man_MANS) autogen.sh testnets FAQ doc/Saner-Defaults-HOWTO \ examples/README examples/getmac examples/interfaces examples/laptop-netconf guessnet-0.55/scripts/0000755000000000000000000000000011770717500011662 5ustar guessnet-0.55/scripts/test-wireless0000755000000000000000000000302211770705652014424 0ustar #!/bin/sh # # test-wireless # History # Oct 2004: Written by Thomas Hood set -o errexit # -e set -o noglob # -f MYNAME="$(basename $0)" PATH=/sbin:/bin usage() { cat < [mac ] [essid ] $MYNAME --help|-h Tests whether the current interface has the appropriate MAC address and/or the appropriate ESSID. MACADDRESS letters must be in upper case Licensed under the GNU GPL. See /usr/share/common-licenses/GPL. Options: -h|--help Print this help EOT } report_err() { echo "${MYNAME}: Error: $*" >&2 ; } do_sleep() { LANG=C sleep "$@" ; } if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then usage exit 0 fi IFACE="$1" [ "$IFACE" ] || { report_err "Interface not specified. Exiting." ; exit 1 ; } shift while [ "$1" ] ; do case "$1" in mac) MAC_ADDRESS="$2" shift ;; essid) ESSID="$2" shift ;; esac shift done [ "$MAC_ADDRESS" ] || [ "$ESSID" ] || { report_err "Neither AP MAC address nor ESSID specified. Exiting." ; exit 1 ; } FAILED=0 do_sleep 0.5 if [ "$MAC_ADDRESS" ] ; then ACTUAL_MAC_ADDRESS="$(iwgetid "$IFACE" --ap)" ACTUAL_MAC_ADDRESS="${ACTUAL_MAC_ADDRESS#*Cell:}" ACTUAL_MAC_ADDRESS="${ACTUAL_MAC_ADDRESS# }" ACTUAL_MAC_ADDRESS="${ACTUAL_MAC_ADDRESS% }" [ "$ACTUAL_MAC_ADDRESS" = "$MAC_ADDRESS" ] || FAILED=1 fi if [ "$FAILED" = 0 ] && [ "$ESSID" ] ; then ACTUAL_ESSID="$(iwgetid "$IFACE")" ACTUAL_ESSID="${ACTUAL_ESSID#*ESSID:\"}" ACTUAL_ESSID="${ACTUAL_ESSID%\"*}" [ "$ACTUAL_ESSID" = "$ESSID" ] || FAILED=1 fi exit "$FAILED" guessnet-0.55/scripts/test-wireless-scan0000755000000000000000000000344611770705652015360 0ustar #!/bin/bash # # test-wireless-scan # # History # Oct 2004: Written by Thomas Hood set -o errexit # -e set -o noglob # -f MYNAME="$(basename $0)" PATH=/sbin:/bin usage() { cat < [mac ] [essid ] $MYNAME --help|-h Tests whether an access point is in range [with the appropriate MAC address] [and appropriate ESSID] by looking at the output of "iwlist IFACE scan". MACADDRESS letters must be in upper case Licensed under the GNU GPL. See /usr/share/common-licenses/GPL. Options: --help|-h Print this help EOT } report_err() { echo "${MYNAME}: Error: $*" >&2 ; } do_sleep() { LANG=C sleep "$@" ; } is_ethernet_mac() { [ "$1" ] && [ ! "${1##[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]}" ] } if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then usage exit 0 fi IFACE="$1" [ "$IFACE" ] || { report_err "Interface not specified. Exiting." ; exit 1 ; } shift while [ "$2" ] ; do case "$1" in mac) MAC_ADDRESS=$(echo "$1" | tr a-f A-F) is_ethernet_mac "$MAC_ADDRESS" || { report_err "Argument of 'mac' is not a MAC address" ; exit 1 ; } ;; essid) ESSID="$2" ;; esac shift 2 done [ "$MAC_ADDRESS" ] || [ "$ESSID" ] || { report_err "Neither AP MAC address nor ESSID specified. Exiting." ; exit 1 ; } ifconfig "$IFACE" up do_sleep 0.5 SCAN="$(iwlist "$IFACE" scan 2>&1)" ifconfig "$IFACE" down shopt -s extglob # We need this to allow the ?( ) syntax in patterns [ "$SCAN" = "${SCAN/Interface doesn?t support scanning/}" ] || exit 1 [ "$SCAN" = "${SCAN/Operation not supported/}" ] || exit 1 if [ "$MAC_ADDRESS" ] ; then [ "$SCAN" != "${SCAN/Address:*( )$MAC_ADDRESS/}" ] || exit 1 fi if [ "$ESSID" ] ; then [ "$SCAN" != "${SCAN/ESSID:*( )?${ESSID}?/}" ] || exit 1 fi exit 0 guessnet-0.55/scripts/test-wireless-ap0000755000000000000000000000522411770705652015030 0ustar #!/bin/sh # test-wireless-ap # Licensed under the GNU GPL. See /usr/share/common-licenses/GPL. # # History # May 2005: Bugs fixed by Christoph Biedl and Thomas Hood # Nov 2003: Modified by Thomas Hood and Klaus Wacker # July 2003: Modified by Thomas Hood to support Aironet cards # June 2003: Modified by John Fettig # Jan 2003: Derived from testssid by Andrew McMillan # Written by Thomas Hood set -o errexit # -e set -o noglob # -f MYNAME="$(basename $0)" PATH=/sbin:/bin:/usr/bin ESSID="" usage() { cat < [] []... $MYNAME --help|-h Tests whether the wireless card can associate to an access point using the given iwconfig argument pairs essid ESSID key 123456 and so on. Options: --help|-h Print this help. EOT } report_err() { echo "${MYNAME}: Error: $*" >&2 ; } do_sleep() { LANG=C sleep "$@" ; } is_ethernet_mac() { [ "$1" ] && [ ! "${1##[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]}" ] } # Set ESSID to string following 'essid' in the array of function arguments extract_ESSID() { while [ "$1" ] ; do [ "$1" = "essid" ] && { ESSID="$2" ; return 0 ; } shift done } if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then usage exit 0 fi TIMEOUT=3 case "$1" in --timeout) TIMEOUT="$2" ; shift 2 ;; --timeout=*) TIMEOUT="${1#--timeout=}" ; shift ;; esac IFACE="$1" [ "$IFACE" ] || { report_err "Interface not specified. Exiting." ; exit 1; } shift MAC_ADDRESS=$(echo "$1" | tr a-f A-F) if is_ethernet_mac "$MAC_ADDRESS" ; then shift else MAC_ADDRESS="" fi extract_ESSID "$@" [ "$1" ] && iwconfig "$IFACE" "$@" ifconfig "$IFACE" up TIMELEFT="$TIMEOUT" while test "$TIMELEFT" -gt 0 ; do FAILED=0 if [ "$ESSID" ] ; then # Check that interface ESSID is what we are looking for ACTUAL_ESSID="$(iwgetid $IFACE)" ACTUAL_ESSID="${ACTUAL_ESSID#*ESSID:}" ACTUAL_ESSID="${ACTUAL_ESSID# }" ACTUAL_ESSID="${ACTUAL_ESSID#\"}" ACTUAL_ESSID="${ACTUAL_ESSID%\"}" [ "$ACTUAL_ESSID" = "$ESSID" ] || FAILED=1 fi if [ "$FAILED" = 0 ] && [ "$MAC_ADDRESS" ] ; then # Check that access point MAC address is what we are looking for ACTUAL_MAC_ADDRESS="$(iwgetid $IFACE --ap --scheme)" case "$ACTUAL_MAC_ADDRESS" in "FF:FF:FF:FF:FF:FF"|"ff:ff:ff:ff:ff:ff"|"44:44:44:44:44:44"|"00:00:00:00:00:00") ACTUAL_MAC_ADDRESS="" ;; esac [ "$ACTUAL_MAC_ADDRESS" = "$MAC_ADDRESS" ] || FAILED=1 fi if [ "$FAILED" = 0 ] ; then ifconfig "$IFACE" down exit 0 fi do_sleep 1 TIMELEFT=$(( $TIMELEFT - 1 )) done # Out of time ifconfig "$IFACE" down exit 1 guessnet-0.55/scripts/test-dhcp0000755000000000000000000000446611770705652013522 0ustar #!/bin/bash # # test-dhcp # # Usage: # test-dhcp IFACE [PEER_IPADDRESS [PEER_MAC]] # # Licensed under the GNU GPL. See /usr/share/common-licenses/GPL. # # History # Jan-Aug 2003: Written by Thomas Hood set -o errexit # -e set -o noglob # -f MYNAME="$(basename $0)" # All the DHCP clients are in /sbin/ but which is under /usr/ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/share/guessnet/test report_err() { echo "${MYNAME}: Error: $*" >&2 ; } do_sleep() { LANG=C sleep "$@" ; } test_peer() { if [ ! "$PEER_IPADDRESS" ] || test-ping "$IFACE" "-" "$PEER_IPADDRESS" ${PEER_MAC:+"$PEER_MAC"} ; then exitstatus=0 else exitstatus=1 fi } IFACE="$1" [ "$IFACE" ] || { report_err "Interface not specified. Exiting." ; exit 1 ; } PEER_IPADDRESS="$2" PEER_MAC="$3" if which dhclient > /dev/null ; then # TODO: Write a faster proxy script for the purposes of this test disable_resolvconf() { [ -x /sbin/resolvconf ] || return 0 [ -x /etc/init.d/resolvconf ] || return 0 /etc/init.d/resolvconf disable-updates } reenable_resolvconf() { [ -x /sbin/resolvconf ] || return 0 [ -x /etc/init.d/resolvconf ] || return 0 /sbin/resolvconf -d "$IFACE" /etc/init.d/resolvconf enable-updates } trap reenable_resolvconf EXIT disable_resolvconf if dhclient -q -1 -pf "/var/run/dhclient.${IFACE}.pid" -lf "/var/run/dhclient.${IFACE}.leases" "$IFACE" >/dev/null 2>&1 ; then test_peer else exitstatus=1 fi # Don't use -r because it gives up the lease #dhclient -q -r "$IFACE" >/dev/null 2>&1 || true start-stop-daemon --stop --oknodo --pidfile="/var/run/dhclient.${IFACE}.pid" --retry=TERM/5/KILL/1 > /dev/null 2>&1 || true rm -f "/var/run/dhclient.${IFACE}.pid" reenable_resolvconf exit "$exitstatus" elif which pump > /dev/null ; then if pump --interface="$IFACE" --no-dns --no-resolvconf --script="" > /dev/null 2>&1 ; then test_peer else exitstatus=1 fi pump -k --interface="$IFACE" > /dev/null 2>&1 || true exit "$exitstatus" elif which dhcpcd > /dev/null ; then # Setting the proxy script to /dev/null seems to work :) if dhcpcd -c /dev/null "$IFACE" > /dev/null 2>&1 ; then test_peer else exitstatus=1 fi dhcpcd -c /dev/null -k "$IFACE" > /dev/null 2>&1 || true [ "$exitstatus" != "0" ] || do_sleep 1 exit "$exitstatus" else report_err "No DHCP client found. Exiting." exit 1 fi guessnet-0.55/scripts/Makefile.in0000644000000000000000000002730311770705723013740 0ustar # Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = scripts DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(scriptdir)" SCRIPTS = $(script_SCRIPTS) SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ IFCONFIG = @IFCONFIG@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LIBNET_CFLAGS = @LIBNET_CFLAGS@ LIBNET_CONFIG = @LIBNET_CONFIG@ LIBNET_LIBS = @LIBNET_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBWIBBLE_CFLAGS = @LIBWIBBLE_CFLAGS@ LIBWIBBLE_LIBS = @LIBWIBBLE_LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SH = @SH@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ scriptdir = @scriptdir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ script_SCRIPTS = test-wireless test-wireless-scan test-wireless-ap EXTRA_DIST = test-wireless test-wireless-scan test-wireless-ap test-dhcp all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign scripts/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign scripts/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-scriptSCRIPTS: $(script_SCRIPTS) @$(NORMAL_INSTALL) test -z "$(scriptdir)" || $(MKDIR_P) "$(DESTDIR)$(scriptdir)" @list='$(script_SCRIPTS)'; test -n "$(scriptdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(scriptdir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(scriptdir)$$dir" || exit $$?; \ } \ ; done uninstall-scriptSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(script_SCRIPTS)'; test -n "$(scriptdir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(scriptdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(scriptdir)" && rm -f $$files tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(SCRIPTS) installdirs: for dir in "$(DESTDIR)$(scriptdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-scriptSCRIPTS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-scriptSCRIPTS .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-scriptSCRIPTS install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am uninstall-scriptSCRIPTS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: guessnet-0.55/scripts/Makefile.am0000644000000000000000000000021511770705652013721 0ustar script_SCRIPTS = test-wireless test-wireless-scan test-wireless-ap EXTRA_DIST = test-wireless test-wireless-scan test-wireless-ap test-dhcp guessnet-0.55/TODO0000644000000000000000000000036611770705652010675 0ustar + Take over the world + In ifupdown mode, parse card configuration lines in every stanza in order to avoid repetition of data (ie, get wireless essid name from wireless-essid instruction, arp source from address instruction and so on) guessnet-0.55/aclocal.m40000644000000000000000000012262211770705716012046 0ustar # generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, [m4_warning([this file was generated for autoconf 2.68. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # LIBWIBBLE_DEFS([LIBWIBBLE_REQS=libwibble]) # --------------------------------------- AC_DEFUN([LIBWIBBLE_DEFS], [ dnl Import libtagcoll data PKG_CHECK_MODULES(LIBWIBBLE,m4_default([$1], libwibble)) AC_SUBST(LIBWIBBLE_CFLAGS) AC_SUBST(LIBWIBBLE_LIBS) ]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 10 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # 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. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_PROG_LEX # ----------- # Autoconf leaves LEX=: if lex or flex can't be found. Change that to a # "missing" invocation, for better error output. AC_DEFUN([AM_PROG_LEX], [AC_PREREQ(2.50)dnl AC_REQUIRE([AM_MISSING_HAS_RUN])dnl AC_REQUIRE([AC_PROG_LEX])dnl if test "$LEX" = :; then LEX=${am_missing_run}flex fi]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_PROG_CC_C_O # -------------- # Like AC_PROG_CC_C_O, but changed for automake. AC_DEFUN([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC_C_O])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi dnl Make sure AC_PROG_CC is never called again, or it will override our dnl setting of CC. m4_define([AC_PROG_CC], [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR guessnet-0.55/depcomp0000755000000000000000000004426711770705723011571 0ustar #! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2009-04-28.21; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free # Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u="sed s,\\\\\\\\,/,g" depmode=msvisualcpp fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: guessnet-0.55/autogen.sh0000755000000000000000000000006411770705652012201 0ustar #!/bin/sh # Rebuild the build system autoreconf -i