labrea-2.5-stable-1.orig/0040777000550600055060000000000007750022577014260 5ustar tonontononlabrea-2.5-stable-1.orig/README0100644000550600055060000007470707730434533015145 0ustar tonontononLaBrea - The Tarpit ******************** *** INTRODUCTION *** ******************** LaBrea is a program that creates a tarpit or, as some have called it, a "sticky honeypot". LaBrea takes over unused IP addresses on a network and creates "virtual machines" that answer to connection attempts. LaBrea answers those connection attempts in a way that causes the machine at the other end to get "stuck", sometimes for a very long time. --- --- How does it work? --- LaBrea works by watching ARP requests and replies. When the pgm sees consecutive ARP requests spaced several seconds apart, without any intervening ARP reply, it assumes that the IP in question is unoccupied. It then "creates" an ARP reply with a bogus MAC address, and fires it back to the requester. An example (from a tcpdump of LaBrea running on my network): 14:18:28.832187 ARP who-has xx.xx.xx.13 tell xx.xx.xx.1 14:18:29.646402 ARP who-has xx.xx.xx.13 tell xx.xx.xx.1 14:18:31.707295 ARP who-has xx.xx.xx.13 tell xx.xx.xx.1 14:18:31.707574 ARP reply xx.xx.xx.13 is-at 0:0:f:ff:ff:ff There is no xx.xx.xx.13 machine on my network. In this case, the timeout was set to 3 seconds (it's a command line parameter), and when that final "who-has" came in, the "is-at" reply that you see was generated by LaBrea. There isn't a MAC address of 0:0:f:ff:ff:ff either. It doesn't exist. But now, the router (xx.xx.xx.1) believes that there some machine at xx.xx.xx.13, and that it resides on the MAC address 0:0:f:ff:ff:ff, and so it dutifully sends packets on. In essence, we've created a "virtual machine" on that IP address. Now, LaBrea also watches for TCP traffic destined for the ether address 0:0:f:ff:ff:ff. When it sees an inbound TCP SYN packet, it replies with a SYN/ACK that "tarpits" that connection attempt. Everything else is ignored. (Well... sort of. LaBrea also tries to give its "virtual machines" some character... you can ping them, and they respond to a SYN/ACK with a RST...) There's more to it than that (obviously...) but you'll need to read further. ************************ *** How do I run it? *** ************************ Glad you asked! The short answer: Usage: LaBrea The long answer: --------------------------------------------- -- Interfaces / IP address / Netmask / BPF -- --------------------------------------------- --device (-i) interface : Set a non-default interface If your machine has more than one interface, and LaBrea choses the "wrong" one, you can use this option to direct it to the correct one. Use a device name ("eth0") as a parameter. On Windows, you can use the "-D" parameter to see the list of interfaces is recognized. --quiet (-q) : Do not report odd (out of netblock) ARPs If you have two netblocks, with non-contiguous addresses, LaBrea will complain about seeing ARPs that it believes it shouldn't see. This will tell it to "be quiet." --bpf-file (-F) filename : Specify a BPF filter filename Designates the name of a file containing a BPF filter pointing to machines/ports to add to the tarpit. Note that connections specified by the BPF filter will also be tarpitted. As with the command line BPF filter, these connections MUST be firewalled to DROP inbound traffic or this won't work! --mask (-m) mmm.mmm.mmm.mmm : User specified netmask --network (-n) nnn.nnn.nnn.nnn[/nn] : User specified network number Normally LaBrea picks up information from the interface in order to determine the capture subnet. Sometimes you might run LaBrea on an unconfigured interface (one without an assigned IP address). In this case, you'll have to provide the "netmask" and the "network number" for the capture subnet. The "n" parameter accepts a CIDR-format address. So the class C subnet 192.168.99.xx could be specified as: -n 192.168.99.33/24 or as: -n 192.168.99.33 -m 255.255.255.0 Note: KNOW WHAT YOU'RE DOING. If these numbers are not correct, BAD THINGS may happen. --my-ip-addr (-I) nnn.nnn.nnn.nnn : Specify system's IP address --my-mac-addr (-E) xx:xx:xx:xx:xx:xx : Specify system's MAC address LaBrea needs to know the NIC's (Network Interface Card) IP and MAC addresses. This information is used to construct the ARPs that LaBrea uses to determine if an IP address is occupied or not. On certain systems (e.g. old Win98), the API that supports the libdnet intf rtn is not installed. So you have to specify the system IP and MAC address yourself. If you specify one, then you have to specify the other. You will also have to manually specify the capture subnet information. Note: As mentioned above, be VERY careful when manually specifying this information. If you get it wrong, bad things can happen. -------------------------- -- Tarpitting behaviour -- -------------------------- --throttle-size (-t) datasize : Set connection throttling size in bytes Since you're "inviting" the scanners in, you might as well place some restrictions on them. This option sets the TCP window advertisement to limit the amount of data sent by the scanner. The number of data bytes to allow per packet is passed as a parameter. Default value is 10 unless persist mode is used. With persist mode, defualt value is 3. --arp-timeout (-r) rate : Set arp timeout rate in seconds The number of seconds to wait between arp requests before deciding that an IP address is unused. Here is a description of the algorithm used: On an IP by IP basis, we store a time and an originating IP address: 1) When you see an ARP request, check the current time: a) If currently stored time is 0 or the arp comes from a different address than the one stored, store the current time and the requesting IP and return. b) If the stored time is less than "-r" seconds ago, ignore it and return. c) If currently stored time is more than a minute ago, store 0, return. (Max timeout) d) Otherwise, grab the IP! 2) See an ARP reply, set stored time to 0. The default timeout is 3 seconds. ------------------ -- IP Capturing -- ------------------ --switch-safe (-s) : "Safe" operation in a switched environment Under a switched environment it is possible for LaBrea to see an ARP request, but not see the resulting ARP reply. LaBrea can still work under these conditions by sending out "mirror" ARP requests of its own. If this parameter is specified, when LaBrea sees an inbound ARP request the pgm sends out a duplicate ARP request for the same IP, with the LaBrea server itself as the target for the reply. --exclude-resolvable-ips (-X) : Automatically exclude resolvable IPs from capture. On startup, this will attempt DNS resolution on all IPs within your netblock, and automatically exclude any that resolve. --disable-capture (-x) : Disable IP capture This instructs LaBrea NOT to capture IPs. --hard-capture (-h) : "Hard" capture IPs The -h option instructs LaBrea that once it captures an IP address, it needn't wait for a "-r" timeout the next time it sees an Arp request for this IP. IPs are "hard" captured. See the section on the configuration file for further information. --soft-restart (-R) : Wait while recapturing active connects "Soft Restart" mode. What this does is to hold off on any new attempt to force incoming sessions into the "persist" state for 5 minutes. This lets things settle down and gets the bandwidth calculations going. Note that during this period, IPs will still be captured, pings will still be responded to (if specified), etc. After I changed some stuff in LaBrea, I thought I would be tricky and restart LaBrea quickly so I could keep hold of the connections I had already trapped. And lo, one of the dogs of the internet chose that moment to hit me with a scan. LaBrea didn't have enough information for correctly calculating bandwidth yet, so I ended up with *WAY* too many connections. "Soft restart" mode prevents this from happening. --auto-hard-capture (-H) : Automatically hard capture addresses not excluded. This marks all non-excluded and all non-hardexcluded IPs as being hard captured. Use CAREFULLY. ------------------------------ -- Persistent state capture -- ------------------------------ --max-rate (-p) maxrate : "Persist" state capture connect attempts LaBrea will permanently capture connect attempts within the limit of the maximum data rate specified (in Kbits/sec). This value is expressed in KiloBytes/Sec. (This is a change from previous versions.) This is UNBELIEVABLY COOL (if I do say so myself...) If you specify this flag and a maximum bandwidth, several things will happen. First of all, this forces data throttling to 3 bytes (see the "-t" option above). Then, when a connection is attempted, LaBrea will force the connection into what is known as "persist" state. In persist state, the connection NEVER times out. You'll literally hang onto the scanning thread until you stop or they stop. Running unchecked, this could have a detrimental effect on your bandwidth, so LaBrea will make every effort to limit itself to the maximum bandwidth that you specify (in Kb/sec). If it can't capture a connection, LaBrea will still tarpit it. Note: It'll stay pretty NEAR your MAXBW number... YMMV. --log-bandwidth (-b) : Log bandwidth usage to syslog This will send an update on the current bandwidth being consumed by the -p option to the log every minute. If you're interested... (Note: it'll only work if you have -p enabled. Duh...) --persist-mode-only (-P) : Persist mode capture only. Persist mode capture only. This tries to limit bandwidth by only persist capturing. When we're at full bandwidth, standard tarpitting won't happen, but because the same "conversation" that leads to persist capture also has the side-effect of tarpitting, when we're below our set bandwidth, it's not really effective. (It was easy to do though...) ------------------------------- -- Virtual machine behaviour -- ------------------------------- --no-resp-synack (-a) : Do not respond to SYN/ACKs and PINGs By default, LaBrea's "virtual machines" will respond to a SYN/ACK packet with a RST. This is nice behavior, because it makes it difficult for people to use your empty IP addresses to "spoof". The virtual machine will also respond to a ping, which acts as an invitation to anything that preceeds a scan with a ping to see if the target exists. Like say... NMap, or most worms. If you DON'T want this behavior, use the "-a" option to disable it. --no-resp-excluded-ports (-f) : "Firewall" excluded ports. The -f parameter says to "firewall" excluded ports. With this option, excluded ports will act as if they were firewalled to DROP inbound connections. The result is that nmap scans of LaBrea virtual machines in the capture subnet will take a long time. This discourages hacking activity while at the same time generating log entries that warn you of the activity. LaBrea is automatically configured to always respond to the "usual" hacking ports. Also, if there is enough activity on some other port, then the virtual machines will adjust by starting to respond to incoming connections on this new port. ---------------------------- Before giving the detailed explanation, first some definitions: a) A standard port is one that LaBrea always responds to. These ports are the ones that hackers and worms look for (e.g. telnet, http, ftp, etc). See ctl.c for the complete list. b) An excluded port is one that has been configured as such in the configuration file. Even a standard port can be forced to be excluded. c) A dynamic port is one that is neither standard, nor excluded. ---------------------------- When "-f" is specified, LaBrea behaves as follows: 1) Excluded ports will do not respond at all (DROP). 2) Activity on a standard port will be handled as usual (i.e. tarpitting, persist mode) 3) If LaBrea sees activity on a dynamic port, then it starts counting the number of SYNs received (ie incoming connections). When there is enough activity on the port, then LaBrea will start responding to incoming connects: a) If SYN count is less than 6, then drop the incoming connection, but increment the counter by 1. b) If SYN count is 6 or more, then respond to the incoming connection (tarpitting / persist mode). 4) Every 15 minutes, all port counts < 255 are reduced by one to eliminate the effect of SYN "noise". However, once a port count reaches 255, the port will always respond to incoming SYNs. --no-arp-sweep : Don't perform initial arp sweep of capture subnet LaBrea has a number of safety mechanisms built-in to avoid causing problems with its virtual machines. By default, LaBrea will do an arp sweep of the capture subnet in order to detect IPs that are already occupied by active machines. Arps are generated in bursts of 85 at 2 minute intervals. However if the capture subnet is too large (>1024 addresses), then a warning message is given, and the arp sweep is turned off. Specifying this parameter means that LaBrea will not do the initial arp sweep. -------------- -- Logging --- -------------- --log-to-syslog (-l) : Log activity to syslog Sends all messages to system syslog once the initialisation is completed. This is the default behaviour on Unix systems. --verbose (-v) : Verbosely log activity to syslog Log all IPs "captured", IPs "teergrubed", plus all activity from the "teergrubed" hosts. Specify twice for more effect. --log-to-stdout (-o) : Output to stdout instead of syslog This sends log information to stdout rather than to syslog. This option also implies and sets the -d option (Do NOT detach process). Yes, I know... LaBrea is chatty and dumps a whole lot of stuff into syslog. This gives you the option to have LaBrea log information go to stdout instead. "-o" is the default behaviour on Windows systems. --log-timestamp-epoch (-O) : Same as -o w/time output in seconds since epoch The same as the "-o" option, but formats the time stamp differently to make it easier for other "logfile analysis" programs to parse it. --version (-V) : Print version information and exit --------------------------------- -- Windows-specific parameters -- --------------------------------- ==> Note that on Windows systems, messages are sent by default to stdout. Also LaBrea is not yet able to detach itself and run as a standalone Windows service. ==> The following parameters are specific to Windows systems only: --list-interfaces (-D) : List available interfaces LaBrea uses two different APIs to interact with the NIC (network card): libdnet and WinPcap. The libdnet intf API is used to extract information from the NIC and to generate packets. The WinPcap API is used to sniff. Unfortunately, these two APIs have different nomenclatures for the same underlying NIC. Specifying this parameter causes LaBrea to generate the list of available interfaces. Both the WinPcap and the libdnet device lists are given. In each list, the interface by default is indicated. You get to pick an interface from each list if the defaults are not right. Use the "-i" parameter (see above) to pick the libdnet interface. See the following parameter for the WinPcap device. --winpcap-dev (-j) nn : Specify WinPcap device The WinPcap device driver is used for packet sniffing. By default, the first device in the WinPcap list is the one that is used. The "-j" parameter can be used to specify another entry in the list. For instance, "-j 2" says to use the 2cd entry in the WinPcap device driver list. ---------------------------- Note: It is ESSENTIAL that the -j and -i parameters specify the SAME physical interface (NIC). --syslog-server nnn.nnn.nnn.nnn : Specify address of remote syslog server --syslog-port nnn : Specify port to be used for remote syslog On Windows systems, LaBrea offers syslog support. For Windows NT and up, log messages will be sent to the local Windows Application Event log if the "-l" parameter is specified. However, when "--syslog-server" is specified as well, then the pgm will send log messages to a remote syslog server. This will work even on Windows 98 or ME systems. Finally, if the remote syslog doesn't open for some reason, then LaBrea will fail over to the local application Event log. -------------------------------- -- Special modes of operation -- -------------------------------- --dry-run (-T) : Test mode - Prints out debug info but DOES NOT RUN Test mode. If you're having trouble, try this first and see if LaBrea is picking up the information on your adapter, netblock, netmask, etc... correctly. This prints diagnostic information and then exits. --foreground (-d) : Do NOT detach process. Some people want to run LaBrea under the control of another process. This keeps LaBrea from detaching and running as a daemon. This is the default (only!) behaviour on Windows systems. --usage --help (-?) : Give help messages --no-nag (-z) : Turn off nag message ==> IMPORTANT ==> Be sure that you read the "Potential Issues" section in the INSTALL documentation before you actually use LaBrea. --init-file filespec : Specify alternative location for the configuration file By default, LaBrea looks for the configuration file as follows: Unix systems /usr/local/etc/labrea.conf Windows systems LaBrea.cfg in the current execution directory The "init-file" parameter can be a full filespec complete with path information. LaBrea will look in the specified location for the configuration file. --debug nn : Produce debugging output If debugging is compiled into LaBrea by specifying: ./configure enable-debugging then this parameter causes the actual production of debug output. See debug.h for an explication of debugging codes. ****************************** *** The Configuration file *** ****************************** This section describes the configuration file. The configuration file contains directives that alter pgm behaviour. ---------------------- -- Some definitions -- ---------------------- First, some definitions. * "Excluded" IPs are those that you DON'T want LaBrea to ever capture. Please note that you don't need to specify "active" IPs (ie those with a live machine sitting on the address). LaBrea won't capture an IP with a machine on it. This is only for empty IPs that you DON'T want captured. * "HardExcluded" IPs are those that you don't want LaBrea to hard capture. This is only necessary with the -h option. --------------------------- -- Specifying directives -- --------------------------- * IP addresses can be specified as either a single address: 192.168.33.99 or as a range of addresses: 192.168.0.1 - 192.168.0.50 * The same thing holds for ports and ranges of ports: 22 33-55 * The configuration file consists of lines with two parts: An IP or Port (or and IP range or Port range) followed by a "tag". For example: 192.168.0.1-192.168.0.50 exclude Blank lines are ignored as are lines starting with "#". ------------------------------ -- Configuration statements -- ------------------------------ LaBrea recognizes the following "tags": exclude - This applies to local IP addresses. This means that LaBrea is to never "capture" or "take-over" this IP address. hardexclude - Again, this applies to local IP addresses. This config stmt is only useful if "-h" (hard capture") is specified. This means that LaBrea is to never "hard capture" this address, therefore it must *always* wait for the ARP timeout. If -s is specified, then duplicate arps will be sent each time. ipignore - This can be applied to ANY IP address. This keeps LaBrea from tarpitting or persist capturing connection attempts from this IP. Note that ipignore takes a CIDR format address specification (instead of a range of addresses): nnn.nnn.nnn.nnn[/mm] portignore - Port 1 - 65535. This keeps LaBrea from tarpitting or persist capturing any connection attempts against this port. pmn - "Port monitor". This config stmt is only useful if -f (firewalling) is specified. It tells LaBrea to treat these ports as "standard" ports. In other words, LaBrea is always to respond to connections on these ports. ------------------------------- -- Sample configuration file -- ------------------------------- Let's suppose that LaBrea is started with -f (firewalling) and -h (hard capture). Here then is a sample configuration file: # # Ignore packets from IP 192.168.0.94 # 192.168.0.94 exclude # # Ignore packets from the IP address range 192.168.0.1 to 50 # 192.168.0.1-192.168.0.50 exclude # # Always wait for the arp timeout for the address 192.168.0.55 # 192.168.0.55 hardexclude # # Ignore connection attempts from the class C subnet # 123.45.67.89 # 123.45.67.89/24 ipignore # # Ignore connection attempts for the port range 121-180 # 121-180 portignore # # But still respond to port 155 (in the middle of this interval) 155 pmn ************************* *** SIGNAL PROCESSING *** ************************* If LaBrea is running in daemon mode (supported only on Unix), then it will respond to various signals. SIGHUP: LaBrea will redo the initialisation. This means in practice that you can "let go" of someone by putting the correct entry in the configuration file and then issuing a SIGHUP. SIGUSR1: This toggles logging as follows: If logging was not enabled at start this sets the '-l' flag If logging (-l | -v) is set this saves the value and turns off logging If logging is presently toggled off it restores the saved level (-l | -v) -- PCAP Dispatcher loop processing -- On some systems, the libpcap code will not time out unless there is activity on the network interface. So this means that on a really quiet network, you might have to ping the LaBrea server to get it to notice that you just did a kill -HUP or kill -USR1. The upside of this is the PCAP loop is more efficient. *************************** *** LaBrea runs as root *** *************************** If you have a message on Unix such as: "labrea: *** Couldn't open pcap device for sniffing" or on Windows you find that "labrea -D" doesn't list the interfaces, then be aware of the following: ==> On unix, LaBrea must run as root ==> On Windows NT and later, LaBrea needs admin privileges ************************************************ *** And now a few words from the sponsor ... *** ************************************************ --- --- Why did you write it? --- The original concept for LaBrea started in response to the CodeRed worm. Our IP block was being scanned non-stop. I began to wonder: "Is there anything that can be done to stop this worm?" Of course, many things came to mind, but most of them were illegal. Then, late one night, I thought, "Maybe I can't stop these machines from scanning, but I bet I can slow them down..." The following morning I posted to the INTRUSIONS list at incidents.org: "I'm pretty sure that most of you are using your allotted ip address space somewhat like I am. At any given time I'm using only about 20-30% of the ip addresses that I have available. What if I could put something on those other 80% of my ip addresses that would give "Code Red" something to play with that would slow it down to a crawl? A sort of "DoS" back at the worm. Since those "extra" ip addresses aren't actually expecting any inbound traffic, anything fired at them can safely be assumed to be "bad" traffic. If I wrote a little piece of software that sat on those ip's and listened on port 80, anything that it heard could safely be "played" with. My hypothetical program should be pretty simple: you see an inbound packet at port 80 with SYN set, and you craft up a return packet with SYN/ACK set and perhaps an option to set the MSS to something small... say about 60 bytes. What does that do? Well, as far as the attacking worm is concerned, after replying with an ACK, it has completed a three-way handshake... it's connected. It's also been told to send information back to you in small chunks (to keep traffic to a minimum), which it dutifully does. The only problem is, my program just answers SYN packets and ignores everything else. So now the worm has to sit around while the whole TCP connection times out. I'm not sure what the timeout NT is, but I think most stacks are pretty persistent about "good" connections, so it should hang it up for a good long time." A few days later, Mihnea Stoenescu sent a message back to the list: "Tom's concept works - I have a living proof. For a few hours I've been teergrubing CodeReds via three-way handshake on behalf of an entire C-block, by using only one host. At a rate of 6 hosts per minute hitting my block, I'm consuming circa 15 minutes of effective attack time every minute. A lot of hosts can be scanned in 15 minutes." Mihnea used a modified version of a program called Couic. But Couic was written to do a lot more, so I went though, hacked it apart, and put it back together to make "CodeRedneck." CodeRedneck did essentially what I described in my post, but it only worked on "real" connections that had some kind of firewalling that kept the underlying machines from responding. It did nothing for all of those "unused IPs". After CodeRedneck was done, I began trying to figure out how to deal with those unused IPs. Somehow I had to "create" machines, and my first thought was to use IP aliasing under Linux. Using the Trinux distribution I was able to put together a boot disk that, using a list of unused IPs, "created" new machines, then firewalled and "tarpitted" them. I called the new version "LaBrea". The day after I released LaBrea, someone asked if it would be able to handle a /24 network (65,535 hosts). Well, I didn't think my little program would handle it, and, well... it didn't. And so... I tried again. That's how this new version of LaBrea came into being... --- --- Why should I run it? --- If you're a network administrator, I don't REALLY need to explain this. They're out there, every day... 24/7/365. The scanners. They're out there and you get to sit and watch them beat on your network, doing reconnissance. Now you have a chance to make their life more difficult. Besides that... it's fun. And, as Mihnea so wonderfully put it, you can come into work in the morning, look at your logfiles and say "Wow - I'm *actually* saving the world" OK, maybe "saving the world" is a little much... --- --- I still don't get it! --- Try http://labrea.sourceforge.net. There's a mailing list there for users to ask questions among other things. To report bugs: Use the SourceForge Tracker at http://labrea.sourceforge.net to report bugs or email lorgor@users.sourceforge.net. Comments, hate mail, and praise can be directed to tliston@hackbusters.net --- --- Legalese --- 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. --- --- Acknowledgements --- I couldn't have written this without the patience and help of a number of people- The beta testers who put up with my constant tinkering: Barton Bruce, Ben Curran, Andrew Daviel, Bill Dodd, Becky Pinkard, and Micropterus Salmoides. Tim Rushing who came to my rescue and offered to host the website when the downloads of the original LaBrea boot disk were too much for my connection to handle. Matt Franz for putting together the Trinux package. Mihnea Stoenescu for proving it would actually work. Many thanks to Rick Downes of Radsoft (http://www.radsoft.net) for all his help and encouragement. If you deal with any type of Windows environment and you haven't checked out Radsoft's Extreme Power Tools, you really, REALLY should. Thanks also to Rob Rosenberger of VMyths (http://www.vmyths.com) for his advice and assistance. And a very special thanks to Donald Smith for putting up with LOTS of questions (and actually answering most of them) and for letting me bounce ideas off him. $Id: README,v 1.2 2003/09/12 21:23:39 lorgor Exp $ labrea-2.5-stable-1.orig/AUTHORS0100644000550600055060000000166007607335677015335 0ustar tonontononAUTHORS / CREDITS Tom Liston is the father of LaBrea. This version was based on LaBrea 2.4 beta 3 source. Loren Gordon was a major contributor. Dug Song wrote the libdnet and fragroute packages. This code is copyright Dug Song . See the DSong-license for details. Parts of fragroute (pkt, pcaputil, bget, strlcpy) were used in this code. ** From Tom Liston's original code ** Many thanks to Donald Smith for suggestions and improvements and to Rick Downes of Radsoft for his help and encouragement. Additional thanks to the following beta testers for all their help: Barton Bruce, Ben Curran, Andrew Daviel, Bill Dodd, Becky Pinkard, and "Micropterus Salmoides". Also, many thanks to Matthew Franz for his help in putting together the Trinux package. Thanks also to Anders Reed Mohn for his suggestions. ## $Id: AUTHORS,v 1.1.1.1 2003/01/09 18:13:19 lorgor Exp $ labrea-2.5-stable-1.orig/COPYING0100644000550600055060000004313107607335677015317 0ustar tonontonon 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. labrea-2.5-stable-1.orig/ChangeLog0100644000550600055060000001414207727436565016037 0ustar tonontonon2003-09-09 moi-meme * src/ctl.c (ctl_init_arrays): Remove call to sleep since not supposed to mix with alarm calls on linux. * src/utils.c (util_alarm), src/labrea.c: Set alarm and signal handlers after going into daemon mode so that child will get signal * src/labrea_init.c, src/lbio.c: Take out fudge code since libdnet 1.7 ethopen now uses the libdnet device names (ie eth1, etc). 2003-07-17 moi-meme * src/labrea_init.c: Tighten checking on invalid numbers input for throttlesize, max bandwidth, etc. * src/utils.c: Correct timer handling so that bandwidth usage will be properly reported. * src/utils.c, labrea_init.c, pkt_handler.c: Change maxbw to Kbytes so as to avoid problems with large bandwidths. 2002-08-28 * src/labrea_init.c (labrea_init): Turn off arp sweep if capture subnet is too large. Also give a msg if subnet is large. 2002-08-08 * pkt_handler.c (pkt_handler): Set up a "new kid" elt if someone replies to an arp request. 2002-08-07 * pkt_handler.c (ip_handler): Move firewalling code outside so as to check dest port of all incoming TCP packets. 2002-08-06 * labrea_init.c (labrea_init): Change basic bpf filter to listen to pkts *sent* to the bogus MAC address only. * lbio.c (lbio_send_ip_pkt): Make responses appear to come from bogus virtual machine. 2002-08-05 * labrea_init.c, pkt_handler.c, ctl.c, utils.c: Add arp sweep logic to detect live IPs. Replace nk list by a ptr array. 2002-07-31 * labrea_init.c (labrea_init): Change test mode to log on stdout, and not fork a child. Eliminate notes on Usage message to improve readability. 2002-07-29 * pkt_handler.c (check_ip_ignore_or_new_kid): Remove culling logic. Only cull inactive entries at each timer pop. 2002-07-26 * labrea_init.c (labrea_init): Now will accept long options. Add read_number rtn to check input integer validity and prevent buffer overflows. Add new --init-file option to allow user-specified configuration file. Add code to parse all input before bailing out. * labrea.h: Move defines.h to this member. Move prototype definitions to each individual include member (eg utils.h has prototypes for util.c). * includes.h: Move all includes to the corresonding .c source where the include is needed. This simplifies housekeeping on includes. 2002-07-25 * pkt_handler.c (throttle_data): Change newthisminute to depend on b/w from each connection and not just # of connections. * ctl.h, utils.c, ctl.c: Change history array to depend on a defined constant. Change code in same way. 2002-07-07 * pkt_handler.c (ip_handler): Change port firewalling logic to use dynamic port algorithm. That is, ports don't respond to incoming SYNs until they have seen sufficient activity. Then they start giving back a SYN-ACK. * defines.h: Change some defines to enums as per GNU coding standards. * utils.c: Move code to run "new kids" list into timer signal handler so that code will be invoked on a regular basis, but not at each arp. Also add code in same rtn for dynamic port logic so that if a port shows activity, it will automatically be monitored. * labrea.c: Change pcap_loop to pcap_dispatch so that mainline signal handler code can be called regularly. 2002-06-24 * labrea_init.c (labrea_init): Change -n, -m parameters so that can use libdnet input conversion. User has to enter net/mask in standard CIDR format. -m parameter no longer supported. 2002-06-19 * Utils.c (CleanExit): Split into 2 rtn so that can generate error code if terminating on error. 2002-06-18 * labrea.h, *.c: Move control flags and variables to main ctx structure. Move signal handlers and utility routines to new util.c member. Centralize logging. 2002-06-17 * PacketHandler.c, FixArrays.c, LaBrea.c, LaBrea_init.c: Replace u_.. types by libdnet std types. Continue working on replacing hardcoded pkt manipulation by libdnet structures and functions. 2002-06-15 * pkt.h, pkt.c: Rework this code to eliminate fragroute-specific stuff, and to handle arps. * PacketHandler.c: Got rid of gotos. 2002-06-14 * PacketHandler.c, LaBrea.c, LaBrea_init.c, CleanExit.c: Replace the kotb structure by a TAILQ (vrtq). Each virtual server element is a structure of standard libdnet constructs. 2002-06-04 loren.gordon@videotron.ca * Data.c: Move constant strings back into pgms to improve readability. This also prepares for possible gettext internationalisation implementation. Eliminate the Data.c file. * LaBrea.c: Use warnx to generate error messages. Eliminate goto calls for error handling. * LaBrea_init.c: Move initialisation stuff to new stand-alone routine. Get rid of gotos. * labrea.h: Move globals into this include file. Eliminate extern declarations in functions. * defines.h: Define file names to dynamically build msgs / determine file names depending on op system. * KOTB.c, IPHandler.c: Move functions into PacketHandler to eliminate *.c includes. * GoDaemon.c: Eliminate another *c include by moving this code to LaBrea_init.c * LaBrea.c, LaBrea_init.c, PacketHandler.c, FixArrays.c, CleanExit.c: Start replacing libnet by libdnet. Replace randqueue1 logic by calls to libdnet rand fn. * FixArrays.c: Eliminate code to parse old-style configuration file syntax. * defines.h: Change some defines to enum. * FixArrays.c, LaBrea_init.c, PacketHandler.c: Add port_array logic to dynamically add ports to be monitored. Also add PMN directive which causes specific ports to be monitored. Simplify FixArray parsing logic. Change IP ignore addresses to be a linked list of addr structures so that a range of addresses is expressed in CIDR notation (xx.xx.xx.xx/nn). labrea-2.5-stable-1.orig/INSTALL0100644000550600055060000003141707730434533015305 0ustar tonontonon ********************************* *** Installation instructions *** ********************************* ---------------------- -- Potential Issues -- ---------------------- ==> LaBrea can cause serious problems on your network YOU MUST UNDERSTAND THIS: As a default, LaBrea captures IP addresses. That means that LaBrea creates a "virtual machine" that sits on any UNUSED IP address that it sees. If you decide you want to start using one of the IP addresses that LaBrea has laid claim to, THERE IS THE POTENTIAL FOR PROBLEMS. LaBrea has been written so that it does everything it can to move out of the way. If LaBrea notices a machine pop up on one of the IP addresses it is controling, it will even go so far as to re-route any traffic for that address that comes to its "bogus" MAC to the correct MAC, until everything gets straightened out. (Note to purists: LaBrea does not alter the "ttl" field of the forwarded packets when it does this.) Problems may arise because there are things beyond LaBrea's control. ==> Watch out for dhcp ranges ==> Watch out for production Solaris servers If you happen to fire up LaBrea in a range of addresses used for Dhcp, you will quite probably wreak havoc. If a production Solaris server sees an ARP from, say, a misconfigured LaBrea, the production Solaris server will politely shut down its IP interface to make way for the newcomer. Usually not a good thing. ==> Switches may not be happy if the IP address keeps changing Switches and routers may feel compelled to tell you when you first attempt to use an IP address that it is already in use. If your switch or router does this, there is nothing that LaBrea can do about it. Judicious use of the "exclusion" files can minimize problems, as can reconfiguring the router or switch to "timeout" its cache more quickly, but DON'T BLAME ME! YOU HAVE BEEN WARNED! You will find complete information on how to use LaBrea in the README file. By the way, if your version of LaBrea has been compiled with USEZFLAG defined (the default), you'll need to pass it a command line parameter of "-z", in addition to any other flags, to get it to run. Sorry. But at least it got you to read (some of) the instructions... ------------------------------------------------------------ -- Running on Windows systems with a pre-built executable -- ------------------------------------------------------------ You will need to install WinPcap 2.3. Do not use WinPcap 3.0. LaBrea needs admin privileges on Windows NT and later. --------------------- --- How to compile -- --------------------- LaBrea requires both libdnet and libpcap to compile. V2.5 of LaBrea was developed with libdnet 1.7. A reasonable level of libpcap (>= 0.6.2) should work fine. Normal installation will be: ./configure make make install (as root) LaBrea has been compiled and tested on Solaris, Linux, FreeBsd. -- Building on windows systems -- To build LaBrea on windows, you must install cygwin with mingw to be able to use the autoconf / automake support. You will need to install WinPcap 2.3 Developer Pack in the cygwin environment. You will also need to install libdnet in order to link against it. To install libdnet: ./configure --with-wpdpack=/usr/local/WPdpack make make install LaBrea has been tested on Win98 / Win2K. -- Gotchas -- Also as of 2002-12-11, WinPcap does not officially support multi-CPU configurations. The newest version of WinPcap apparently does (V3.0) but libdnet support isn't there yet. YMMV If you are successful at building it on another platform, please let us know! ===================================================================== ===================================================================== Copyright 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 variables by setting them in the environment. You can do that on the command line like this: ./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. $Id: INSTALL,v 1.3 2003/09/12 21:23:39 lorgor Exp $ labrea-2.5-stable-1.orig/Makefile.am0100644000550600055060000000022507607335677016315 0ustar tonontonon## Process this file with automake to produce Makefile.in ## ## $Id: Makefile.am,v 1.1.1.1 2003/01/09 18:13:19 lorgor Exp $ SUBDIRS = misc inc src labrea-2.5-stable-1.orig/Makefile.in0100644000550600055060000004066207750022034016312 0ustar tonontonon# Makefile.in generated by automake 1.7.5 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # 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@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = : host_triplet = @host@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DNETINC = @DNETINC@ DNETLIB = @DNETLIB@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LABREA_CONF = @LABREA_CONF@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCAPINC = @PCAPINC@ PCAPLIB = @PCAPLIB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ SUBDIRS = misc inc src subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = DIST_SOURCES = RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ ps-recursive install-info-recursive uninstall-info-recursive \ all-recursive install-data-recursive install-exec-recursive \ installdirs-recursive install-recursive uninstall-recursive \ check-recursive installcheck-recursive DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ Makefile.in NEWS TODO aclocal.m4 config.guess config.h.in \ config.sub configure configure.in depcomp install-sh missing \ mkinstalldirs DIST_SUBDIRS = $(SUBDIRS) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) $(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): configure.in cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) 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: $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOHEADER) touch $(srcdir)/config.h.in distclean-hdr: -rm -f config.h stamp-h1 uninstall-info-am: # 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): @set fnord $$MAKEFLAGS; amf=$$2; \ 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; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ 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; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ETAGS = etags ETAGSFLAGS = CTAGS = ctags CTAGSFLAGS = tags: TAGS 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if (etags --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ else \ include_option=--include; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && \ tags="$$tags $$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; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ 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; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = . distdir = $(PACKAGE)-$(VERSION) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print distdir: $(DISTFILES) @case `sed 15q $(srcdir)/NEWS` in \ *"$(VERSION)"*) : ;; \ *) \ echo "NEWS not updated; not releasing" 1>&2; \ exit 1;; \ esac $(am__remove_distdir) mkdir $(distdir) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" \ distdir=../$(distdir)/$$subdir \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -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 $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(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 $(am__remove_distdir) GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && 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 ../.. && $(mkinstalldirs) "$$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-gzip \ && rm -f $(distdir).tar.gz \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @echo "$(distdir).tar.gz is ready for distribution" | \ sed 'h;s/./=/g;p;x;p;x' distuninstallcheck: @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 config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_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 mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: info: info-recursive info-am: install-data-am: install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf autom4te.cache 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-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ clean-generic clean-recursive ctags ctags-recursive dist \ dist-all dist-gzip dist-zip distcheck distclean \ distclean-generic distclean-hdr distclean-recursive \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am dvi-recursive info info-am info-recursive install \ install-am install-data install-data-am install-data-recursive \ install-exec install-exec-am install-exec-recursive \ install-info install-info-am install-info-recursive install-man \ install-recursive install-strip installcheck installcheck-am \ installdirs installdirs-am installdirs-recursive \ maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-recursive pdf pdf-am pdf-recursive ps ps-am \ ps-recursive tags tags-recursive uninstall uninstall-am \ uninstall-info-am uninstall-info-recursive uninstall-recursive # 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: labrea-2.5-stable-1.orig/NEWS0100644000550600055060000001277407750020106014745 0ustar tonontonon2.5-stable-1 -Just 2.5-beta-2 all over again. 2.5-beta-2 -This is the release where we changed the cmd line parameters (again -( ). -Unit tested on Win2K, Win98, linux, FreeBSD, Solaris -Add support for libdnet-1.7. Since libdnet's API is cleaner, lbio became simpler (good). But the "-i" parameter in windows now is standard, and the -j parameter now refers to the WinPcap device. Sorry about this change. -There was an integer overflow problem that had to be dealt with. At the same time, we decided to change --max-rate (-p) parameter to assume input is in units of Kbits to avoid dealing with large bandwidths expressed in bytes. Keep internal totals in KByte units. Set an upper limit on max-rate to avoid integer overflows during calculations. Upper limit is currently 1 GByte/sec = 8 Gbits/sec. Sorry if this change causes inconvenience. -Corrected problem with timer pop so that bandwidth usage will be reported. Certain OSs were not working properly. 2.5-beta-1 - Unit tested on Win98, WinME, WinXP, linux, OpenBSD, Solaris - Added debugging support. Has to be compiled into the pgm via ./configure --enable-debug. Then is controlled with cmd line --debug parameter. 2.5-alpha-1 - Add support for automake, autoconf - Make code depend on libdnet. Use libdnet defines throughout the code. - (dynamic firewall ports) If ports are firewalled (ie no RST), then activity above a certain threshold will make a port start to respond. - The firewall code now checks the dest port on all incoming TCP packets. - Filter changed to make pgm will only hear packets *sent* to the bogus MAC address instead of all packets. - Responses will seem to come from the bogus virtual machine instead of the actual MAC address of the labrea server. - (arp sweeps) Pgm does an arp sweep of the capture subnet to try to locate live machines. A new parameter was added to turn this behaviour off if desired. For the arp sweep to happen, the capture subnet must be a "reasonable" size. Arps are sent out in batches of 80 at a time, at 1 - 2 minute intervals. - Pgm now takes notes of replies to Arp WHO-HAS and will leave these addresses alone (ie "new kid"). - The "new kids on the block" logic was converted to use an array instead of a linked list. This should speed up the pgm and simplify the logic at the expense of storage. The "new kids" culling logic was moved into the timer signal handler code so that the new kid list is run at regular intervals but not at each arp. - The persistent connection logic was changed (newthisminute) so that the decision is made based on b/w and not just number of connections. - Test mode now logs on sysout. Test mode will not fork a child. - Pgm accepts long options at invocation (ie "--my-option"). Usage function was modified to show the long options. - Pgm will attempt to parse all input before bailing out. - Pcap_dispatch is used instead of Pcap_loop. This makes the pgm more efficient but less responsive to signals on certain operating systems. - "-m" parameter is still supported but "-n" can understand a CIDR format IP address (ie xxx.xxx.xxx.xxx/nn) - Catastrophic execution error messages go to std error. (warnx) - Old style config files are no longer supported. - "PMN" directive added to config file to force a port to be monitored. - IPI config statement was changed to be in CIDR notation (xx.xx.xx.xx/nn). The IP ignore list is now a linked list of libdnet addr structures. - Pgm logic was restructured. Globals were mostly moved into static structures. Enums were used instead of defines. Some #ifdefs were replaced by conditional statements. Message strings were moved back into the main code. Externs and gotos were eliminated. queue.h support was used for linked lists. - Signal handling was changed to set a flag only. Signal processing logic is driven by this flag off the mainline loop. - Logging to syslog starts after the pgm's initialisation is completed. - Added utility print function to centralize all messages and logging. - bget functions used for dynamic memory allocation. Runs faster than native support on some operating systems. *** Windows-specific *** - Windows version was developed on Cygwin / Mingw. Autoconf support was added for Windows. - Syslog support for Windows Event file as well as logging to a remote syslog daemon now works. If remote syslog doesn't work, then fails over to local event log. On Win98 / WinME, an attempt to log to the non-existent local event log causes an error message. - Remote syslog code (which was shamelessly borrowed from snort) was modified to open the socket (with possible accompanying DNS search) once at pgm startup, instead of for each new message. - A new parameter "-j" was added to select the WinPcap driver. The libdnet intf rtns support "-i" as is the case under Unix. The libdnet rtns are used to determine interface Mac and IP addresses. - A new parameter "-D" allows the user to obtain a display of all the libdnet and WinPcap devices. The display also shows the default devices. - On Windows, by default logging is to stdout, not syslog. ## $Id: NEWS,v 1.3 2003/09/12 21:23:39 lorgor Exp $ labrea-2.5-stable-1.orig/TODO0100644000550600055060000000043507750020355014733 0ustar tonontonon *** *** List of things to do *** - Get labrea to run with latest Winpcap (ie V3.x) - With parameter '-l', check that messages aren't flushed between the time the daemon starts up and the time that the logging is moved over to syslog. - Make labrea run as a service on Windows. labrea-2.5-stable-1.orig/aclocal.m40100644000550600055060000007472407750021603016114 0ustar tonontonon# generated automatically by aclocal 1.7.5 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 # 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. # Do all the work for Automake. -*- Autoconf -*- # 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. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 10 AC_PREREQ([2.54]) # Autoconf 2.50 wants to disallow AM_ names. We explicitly allow # the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl # 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_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) 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 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) AM_MISSING_PROG(AMTAR, tar) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP # 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([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 ]) ]) # 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_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $1 | $1:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # Copyright 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 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. AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.7.5])]) # Helper functions for option handling. -*- Autoconf -*- # Copyright 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 2 # _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], [AC_FOREACH([_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. # # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 # 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 # 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)]) # -*- Autoconf -*- # Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 # 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 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # 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 ]) # AM_AUX_DIR_EXPAND # Copyright 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # 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. # Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50]) AC_DEFUN([AM_AUX_DIR_EXPAND], [ # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. # Copyright 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # AM_PROG_INSTALL_STRIP # Copyright 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # 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="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # -*- Autoconf -*- # Copyright (C) 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 1 # 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])]) # serial 5 -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # 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], 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 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 for depmode in $am_compiler_list; do # 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. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in 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 ;; none) break ;; esac # 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. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \ >/dev/null 2>conftest.err && grep conftest.h 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 # (even with -Werror). So we grep stderr for any message # that says an option was ignored. if grep 'ignoring option' 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 builds --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]) ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. #serial 2 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; 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. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n -e '/^U = / s///p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # 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 -e ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //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"]) ]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 2 # 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 done .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 # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright 1997, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 5 AC_PREREQ(2.52) # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) 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])]) # Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. AC_PREREQ([2.52]) # serial 6 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) labrea-2.5-stable-1.orig/config.guess0100555000550600055060000012066507702622044016571 0ustar tonontonon#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. timestamp='2003-05-09' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 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. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mipseb-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; DRS?6000:UNIX_SV:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c \ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && exit 0 echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then # avoid double evaluation of $set_cc_for_build test -n "$CC_FOR_BUILD" || eval $set_cc_for_build if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*|*:GNU/FreeBSD:*:*) # Determine whether the default compiler uses glibc. eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #if __GLIBC__ >= 2 LIBC=gnu #else LIBC= #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:3*) echo i586-pc-interix3 exit 0 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit 0 ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) case `uname -p` in *86) UNAME_PROCESSOR=i686 ;; powerpc) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: labrea-2.5-stable-1.orig/config.h.in0100644000550600055060000000601407750022020016254 0ustar tonontonon/* config.h.in. Generated from configure.in by autoheader. */ /* Turn on debugging */ #undef DEBUG_LB /* Define if strlcpy is missing */ #undef DONT_HAVE_STRLCPY /* Define to 1 if you have the header file. */ #undef HAVE_ERR_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_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 `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_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_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the header file. */ #undef HAVE_WINDOWS_H /* Define to 1 if you have the header file. */ #undef HAVE_WINSOCK_H /* Location of configuration file. */ #undef LABREA_CONF /* Define if system is Solaris */ #undef LB_SYSTEM_IS_SUN /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME /* Define for faster code generation. */ #undef WIN32_LEAN_AND_MEAN /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `long' if does not define. */ #undef off_t /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned' if does not define. */ #undef size_t /* Extra includes. */ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef DONT_HAVE_STRLCPY size_t strlcpy(char *, const char *, size_t); #endif labrea-2.5-stable-1.orig/config.sub0100555000550600055060000007247407702622044016240 0ustar tonontonon#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. timestamp='2003-05-09' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 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. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k \ | m32r | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | msp430 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* \ | m32r-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | msp430-* \ | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nv1) basic_machine=nv1-cray os=-unicosmp ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i686-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic4x | c4x*) basic_machine=tic4x-unknown os=-coff ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: labrea-2.5-stable-1.orig/configure0100755000550600055060000054363007750022021016153 0ustar tonontonon#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for LaBrea 2.5-stable-1. # # Report bugs to . # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='LaBrea' PACKAGE_TARNAME='labrea' PACKAGE_VERSION='2.5-stable-1' PACKAGE_STRING='LaBrea 2.5-stable-1' PACKAGE_BUGREPORT='lorgor@users.sourceforge.net' ac_unique_file="src/labrea.c" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LN_S RANLIB ac_ct_RANLIB LIBOBJS PCAPINC PCAPLIB DNETINC DNETLIB CPP EGREP LABREA_CONF LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures LaBrea 2.5-stable-1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of LaBrea 2.5-stable-1:";; esac cat <<\_ACEOF Optional Features: --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 builds --enable-dependency-tracking Do not reject slow dependency extractors --enable-debug enable debugging options (bugreports and developers only) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-libpcap=DIR use libpcap in DIR --with-libdnet=DIR use libdnet in DIR Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF LaBrea configure 2.5-stable-1 generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by LaBrea $as_me 2.5-stable-1, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core core.* *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` am__api_version="1.7" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # 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". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi 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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi 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 # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # 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='labrea' VERSION='2.5-stable-1' # 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"} AMTAR=${AMTAR-"${am_missing_run}tar"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # 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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. ac_config_headers="$ac_config_headers config.h" if test "$prefix" = "NONE"; then prefix="/usr/local" fi echo "$as_me:$LINENO: checking for target os" >&5 echo $ECHO_N "checking for target os... $ECHO_C" >&6 case $host in *-*-cygwin*) LB_CYGWIN="yes" ;; *-*-solaris*) cat >>confdefs.h <<\_ACEOF #define LB_SYSTEM_IS_SUN 1 _ACEOF LB_CYGWIN="no" ;; *) LB_CYGWIN="no" ;; esac echo "$as_me:$LINENO: result: $host_os" >&5 echo "${ECHO_T}$host_os" >&6 echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out 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. echo "$as_me:$LINENO: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6 rm -f confinc confmf # Check whether --enable-dependency-tracking or --disable-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 depcc="$CC" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 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 for depmode in $am_compiler_list; do # 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. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in 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 ;; none) break ;; esac # 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. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \ >/dev/null 2>conftest.err && grep conftest.h 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 # (even with -Werror). So we grep stderr for any message # that says an option was ignored. if grep 'ignoring option' 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 echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$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 # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi if test "$LB_CYGWIN" = yes ; then if test -d /usr/include/mingw; then CPPFLAGS="$CPPFLAGS -mno-cygwin" CFLAGS="$CFLAGS -mno-cygwin" cat >>confdefs.h <<\_ACEOF #define WIN32_LEAN_AND_MEAN 1 _ACEOF LIBOBJS="$LIBOBJS syslog.$ac_objext" else { { echo "$as_me:$LINENO: error: need MingW32 package to build under Cygwin" >&5 echo "$as_me: error: need MingW32 package to build under Cygwin" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:$LINENO: checking for libpcap" >&5 echo $ECHO_N "checking for libpcap... $ECHO_C" >&6 # Check whether --with-libpcap or --without-libpcap was given. if test "${with_libpcap+set}" = set; then withval="$with_libpcap" case "$withval" in yes|no) echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 ;; *) echo "$as_me:$LINENO: result: $withval" >&5 echo "${ECHO_T}$withval" >&6 if test -f $withval/pcap.h -a -f $withval/libpcap.a; then owd=`pwd` if cd $withval; then withval=`pwd`; cd $owd; fi PCAPINC="-I$withval -I$withval/bpf" PCAPLIB="-L$withval -lpcap" elif test -f $withval/include/pcap.h -a \ -f $withval/include/net/bpf.h; then owd=`pwd` if cd $withval; then withval=`pwd`; cd $owd; fi PCAPINC="-I$withval/include" if test -f $withval/lib/libwpcap.a; then PCAPLIB="-L$withval/lib -lwpcap" else PCAPLIB="-L$withval/lib -lpcap" fi else { { echo "$as_me:$LINENO: error: pcap.h" >&5 echo "$as_me: error: pcap.h" >&2;} { (exit net/bpf.h); exit net/bpf.h; }; } fi ;; esac else if test -f ${prefix}/include/pcap.h; then PCAPINC="-I${prefix}/include" if test -f ${prefix}/lib/libwpcap.a; then PCAPLIB="-L${prefix}/lib -lwpcap" else PCAPLIB="-L${prefix}/lib -lpcap" fi elif test -f /usr/include/pcap/pcap.h; then PCAPINC="-I/usr/include/pcap" PCAPLIB="-lpcap" elif test -f /usr/include/pcap.h; then PCAPLIB="-lpcap" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: libpcap not found" >&5 echo "$as_me: error: libpcap not found" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 fi; echo "$as_me:$LINENO: checking for libdnet" >&5 echo $ECHO_N "checking for libdnet... $ECHO_C" >&6 # Check whether --with-libdnet or --without-libdnet was given. if test "${with_libdnet+set}" = set; then withval="$with_libdnet" case "$withval" in yes|no) echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 ;; *) echo "$as_me:$LINENO: result: $withval" >&5 echo "${ECHO_T}$withval" >&6 if test -f $withval/src/libdnet.a; then DNETINC="-I$withval/include" DNETLIB="-L$withval/src -ldnet `$withval/dnet-config --libs`" elif test -x $withval/bin/dnet-config; then DNETINC="`$withval/bin/dnet-config --cflags`" DNETLIB="`$withval/bin/dnet-config --libs`" else { { echo "$as_me:$LINENO: error: dnet-config not found in $withval/bin" >&5 echo "$as_me: error: dnet-config not found in $withval/bin" >&2;} { (exit 1); exit 1; }; } fi ;; esac else if test -x ${prefix}/bin/dnet-config; then DNETINC="`${prefix}/bin/dnet-config --cflags`" DNETLIB="`${prefix}/bin/dnet-config --libs`" else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { { echo "$as_me:$LINENO: error: libdnet not found" >&5 echo "$as_me: error: libdnet not found" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 fi; ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f 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 >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* 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 >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in fcntl.h getopt.h err.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/ioctl.h syslog.h time.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in windows.h winsock.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc in yes:no ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; no:yes ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ( cat <<\_ASBOX ## ------------------------------------ ## ## Report this to bug-autoconf@gnu.org. ## ## ------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; char **p; /* 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"; ccp = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++ccp; p = (char**) ccp; ccp = (char const *const *) p; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 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; } #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi echo "$as_me:$LINENO: checking for off_t" >&5 echo $ECHO_N "checking for off_t... $ECHO_C" >&6 if test "${ac_cv_type_off_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((off_t *) 0) return 0; if (sizeof (off_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_off_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_off_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 echo "${ECHO_T}$ac_cv_type_off_t" >&6 if test $ac_cv_type_off_t = yes; then : else cat >>confdefs.h <<_ACEOF #define off_t long _ACEOF fi echo "$as_me:$LINENO: checking for pid_t" >&5 echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 if test "${ac_cv_type_pid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((pid_t *) 0) return 0; if (sizeof (pid_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_pid_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_pid_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 echo "${ECHO_T}$ac_cv_type_pid_t" >&6 if test $ac_cv_type_pid_t = yes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi echo "$as_me:$LINENO: checking for size_t" >&5 echo $ECHO_N "checking for size_t... $ECHO_C" >&6 if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((size_t *) 0) return 0; if (sizeof (size_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 echo "${ECHO_T}$ac_cv_type_size_t" >&6 if test $ac_cv_type_size_t = yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned _ACEOF fi echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 _ACEOF fi echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct tm *tp; tp->tm_sec; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_struct_tm=time.h else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 echo "${ECHO_T}$ac_cv_struct_tm" >&6 if test $ac_cv_struct_tm = sys/time.h; then cat >>confdefs.h <<\_ACEOF #define TM_IN_SYS_TIME 1 _ACEOF fi if test $ac_cv_c_compiler_gnu = yes; then echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 if test "${ac_cv_prog_gcc_traditional+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi if test "$GCC" = yes; then CFLAGS="$CFLAGS -Wall" fi echo "$as_me:$LINENO: checking for working memcmp" >&5 echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6 if test "${ac_cv_func_memcmp_working+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_memcmp_working=no else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* Some versions of memcmp are not 8-bit clean. */ char c0 = 0x40, c1 = 0x80, c2 = 0x81; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) exit (1); /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) exit (1); } exit (0); } ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_memcmp_working=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_memcmp_working=no fi rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6 test $ac_cv_func_memcmp_working = no && LIBOBJS="$LIBOBJS memcmp.$ac_objext" echo "$as_me:$LINENO: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #ifdef signal # undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); #else void (*signal ()) (); #endif int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_signal=int fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF for ac_func in strstr strtol do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for strlcpy" >&5 echo $ECHO_N "checking for strlcpy... $ECHO_C" >&6 if test "${ac_cv_func_strlcpy+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, which can conflict with char strlcpy (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strlcpy (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_strlcpy) || defined (__stub___strlcpy) choke me #else char (*f) () = strlcpy; #endif #ifdef __cplusplus } #endif int main () { return f != strlcpy; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_strlcpy=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_strlcpy=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_strlcpy" >&5 echo "${ECHO_T}$ac_cv_func_strlcpy" >&6 if test $ac_cv_func_strlcpy = yes; then : else LIBOBJS="$LIBOBJS strlcpy.$ac_objext" cat >>confdefs.h <<\_ACEOF #define DONT_HAVE_STRLCPY 1 _ACEOF fi echo "$as_me:$LINENO: checking for gnu getopt support" >&5 echo $ECHO_N "checking for gnu getopt support... $ECHO_C" >&6 case $host in *-*-*gnu*) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 ;; *) LIBOBJS="$LIBOBJS getopt.$ac_objext" LIBOBJS="$LIBOBJS getopt1.$ac_objext" echo "$as_me:$LINENO: result: no - supplying missing getopt" >&5 echo "${ECHO_T}no - supplying missing getopt" >&6;; esac if test "$LB_CYGWIN" = yes ; then LABREA_CONF="LaBrea.cfg" else LABREA_CONF=`eval echo ${sysconfdir}/labrea.conf` fi cat >>confdefs.h <<_ACEOF #define LABREA_CONF "$LABREA_CONF" _ACEOF echo "$as_me:$LINENO: checking if debug should be enabled" >&5 echo $ECHO_N "checking if debug should be enabled... $ECHO_C" >&6 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" cat >>confdefs.h <<\_ACEOF #define DEBUG_LB 1 _ACEOF echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi; ac_config_files="$ac_config_files Makefile src/Makefile inc/Makefile misc/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, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by LaBrea $as_me 2.5-stable-1, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ LaBrea config.status 2.5-stable-1 configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "inc/Makefile" ) CONFIG_FILES="$CONFIG_FILES inc/Makefile" ;; "misc/Makefile" ) CONFIG_FILES="$CONFIG_FILES misc/Makefile" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@CYGPATH_W@,$CYGPATH_W,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@AMTAR@,$AMTAR,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@DEPDIR@,$DEPDIR,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t s,@LN_S@,$LN_S,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@PCAPINC@,$PCAPINC,;t t s,@PCAPLIB@,$PCAPLIB,;t t s,@DNETINC@,$DNETINC,;t t s,@DNETLIB@,$DNETLIB,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@LABREA_CONF@,$LABREA_CONF,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi # Compute $ac_file's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $ac_file | $ac_file:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || $as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X$ac_file : 'X\(//\)[^/]' \| \ X$ac_file : 'X\(//\)$' \| \ X$ac_file : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X$ac_file | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'`/stamp-h$_am_stamp_count done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; 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. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`(dirname "$mf") 2>/dev/null || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || 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 grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n -e '/^U = / s///p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # 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 -e ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //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=`(dirname "$file") 2>/dev/null || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p $dirpart/$fdir else as_dir=$dirpart/$fdir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: 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 || { (exit 1); exit 1; } fi labrea-2.5-stable-1.orig/configure.in0100644000550600055060000001214107750020454016551 0ustar tonontonondnl dnl configure.in dnl dnl Copyright (c) 2001 Dug Song dnl dnl $Id: configure.in,v 1.3 2003/09/12 21:23:39 lorgor Exp $ dnl Process this file with autoconf to produce a configure script. AC_INIT(LaBrea,2.5-stable-1,lorgor@users.sourceforge.net,labrea) AC_CONFIG_SRCDIR(src/labrea.c) AC_CANONICAL_HOST AM_INIT_AUTOMAKE(check-news dist-zip no-define 1.6.1) AM_CONFIG_HEADER(config.h) dnl Initialize prefix. if test "$prefix" = "NONE"; then prefix="/usr/local" fi dnl Check for system type AC_MSG_CHECKING(for target os) case $host in *-*-cygwin*) LB_CYGWIN="yes" ;; *-*-solaris*) AC_DEFINE(LB_SYSTEM_IS_SUN,1, [Define if system is Solaris]) LB_CYGWIN="no" ;; *) LB_CYGWIN="no" ;; esac AC_MSG_RESULT($host_os) dnl Checks for programs. AC_PROG_MAKE_SET AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_RANLIB dnl Checks for libraries. dnl XXX - we need MingW32 under Cygwin for win32 if test "$LB_CYGWIN" = yes ; then if test -d /usr/include/mingw; then CPPFLAGS="$CPPFLAGS -mno-cygwin" CFLAGS="$CFLAGS -mno-cygwin" AC_DEFINE(WIN32_LEAN_AND_MEAN, 1, [Define for faster code generation.]) AC_LIBOBJ(syslog) else AC_MSG_ERROR([need MingW32 package to build under Cygwin]) fi fi dnl Checks for libpcap AC_MSG_CHECKING(for libpcap) AC_ARG_WITH(libpcap, [ --with-libpcap=DIR use libpcap in DIR], [ case "$withval" in yes|no) AC_MSG_RESULT(no) ;; *) AC_MSG_RESULT($withval) if test -f $withval/pcap.h -a -f $withval/libpcap.a; then owd=`pwd` if cd $withval; then withval=`pwd`; cd $owd; fi PCAPINC="-I$withval -I$withval/bpf" PCAPLIB="-L$withval -lpcap" elif test -f $withval/include/pcap.h -a \ -f $withval/include/net/bpf.h; then owd=`pwd` if cd $withval; then withval=`pwd`; cd $owd; fi PCAPINC="-I$withval/include" if test -f $withval/lib/libwpcap.a; then PCAPLIB="-L$withval/lib -lwpcap" else PCAPLIB="-L$withval/lib -lpcap" fi else AC_ERROR(pcap.h, net/bpf.h, or libpcap.a not found in $withval) fi ;; esac ], [ if test -f ${prefix}/include/pcap.h; then PCAPINC="-I${prefix}/include" if test -f ${prefix}/lib/libwpcap.a; then PCAPLIB="-L${prefix}/lib -lwpcap" else PCAPLIB="-L${prefix}/lib -lpcap" fi elif test -f /usr/include/pcap/pcap.h; then PCAPINC="-I/usr/include/pcap" PCAPLIB="-lpcap" elif test -f /usr/include/pcap.h; then PCAPLIB="-lpcap" else AC_MSG_RESULT(no) AC_ERROR(libpcap not found) fi AC_MSG_RESULT(yes) ] ) AC_SUBST(PCAPINC) AC_SUBST(PCAPLIB) dnl Checks for (installed) libdnet AC_MSG_CHECKING(for libdnet) AC_ARG_WITH(libdnet, [ --with-libdnet=DIR use libdnet in DIR], [ case "$withval" in yes|no) AC_MSG_RESULT(no) ;; *) AC_MSG_RESULT($withval) if test -f $withval/src/libdnet.a; then DNETINC="-I$withval/include" DNETLIB="-L$withval/src -ldnet `$withval/dnet-config --libs`" elif test -x $withval/bin/dnet-config; then DNETINC="`$withval/bin/dnet-config --cflags`" DNETLIB="`$withval/bin/dnet-config --libs`" else AC_ERROR(dnet-config not found in $withval/bin) fi ;; esac ], [ if test -x ${prefix}/bin/dnet-config; then DNETINC="`${prefix}/bin/dnet-config --cflags`" DNETLIB="`${prefix}/bin/dnet-config --libs`" else AC_MSG_RESULT(no) AC_ERROR(libdnet not found) fi AC_MSG_RESULT(yes) ] ) AC_SUBST(DNETINC) AC_SUBST(DNETLIB) dnl Checks for header files AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h getopt.h err.h) AC_CHECK_HEADERS(sys/ioctl.h syslog.h time.h unistd.h) AC_CHECK_HEADERS(windows.h winsock.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM AC_PROG_GCC_TRADITIONAL if test "$GCC" = yes; then CFLAGS="$CFLAGS -Wall" fi dnl Checks for library functions. AC_FUNC_MEMCMP AC_TYPE_SIGNAL AC_CHECK_FUNCS(strstr strtol) AC_CHECK_FUNC(strlcpy,, [AC_LIBOBJ(strlcpy) AC_DEFINE(DONT_HAVE_STRLCPY,1, [Define if strlcpy is missing])]) dnl If not GNU, then replace getopt AC_MSG_CHECKING(for gnu getopt support) case $host in *-*-*gnu*) AC_MSG_RESULT(yes) ;; *) AC_LIBOBJ(getopt) AC_LIBOBJ(getopt1) AC_MSG_RESULT([no - supplying missing getopt]);; esac dnl Set system-wide configuration file. if test "$LB_CYGWIN" = yes ; then LABREA_CONF="LaBrea.cfg" else LABREA_CONF=`eval echo ${sysconfdir}/labrea.conf` fi AC_SUBST(LABREA_CONF) AC_DEFINE_UNQUOTED(LABREA_CONF, "$LABREA_CONF", [Location of configuration file.]) dnl Set debug output AC_MSG_CHECKING(if debug should be enabled) AC_ARG_ENABLE(debug, [ --enable-debug enable debugging options (bugreports and developers only)], [ AC_DEFINE(DEBUG_LB,1,[Turn on debugging]) AC_MSG_RESULT(yes) ], [ AC_MSG_RESULT(no) ]) dnl From old accconfig.h file AH_BOTTOM([ /* Extra includes. */ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef DONT_HAVE_STRLCPY size_t strlcpy(char *, const char *, size_t); #endif ]) AC_OUTPUT(Makefile src/Makefile inc/Makefile misc/Makefile) labrea-2.5-stable-1.orig/depcomp0100555000550600055060000003176707702622044015632 0ustar tonontonon#! /bin/sh # depcomp - compile a program generating dependencies as side-effects # Copyright 1999, 2000 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, 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. # Originally written by Alexandre Oliva . 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 # `libtool' can also be set to `yes' or `no'. if test -z "$depfile"; then base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` dir=`echo "$object" | sed 's,/.*$,/,'` if test "$dir" = "$object"; then dir= fi # FIXME: should be _deps on DOS. depfile="$dir.deps/$base" fi 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 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. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" 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. 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. stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" outname="$stripped.o" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi 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,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$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) # Must come before tru64. # Intel's C compiler understands `-MD -MF file'. However # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # 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: "$@" -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'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^[^:]*: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; 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 tmpdepfile1="$dir.libs/$base.lo.d" tmpdepfile2="$dir.libs/$base.d" "$@" -Wc,-MD else tmpdepfile1="$dir$base.o.d" tmpdepfile2="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" else tmpdepfile="$tmpdepfile2" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a space and a tab 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 proprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--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 $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac 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. -*|$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 proprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--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 '/^# [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 proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 labrea-2.5-stable-1.orig/install-sh0100555000550600055060000001572207702622044016252 0ustar tonontonon#!/bin/sh # # install - install a program, script, or datafile # # 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. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd=$cpprog shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "$0: no input file specified" >&2 exit 1 else : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d "$dst" ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f "$src" ] || [ -d "$src" ] then : else echo "$0: $src does not exist" >&2 exit 1 fi if [ x"$dst" = x ] then echo "$0: no destination specified" >&2 exit 1 else : fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d "$dst" ] then dst=$dst/`basename "$src"` else : fi fi ## this sed command emulates the dirname command dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` IFS=$oIFS pathcomp='' while [ $# -ne 0 ] ; do pathcomp=$pathcomp$1 shift if [ ! -d "$pathcomp" ] ; then $mkdirprog "$pathcomp" else : fi pathcomp=$pathcomp/ done fi if [ x"$dir_arg" != x ] then $doit $instcmd "$dst" && if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename "$dst"` else dstfile=`basename "$dst" $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename "$dst"` else : fi # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/#inst.$$# rmtmp=$dstdir/#rm.$$# # Trap to clean up temp files at exit. trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 # Move or copy the file name to the temp name $doit $instcmd "$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 $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && # 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. { if [ -f "$dstdir/$dstfile" ] then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" fi && # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit } labrea-2.5-stable-1.orig/missing0100555000550600055060000002403607702622044015643 0ustar tonontonon#! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright (C) 1996, 1997, 1999, 2000, 2002 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, 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. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # 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 case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -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' 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]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing 0.4 - GNU automake" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. 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) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. 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) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. 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*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. 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) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. You can get \`$1Help2man' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 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' is missing on your system. 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 [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. 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 [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. 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 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. 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." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # 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 you do not seem to have it handy on your system. 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 prerequirements 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 labrea-2.5-stable-1.orig/mkinstalldirs0100555000550600055060000000370407702622044017051 0ustar tonontonon#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain errstatus=0 dirmode="" usage="\ Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" 1>&2 exit 0 ;; -m) # -m PERM arg shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } dirmode=$1 shift ;; --) # stop option processing shift break ;; -*) # unknown option echo "$usage" 1>&2 exit 1 ;; *) # first non-opt arg break ;; esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac case $dirmode in '') if mkdir -p -- . 2>/dev/null; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" fi ;; *) if mkdir -m "$dirmode" -p -- . 2>/dev/null; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" fi ;; esac for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case $pathcomp in -*) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr="" chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp="$pathcomp/" done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 # End: # mkinstalldirs ends here labrea-2.5-stable-1.orig/misc/0040777000550600055060000000000007750022577015213 5ustar tonontononlabrea-2.5-stable-1.orig/misc/Makefile.am0100644000550600055060000000070607607335677017254 0ustar tonontonon## Process this file with automake to produce Makefile.in ## ## $Id: Makefile.am,v 1.1.1.1 2003/01/09 18:13:19 lorgor Exp $ man_MANS = labrea.1 labrea.conf.5 labrea.1.txt: labrea.1 groff -t -e -man -Tascii labrea.1 | col -bx > $@ labrea.conf.5.txt: labrea.conf.5 groff -t -e -man -Tascii labrea.conf.5 | col -bx > $@ sysconf_DATA = labrea.conf EXTRA_DIST = DSong-LICENSE labrea.conf labrea.1.txt labrea.conf.5.txt $(man_MANS) DISTCLEANFILES = *~ labrea-2.5-stable-1.orig/misc/Makefile.in0100644000550600055060000002562607750022034017250 0ustar tonontonon# Makefile.in generated by automake 1.7.5 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # 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@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = : host_triplet = @host@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DNETINC = @DNETINC@ DNETLIB = @DNETLIB@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LABREA_CONF = @LABREA_CONF@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCAPINC = @PCAPINC@ PCAPLIB = @PCAPLIB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ man_MANS = labrea.1 labrea.conf.5 sysconf_DATA = labrea.conf EXTRA_DIST = DSong-LICENSE labrea.conf labrea.1.txt labrea.conf.5.txt $(man_MANS) DISTCLEANFILES = *~ subdir = misc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = NROFF = nroff MANS = $(man_MANS) DATA = $(sysconf_DATA) DIST_COMMON = Makefile.am Makefile.in all: all-am .SUFFIXES: $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu misc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) uninstall-info-am: man1dir = $(mandir)/man1 install-man1: $(man1_MANS) $(man_MANS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(man1dir) @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ *) ext='1' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ done uninstall-man1: @$(NORMAL_UNINSTALL) @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ *) ext='1' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ rm -f $(DESTDIR)$(man1dir)/$$inst; \ done man5dir = $(mandir)/man5 install-man5: $(man5_MANS) $(man_MANS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(man5dir) @list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.5*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 5*) ;; \ *) ext='5' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst"; \ $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst; \ done uninstall-man5: @$(NORMAL_UNINSTALL) @list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.5*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 5*) ;; \ *) ext='5' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f $(DESTDIR)$(man5dir)/$$inst"; \ rm -f $(DESTDIR)$(man5dir)/$$inst; \ done sysconfDATA_INSTALL = $(INSTALL_DATA) install-sysconfDATA: $(sysconf_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(sysconfdir) @list='$(sysconf_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(sysconfDATA_INSTALL) $$d$$p $(DESTDIR)$(sysconfdir)/$$f"; \ $(sysconfDATA_INSTALL) $$d$$p $(DESTDIR)$(sysconfdir)/$$f; \ done uninstall-sysconfDATA: @$(NORMAL_UNINSTALL) @list='$(sysconf_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(sysconfdir)/$$f"; \ rm -f $(DESTDIR)$(sysconfdir)/$$f; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$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 $(MANS) $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(man1dir) $(DESTDIR)$(man5dir) $(DESTDIR)$(sysconfdir) 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_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-man install-exec-am: install-sysconfDATA install-info: install-info-am install-man: install-man1 install-man5 installcheck-am: maintainer-clean: maintainer-clean-am 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-info-am uninstall-man uninstall-sysconfDATA uninstall-man: uninstall-man1 uninstall-man5 .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am info info-am install \ install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-man1 install-man5 install-strip install-sysconfDATA \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am uninstall-info-am \ uninstall-man uninstall-man1 uninstall-man5 \ uninstall-sysconfDATA labrea.1.txt: labrea.1 groff -t -e -man -Tascii labrea.1 | col -bx > $@ labrea.conf.5.txt: labrea.conf.5 groff -t -e -man -Tascii labrea.conf.5 | col -bx > $@ # 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: labrea-2.5-stable-1.orig/misc/DSong-LICENSE0100644000550600055060000000273307607335677017237 0ustar tonontonon Copyright (c) 2001, 2002 Dug Song All rights reserved, all wrongs reversed. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors and copyright holders may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. labrea-2.5-stable-1.orig/misc/labrea.conf0100644000550600055060000000222707607335677017315 0ustar tonontonon# # Sample Labrea configuration file. # # Default location is /etc on unix systems. # == Exclude the specified address(es) == # This means that Labrea is to never capture this IP # address. Any ARP WHO-HAS requests or attempts to start a # session with these IP addresses will be ignored. #192.168.33.1-192.168.33.5 EXC # == Hard exclude the specified address(es) == # This means that Labrea is never to "hard capture" this IP # address. In other words, the pgm must always wait for the ARP # timeout each time someone else wants to start a session with # this IP. #192.168.33.20 HAR # == Ignore any packets coming from these IP addresses == # LaBrea will ignore any packets with IP source address included # in the specified range. #192.168.33.48/29 IPI # == Ignore ports == # Ports in the specified range will be ignored. No tarpitting or # persist capturing will be done for these ports. #27-333 POR # == Active ports == # The specified ports will always be monitored for connection # attempts, and will respond. Tarpitting and persist capturing # will be done for these ports. #26 PMN # $Id: labrea.conf,v 1.1.1.1 2003/01/09 18:13:19 lorgor Exp $ labrea-2.5-stable-1.orig/misc/labrea.1.txt0100644000550600055060000003261107750022576017334 0ustar tonontononLABREA(1) LABREA(1) NAME labrea - Honeypot for incoming IP connection attempts SYNOPSIS labrea [-i --device INTERFACE] [-n --network nnn.nnn.nnn.nnn[/nn]] [-m --mask nnn.nnn.nnn.nnn] [-t --throttle-size BYTES] [-p --max-rate RATE ] [-R --soft-restart] [-r --arp-timeout RATE] [-s --switch-safe] [-h --hard-capture] [-x --disable-capture] [-X --exclude-resolvable-ips] [-P --persist-mode-only] [-a --no-resp-synack] [-H --auto-hard-capture] [-f --no-resp-excluded-ports] [--no-arp-sweep] [--init-file FILE] [-F --bpf-file FILE] [-T --dry-run] [-d --foreground] [-o --log-to-stdout] [-O --log-timestamp-epoch] [-l --log-to-syslog] [-b --log-bandwidth] [-v --verbose] [-q --quiet] [-z --no-nag] [-? --usage --help ] [-V --version] [-I --ip-addr nnn.nnn.nnn.nnn] [-E --my-mac-addr xx:xx:xx:xx:xx:xx] [-D --list-interfaces] [-j --winpcap-dev nn] [--sys- log-server nnn.nnn.nnn.nnn] [--syslog-port nnn] [BPF Filter] DESCRIPTION labrea creates virtual machines for unused IP addresses in the speci- fied block of IP addresses. LaBrea sits and listens for ARP "who-has" requests. When an ARP request for a particular IP goes unanswered for longer than its "rate" setting (default: 3 seconds), labrea crafts an ARP reply that routes all traffic destined for the IP to a "bogus" MAC address. labrea sniffs for TCP/IP traffic sent to that MAC address and then responds to any SYN packet with a SYN/ACK packet that it creates. OPTIONS labrea accepts the following options: -i --device interface By default, labrea uses the first ethernet interface. This forces labrea to use the specified interface. -n --network xxx.xxx.xxx.xxx[/nn] labrea normally pulls information about the netblock from the IP information assigned to the interface. If labrea is run on an unconfigured interface (one without an assigned IP address), then use this option to specify the subnet to be captured. xxx.xxx.xxx.xxx is the network address. /nn is the subnet mask in CIDR notation. If the subnet mask is not specified here, then you must include the -m parameter. -m --mask xxx.xxx.xxx.xxx Another way to specify the network mask for the capture net- block. If this parameter is specified, then the -n parameter must also be specified. -t --throttle-size nn Sets the TCP window advertisement to limit the amount of data sent to labrea. The number of data bytes to allow per packet is nn bytes. -p --max-rate rate Connect attempts will be permanently captured by forcing the connection into a "persist" state (by closing the TCP window). In this state, the connection will not time out. labrea will permanently capture connect attempts up to maximum bandwidth rate bytes. If the specified bandwidth is exceeded, labrea will still tarpit the incoming connection (ie respond SYN/ACK to incoming SYN). -R --soft-restart New captures will be held off for 5 minutes to let bandwidth calculations progress. If a major scan hits just after startup, this prevents labrea from capturing too many connections. -r --arp-timeout rate Wait rate seconds after seeing incoming arp requests before cap- turing an IP address. -s --switch-safe When there is an incoming ARP request, specifies that labrea should send out an ARP request of its own for the same IP address. This is necessary for safe operation in a switched environment where one host does not necessarily see all the traffic on the switch. -h --hard-capture Once an IP address has been captured, then do not wait for a "-r" timeout for the next incoming ARP request. -x --disable-capture Do not capture IPs. -X --exclude-resolvable-ips On startup, attempt DNS resolution on all IPs within the capture netblock. Automatically exclude any IP that has a corresponding entry in the DNS. Be careful because this can generate a lot of DNS lookups if the capture subnet is large. -P --persist-mode-only Try to limit bandwidth use by doing only persist capturing. Note: This parameter has limited usefulness since below max b/w, the same exchange that leads to persist capture also has the side effect of tarpitting. -a --no-resp-synack By default, the LaBrea virtual hosts respond to SYN/ACK with RST, and answer Pings. Disables this behaviour. -H --auto-hard-capture Mark all non-excluded and all non-hardexcluded IPs as being hard captured. See labrea.conf(5) for more information. This parame- ter should be used with caution. -f --no-resp-excluded-ports Drop incoming connections to excluded ports. Normal default be- haviour is to return a RST. Makes nmap-style scanning go much slower. --no-arp-sweep On startup, labrea sweeps the capture subnet with bursts of ARP requests in an attempt to locate all live machines. This parame- ter disables the sweep. --init-file file Read the configuration from the specified file instead of from the default location. -F --bpf-file file Designates the name of a file containing a BPF filter pointing to machines/ports to be tarpitted. As with the command line BPF filter, these connections MUST be firewalled to DROP inbound traffic. -T --dry-run Do labrea initialization, including Dns excludes, parse of the configuration file, opening the network interface etc. Print diagnostic information, then exit. -d --foreground Do not detach the process. (Unix systems only) -o --log-to-stdout Send log information to stdout rather than to syslog. This option also implies and sets the -d option (i.e. do not detach process). -O --log-timestamp-epoch Same as the "-o" option, but with time output in seconds since epoch to make it easier for logfile analysis programs. -l --log-to-syslog Send log messages to syslog. -b --log-bandwidth Log a message every minute detailing the current bandwidth con- sumption of the -p option (persist capture). -v --verbose Increase the verbosity of log messages. Use twice for more effect. -q --quiet Do not report arp requests for IPs that are not in the capture subnet. -z --no-nag Turn off the nag message. Before you do this, read the basic warning in the Notes section just below. -? --usage --help Print a help message and then exit. -V --version Print version information and exit. -I --ip-addr nnn.nnn.nnn.nnn Manually specify the IP address for the labrea server. -E --my-mac-addr xx:xx:xx:xx:xx:xx Manually specify the MAC address of the labrea server's NIC. -D --list-interfaces On Windows systems, print the list of WinPcap devices, followed by the list of the libdnet interfaces. Note that each API has a different nomenclature for the underlying NIC. -j --winpcap-dev nn On windows systems, select the nth winpcap device in the list. NOTES Basic Warning about use of labrea You must understand this: As a default, LaBrea captures IP addresses by creating a "virtual machine" that sits on any UNUSED IP address that it sees. labrea has been carefully written and tested to transparently and peacefully operate in normal production environments but ... There is a potential for problems if someone decides to start using one of the IP addresses that labrea has laid claim to, or if labrea erro- neously decides that an IP address is free when in fact a real machine is already there. Built-in protections labrea tries very hard to NEVER capture an IP that has a live machine sitting on it. The following automatic mechanisms are provided: o If labrea sees a gratuitous ARP signalling the arrival of a new machine, it marks the corresponding IP address as excluded. ("new kids on the block" logic) o Each ARP response is noted and the corresponding IP address is marked as excluded. o At startup, a systematic sweep is done of the entire cap- ture subnet (as long as the subnet is not too big). All IP addresses that respond are marked as excluded. Then there are ways of manually specifying the exclusion of certain addresses, and otherwise ensuring safe operation: o The EXC config stmt allows specified IP addresses to be manually excluded from capture. o The IPI config stmt causes packets with the specified IP source address(es) to be ignored. o -s --switch-safe parameter causes mirroring of ARP requests in a switched environment o -X --exclude-resolvable-ips says to exclude all IPs that have a corresponding Dns entry Traffic rerouting: Despite all this, if labrea somehow receives traffic whose IP destination address belongs to a live machine, labrea will reroute that traffic to the real machine. Size of the capture subnet It is best to limit the capture subnet to the actual physical segment (VLAN, hub) where labrea is running. In some configurations, where proxy arp is being used to determine routing, interface subnet masks can be quite large. (i.e. the "whole" network is "directly" attached to the physical segment). In this case, if labrea picks up the subnet mask from the interface, then labrea will inefficiently watch addresses that it has no hope of capturing. You should use the -m / -n parameters to manually limit the size of the capture subnet. Other usage notes The labrea virtual machines use a bogus MAC address of 0:0:f:ff:ff:ff On certain older Windows systems, it may be necessary to manually spec- ify the capture subnet. On unix systems, KILL -USR1 will toggle logging off on and off. On unix systems, KILL -HUP will cause labrea to reinitialize (and thus free captured IPs). If the capture subnet is too large (greater than 1024 addresses), then labrea will not do an arp sweep. BUGS On some systems, if there is absolutely no traffic to sniff, pcap_dis- patch will wait instead of timing out, making the program seem unresponsive. (Workaround: ping the labrea server to "wake" it up.) If --exclude-resolvable-ips is enabled, and if the capture subnet is large (say class A /8), then a LOT of traffic will be generated to the Dns server. EXAMPLES 1) Run safely in a switched environment with very verbose logging. Don't respond to excluded ports. Log bandwidth usage from per- sist capturing. Exclude all IPs that are in the Dns. Run in the foreground, and log to stdout. Maximum capture bandwidth is 2 MB/sec. Use toto.conf as the initialisation file. Use network device "eth1" instead of the default device. Do a test run only - parse input, initialize, then exit. labrea --switch-safe --verbose -v --no-resp-excluded-ports --log-bandwidth --exclude-resolvable-ips --foreground --log-to-stdout --max-rate 2000000 --init-file toto.conf --device eth1 -z --dry-run (one line) 2) Same thing with the short parameter style. labrea -z -s -v -v -f -b -X -d -o -p 2000000 --init-file toto.conf -i eth1 -T (one line) FILES /usr/local/etc/labrea.conf Default configuration file /usr/local/sbin/labrea Program SEE ALSO labrea.conf(5) AUTHOR Tom Liston Bugs: lorgor@users.sourceforge.net or http://labrea.sourceforge.net LABREA(1) labrea-2.5-stable-1.orig/misc/labrea.conf.5.txt0100644000550600055060000002125507633200407020255 0ustar tonontononLABREA.CONF(5) LABREA.CONF(5) NAME labrea.conf - labrea(1) configuration file SYNOPSIS nnn.nnn.nnn.nnn [- nnn.nnn.nnn.nnn] EXC nnn.nnn.nnn.nnn [- nnn.nnn.nnn.nnn] HAR nnn.nnn.nnn.nnn[/nn] IPI nnnnn [- nnnnn] POR nnnnn [- nnnnn] PMN DESCRIPTION Generalities labrea.conf is the configuration file for the labrea(1) program. Each line consists of a selector field, followed by an action verb. Whitespace is suppressed. Blank lines are ignored, as are lines beginning with "#". Selectors IPs can be specified as either a single address (e.g. "192.168.0.4") or as a range of addresses (e.g. "192.168.0.1 - 192.168.0.50"). Ports can be specified as either a single port (e.g. 12345) or as a range of ports (e.g. 1-65535). IP Capturing When labrea sees an ARP request for an unused IP, it does the following: On an IP by IP basis, store a time and an originating IP address: 1. For an incoming ARP request, check the current time: a. If currently stored time is 0 or the arp comes from a different address than the one stored, then store the current time and the requesting IP and return. b. If the stored time is less than "-r" seconds ago, ignore it and return. c. If currently stored time is more than a minute ago, store 0, return. (Max timeout) d. Otherwise, grab the IP. 2. See an ARP reply, set stored time to 0. When an ARP request for a particular IP goes unanswered for longer than its "rate" setting (default: 3 seconds), labrea crafts an ARP reply that routes all traffic des- tined for the IP to a "bogus" MAC address. labrea listens for TCP/IP traffic routed to that MAC address and then responds to any SYN packet (ie incoming connection) with a SYN/ACK packet. Explanation of terms Excluded IPs: Are those IPs that labrea should never cap- ture. Note that automatic mechanisms are also used to pre- vent capturing IPs with an active machine on it. See labrea(1) for more details. Hard captured IPs: The -h --hard-capture option instructs labrea that once it captures an IP address, then it needn't wait for a "-r" timeout the next time around. These IPs are said to be "hard" captured. Hard excluded IPS: These are IPs that should never be "hard" captured. In other words, each time there is an ARP request for this IP, then labrea will always wait for the timeout -r secs before responding. Tarpitting: On a captured IP, labrea responds to an incom- ing SYN connection attempt with a SYN/ACK. This causes the remote machine's stack to initiate the Tcp connection and then waste time fruitlessly trying to continue the conver- sation. Persist state capture: labrea can permanently capture con- nect attempts by closing the TCP window to force the con- nection into "persist" state. In this state, the connec- tion never times out, and labrea hangs on to the incoming connection until it is closed from the other end. To accomplish this, short packets are sent every so often to say "keep waiting, my Tcp window is still closed". So a maximum b/w control is implemented to limit the total b/w consumption. (see the -p --max-rate startup option) Auto hard capturing: This is a startup option that says that unless an IP is excluded or hard-excluded, then mark it as being hard captured. This is normally a risky thing to do and should be used with caution. Normal virtual machine behaviour Default port behaviour: Incoming connections on any port will be subject to tarpitting / persist capturing. Since all connections are inbound, there should be no incoming SYN/ACKs. Labrea will respond RST to an incoming SYN/ACK unless the startup option -a --no-resp-synack dis- ables this behaviour. Excluded ports: Ports that are specifically excluded will not be tarpitted or persist captured. Incoming connection attempts on an excluded port will receive a RST. Virtual machine behaviour when firewalling: Active ports: When firewalling (i.e. -f --no-resp- excluded-ports) is active, then by default only the most widely used ports are active at startup. Incoming connections on these active ports will be tarpit- ted and/or persist captured as usual. Excluded ports: When firewalling is active, incoming con- nections on excluded ports will not receive a response. The packets will be dropped. Among other things, this means that nmap scans take much more time to complete. Other ports: Ports that are neither active nor excluded are passively monitored for incoming SYN activity. At startup, they behave as an excluded port (i.e. packets are dropped). However, if there is enough activity on a given port, it will dynamically become active. The threshold is more than 6 SYNs for a given port in an hour. However every 15 min- utes, the port's SYN count is reduced by 1 to eliminate noise. If the SYN count for a port finally reaches 255, then the port is considered permanently active. USAGE This section describes the configuration statements and their usage: nnn.nnn.nnn.nnn [- nnn.nnn.nnn.nnn] EXC Never capture the specified IP addresses. This applies to local IP addresses (i.e. on the local capture netblock) only. nnn.nnn.nnn.nnn [- nnn.nnn.nnn.nnn] HAR WHen "hard capturing" is in effect ("-h"), then never hard capture the specified IP addresses. (i.e. Always wait for the ARP timeout before responding.) Applies to local IP addresses only. nnn.nnn.nnn.nnn[/nn] IPI Ignore any packets with source IP address in the specified netblock. labrea will not tarpit or per- sist capture connections from the specified IP addresses. Note that this statement can apply to any IP address. Note also that the netblock is specified in CIDR notation (ie nnn.nnn.nnn.nnn/nn) and not as a range of IP addresses. nnnnn [- nnnnn] POR These ports are excluded. labrea will not tarpit / persist capture incoming connections on these ports. A RST will be returned unless firewalling is active. In that case, the incoming packet will be dropped. nnnnn [- nnnnn] PMN At startup, mark the indicated ports as being active. Incoming connections to these ports are subject to tarpitting / persist capturing. This configuration statement is useful only when firewalling is active. The port becomes immediately active, instead of waiting for enough SYNs to bump the port's SYN count above the activity threshold. EXAMPLES Suppose that the capture subnet is 192.168.10.0/24. Exclude 192.168.10.5 through .7 from being captured: 192.168.10.5 - 192.168.10.7 EXC "Hard exclude" 192.168.10.100: 192.168.10.100 HAR Do not attempt to tarpit / persist capture packets from the class C subnet 10.2.3.x: 10.2.3.0/24 IPI Put in some comments: # # This is a comment # Do not tarpit / persist capture on ports 21-25: 21-25 POR When firewalling, make port 12345 active at startup: 12345 PMN FILES /usr/local/etc/labrea.conf Default configuration file on unix systems (current directory) LaBrea.cfg Default configuration file on Windows systems SEE ALSO labrea(1) AUTHOR Tom Liston Bugs: lor- gor@users.sourceforge.net or http://labrea.sourceforge.net LABREA.CONF(5) labrea-2.5-stable-1.orig/misc/labrea.10100644000550600055060000002666207730434533016525 0ustar tonontonon.\" .\" Copyright (c) 2002 Tom Liston .\" .\" $Id: labrea.1,v 1.2 2003/09/12 21:23:39 lorgor Exp $ .\" .TH LABREA 1 .SH NAME labrea \- Honeypot for incoming IP connection attempts .SH SYNOPSIS \fBlabrea\fR [\fB-i --device INTERFACE\fR] [\fB-n --network nnn.nnn.nnn.nnn[/nn]\fR] [\fB-m --mask nnn.nnn.nnn.nnn\fR] [\fB-t --throttle-size BYTES\fR] [\fB-p --max-rate RATE \fR] [\fB-R --soft-restart\fR] [\fB-r --arp-timeout RATE\fR] [\fB-s --switch-safe\fR] [\fB-h --hard-capture\fR] [\fB-x --disable-capture\fR] [\fB-X --exclude-resolvable-ips\fR] [\fB-P --persist-mode-only\fR] [\fB-a --no-resp-synack\fR] [\fB-H --auto-hard-capture\fR] [\fB-f --no-resp-excluded-ports\fR] [\fB--no-arp-sweep\fR] [\fB--init-file FILE\fR] [\fB-F --bpf-file FILE\fR] [\fB-T --dry-run\fR] [\fB-d --foreground\fR] [\fB-o --log-to-stdout\fR] [\fB-O --log-timestamp-epoch\fR] [\fB-l --log-to-syslog\fR] [\fB-b --log-bandwidth\fR] [\fB-v --verbose\fR] [\fB-q --quiet\fR] [\fB-z --no-nag\fR] [\fB-? --usage --help \fR] [\fB-V --version\fR] [\fB-I --ip-addr nnn.nnn.nnn.nnn\fR] [\fB-E --my-mac-addr xx:xx:xx:xx:xx:xx\fR] [\fB-D --list-interfaces\fR] [\fB-j --winpcap-dev nn\fR] [\fB--syslog-server nnn.nnn.nnn.nnn\fR] [\fB--syslog-port nnn\fR] .LP [\fBBPF Filter\fR] .SH DESCRIPTION .B labrea creates virtual machines for unused IP addresses in the specified block of IP addresses. LaBrea sits and listens for ARP "who-has" requests. .LP When an ARP request for a particular IP goes unanswered for longer than its "rate" setting (default: 3 seconds), labrea crafts an ARP reply that routes all traffic destined for the IP to a "bogus" MAC address. labrea sniffs for TCP/IP traffic sent to that MAC address and then responds to any SYN packet with a SYN/ACK packet that it creates. .SH OPTIONS .B labrea accepts the following options: .TP .BI "-i --device " interface By default, labrea uses the first ethernet interface. This forces labrea to use the specified interface. .TP .BR "-n --network " xxx.xxx.xxx.xxx[/nn] labrea normally pulls information about the netblock from the IP information assigned to the interface. If labrea is run on an unconfigured interface (one without an assigned IP address), then use this option to specify the subnet to be captured. .RS .LP .I xxx.xxx.xxx.xxx is the network address. .I /nn is the subnet mask in CIDR notation. If the subnet mask is not specified here, then you must include the -m parameter. .RE .TP .BR "-m --mask " xxx.xxx.xxx.xxx Another way to specify the network mask for the capture netblock. If this parameter is specified, then the -n parameter must also be specified. .TP .BR "-t --throttle-size " \fInn\fR Sets the TCP window advertisement to limit the amount of data sent to labrea. The number of data bytes to allow per packet is .I nn bytes. .TP .BR "-p --max-rate " \fIrate\fR Connect attempts will be permanently captured by forcing the connection into a "persist" state (by closing the TCP window). In this state, the connection will not time out. labrea will permanently capture connect attempts up to maximum bandwidth .I rate bytes. If the specified bandwidth is exceeded, labrea will still tarpit the incoming connection (ie respond SYN/ACK to incoming SYN). .TP .BR "-R --soft-restart" New captures will be held off for 5 minutes to let bandwidth calculations progress. If a major scan hits just after startup, this prevents labrea from capturing too many connections. .TP .BR "-r --arp-timeout " \fIrate\fR Wait .I rate seconds after seeing incoming arp requests before capturing an IP address. .TP .BR "-s --switch-safe" When there is an incoming ARP request, specifies that labrea should send out an ARP request of its own for the same IP address. This is necessary for safe operation in a switched environment where one host does not necessarily see all the traffic on the switch. .TP .BR "-h --hard-capture " Once an IP address has been captured, then do not wait for a "-r" timeout for the next incoming ARP request. .TP .BR "-x --disable-capture" Do not capture IPs. .TP .BR "-X --exclude-resolvable-ips" On startup, attempt DNS resolution on all IPs within the capture netblock. Automatically exclude any IP that has a corresponding entry in the DNS. Be careful because this can generate a lot of DNS lookups if the capture subnet is large. .TP .BR "-P --persist-mode-only" Try to limit bandwidth use by doing only persist capturing. Note: This parameter has limited usefulness since below max b/w, the same exchange that leads to persist capture also has the side effect of tarpitting. .TP .BR "-a --no-resp-synack" By default, the LaBrea virtual hosts respond to SYN/ACK with RST, and answer Pings. Disables this behaviour. .TP .BR "-H --auto-hard-capture" Mark all non-excluded and all non-hardexcluded IPs as being hard captured. See .B labrea.conf(5) for more information. This parameter should be used .I with caution. .TP .BR "-f --no-resp-excluded-ports" Drop incoming connections to excluded ports. Normal default behaviour is to return a RST. Makes nmap-style scanning go much slower. .TP .BR "--no-arp-sweep" On startup, labrea sweeps the capture subnet with bursts of ARP requests in an attempt to locate all live machines. This parameter disables the sweep. .TP .BR "--init-file " \fIfile\fR Read the configuration from the specified .I file instead of from the default location. .TP .BR "-F --bpf-file " \fIfile\fR Designates the name of a file containing a BPF filter pointing to machines/ports to be tarpitted. As with the command line BPF filter, these connections MUST be firewalled to DROP inbound traffic. .TP .BR "-T --dry-run" Do labrea initialization, including Dns excludes, parse of the configuration file, opening the network interface etc. Print diagnostic information, then exit. .TP .BR "-d --foreground" Do not detach the process. (Unix systems only) .TP .BR "-o --log-to-stdout" Send log information to stdout rather than to syslog. This option also implies and sets the -d option (i.e. do not detach process). .TP .BR "-O --log-timestamp-epoch" Same as the "-o" option, but with time output in seconds since epoch to make it easier for logfile analysis programs. .TP .BR "-l --log-to-syslog" Send log messages to syslog. .TP .BR "-b --log-bandwidth" Log a message every minute detailing the current bandwidth consumption of the -p option (persist capture). .TP .BR "-v --verbose" Increase the verbosity of log messages. Use twice for more effect. .TP .BR "-q --quiet" Do not report arp requests for IPs that are not in the capture subnet. .TP .BR "-z --no-nag" Turn off the nag message. Before you do this, read the basic warning in the Notes section just below. .TP .BR "-? --usage --help" Print a help message and then exit. .TP .BR "-V --version" Print version information and exit. .TP .BR "-I --ip-addr " \fInnn.nnn.nnn.nnn\fR Manually specify the IP address for the labrea server. .TP .BR "-E --my-mac-addr " \fIxx:xx:xx:xx:xx:xx\fR Manually specify the MAC address of the labrea server's NIC. .TP .BR "-D --list-interfaces" On Windows systems, print the list of WinPcap devices, followed by the list of the libdnet interfaces. Note that each API has a different nomenclature for the underlying NIC. .TP .BR "-j --winpcap-dev " \fInn\fR On windows systems, select the nth winpcap device in the list. .SH NOTES .SS Basic Warning about use of labrea .I You must understand this: As a default, LaBrea captures IP addresses by creating a "virtual machine" that sits on any UNUSED IP address that it sees. labrea has been carefully written and tested to transparently and peacefully operate in normal production environments but ... .LP .I There is a potential for problems if someone decides to start using one of the IP addresses that labrea has laid claim to, or if labrea erroneously decides that an IP address is free when in fact a real machine is already there. .SS Built-in protections labrea tries very hard to NEVER capture an IP that has a live machine sitting on it. .LP The following automatic mechanisms are provided: .RS .IP \(bu If labrea sees a gratuitous ARP signalling the arrival of a new machine, it marks the corresponding IP address as excluded. ("new kids on the block" logic) .IP \(bu Each ARP response is noted and the corresponding IP address is marked as excluded. .IP \(bu At startup, a systematic sweep is done of the entire capture subnet (as long as the subnet is not too big). All IP addresses that respond are marked as excluded. .RE .LP Then there are ways of manually specifying the exclusion of certain addresses, and otherwise ensuring safe operation: .RS .IP \(bu The EXC config stmt allows specified IP addresses to be manually excluded from capture. .IP \(bu The IPI config stmt causes packets with the specified IP source address(es) to be ignored. .IP \(bu -s --switch-safe parameter causes mirroring of ARP requests in a switched environment .IP \(bu -X --exclude-resolvable-ips says to exclude all IPs that have a corresponding Dns entry .RE .LP .B Traffic rerouting: Despite all this, if labrea somehow receives traffic whose IP destination address belongs to a live machine, labrea will reroute that traffic to the real machine. .SS Size of the capture subnet .LP It is best to limit the capture subnet to the .I actual physical segment (VLAN, hub) where labrea is running. .LP In some configurations, where proxy arp is being used to determine routing, interface subnet masks can be quite large. (i.e. the "whole" network is "directly" attached to the physical segment). .LP In this case, if labrea picks up the subnet mask from the interface, then labrea will inefficiently watch addresses that it has no hope of capturing. You should use the -m / -n parameters to manually limit the size of the capture subnet. .SS Other usage notes .HP The labrea virtual machines use a bogus MAC address of 0:0:f:ff:ff:ff .HP On certain older Windows systems, it may be necessary to manually specify the capture subnet. .HP On unix systems, KILL -USR1 will toggle logging off on and off. .HP On unix systems, KILL -HUP will cause labrea to reinitialize (and thus free captured IPs). .HP If the capture subnet is too large (greater than 1024 addresses), then labrea will not do an arp sweep. .SH BUGS .HP On some systems, if there is absolutely no traffic to sniff, pcap_dispatch will wait instead of timing out, making the program seem unresponsive. (Workaround: ping the labrea server to "wake" it up.) .HP If --exclude-resolvable-ips is enabled, and if the capture subnet is large (say class A /8), then a LOT of traffic will be generated to the Dns server. .SH EXAMPLES .IP 1) Run safely in a switched environment with very verbose logging. Don't respond to excluded ports. Log bandwidth usage from persist capturing. Exclude all IPs that are in the Dns. Run in the foreground, and log to stdout. Maximum capture bandwidth is 2 MB/sec. Use toto.conf as the initialisation file. Use network device "eth1" instead of the default device. Do a test run only - parse input, initialize, then exit. .LP .nf labrea --switch-safe --verbose -v --no-resp-excluded-ports --log-bandwidth --exclude-resolvable-ips --foreground --log-to-stdout --max-rate 2000000 --init-file toto.conf --device eth1 -z --dry-run (one line) .fi .IP 2) Same thing with the short parameter style. .LP .nf labrea -z -s -v -v -f -b -X -d -o -p 2000000 --init-file toto.conf -i eth1 -T (one line) .fi .SH FILES .TP .I /usr/local/etc/labrea.conf Default configuration file .TP .I /usr/local/sbin/labrea Program .SH SEE ALSO \fBlabrea.conf\fR(5) .SH AUTHOR Tom Liston Bugs: lorgor@users.sourceforge.net or http://labrea.sourceforge.net labrea-2.5-stable-1.orig/misc/labrea.conf.50100644000550600055060000001650307607335677017462 0ustar tonontonon.\" .\" Copyright (c) 2002 Tom Liston .\" .\" $Id: labrea.conf.5,v 1.1.1.1 2003/01/09 18:13:19 lorgor Exp $ .\" .TH LABREA.CONF 5 .SH NAME labrea.conf \- labrea(1) configuration file .SH SYNOPSIS \fBnnn.nnn.nnn.nnn [- nnn.nnn.nnn.nnn] EXC\fR .LP \fBnnn.nnn.nnn.nnn [- nnn.nnn.nnn.nnn] HAR\fR .LP \fBnnn.nnn.nnn.nnn[/nn] IPI\fR .LP \fBnnnnn [- nnnnn] POR\fR .LP \fBnnnnn [- nnnnn] PMN\fR .LP .SH DESCRIPTION .SS Generalities .I labrea.conf is the configuration file for the .B labrea(1) program. .LP Each line consists of a selector field, followed by an action verb. .LP Whitespace is suppressed. Blank lines are ignored, as are lines beginning with "#". .SS Selectors .LP IPs can be specified as either a single address (e.g. "192.168.0.4") or as a range of addresses (e.g. "192.168.0.1 - 192.168.0.50"). .LP Ports can be specified as either a single port (e.g. 12345) or as a range of ports (e.g. 1-65535). .LP .SS IP Capturing When labrea sees an ARP request for an unused IP, it does the following: .LP On an IP by IP basis, store a time and an originating IP address: .IP 1. For an incoming ARP request, check the current time: .RS .IP a. If currently stored time is 0 or the arp comes from a different address than the one stored, then store the current time and the requesting IP and return. .IP b. If the stored time is less than "-r" seconds ago, ignore it and return. .IP c. If currently stored time is more than a minute ago, store 0, return. (Max timeout) .IP d. Otherwise, grab the IP. .RE .IP 2. See an ARP reply, set stored time to 0. .LP When an ARP request for a particular IP goes unanswered for longer than its "rate" setting (default: 3 seconds), labrea crafts an ARP reply that routes all traffic destined for the IP to a "bogus" MAC address. labrea listens for TCP/IP traffic routed to that MAC address and then responds to any SYN packet (ie incoming connection) with a SYN/ACK packet. .SS Explanation of terms .LP .B Excluded IPs: Are those IPs that labrea should never capture. Note that automatic mechanisms are also used to prevent capturing IPs with an active machine on it. See .B labrea(1) for more details. .LP .B Hard captured IPs: The -h --hard-capture option instructs labrea that once it captures an IP address, then it needn't wait for a "-r" timeout the next time around. These IPs are said to be "hard" captured. .LP .B Hard excluded IPS: These are IPs that should never be "hard" captured. In other words, each time there is an ARP request for this IP, then labrea will always wait for the timeout -r secs before responding. .LP .B Tarpitting: On a captured IP, labrea responds to an incoming SYN connection attempt with a SYN/ACK. This causes the remote machine's stack to initiate the Tcp connection and then waste time fruitlessly trying to continue the conversation. .LP .B Persist state capture: labrea can permanently capture connect attempts by closing the TCP window to force the connection into "persist" state. In this state, the connection never times out, and labrea hangs on to the incoming connection until it is closed from the other end. .LP To accomplish this, short packets are sent every so often to say "keep waiting, my Tcp window is still closed". So a maximum b/w control is implemented to limit the total b/w consumption. (see the .B -p --max-rate startup option) .LP .B Auto hard capturing: This is a startup option that says that unless an IP is excluded or hard-excluded, then mark it as being hard captured. This is normally a risky thing to do and should be used with caution. .SS Normal virtual machine behaviour .LP .B Default port behaviour: Incoming connections on any port will be subject to tarpitting / persist capturing. .LP Since all connections are inbound, there should be no incoming SYN/ACKs. Labrea will respond RST to an incoming SYN/ACK unless the startup option .B -a --no-resp-synack disables this behaviour. .LP .B Excluded ports: Ports that are specifically excluded will not be tarpitted or persist captured. .LP Incoming connection attempts on an excluded port will receive a RST. .SS Virtual machine behaviour when firewalling: .B Active ports: When firewalling (i.e. .B -f --no-resp-excluded-ports) is active, then by default only the most widely used ports are active at startup. .LP Incoming connections on these active ports will be tarpitted and/or persist captured as usual. .LP .B Excluded ports: When firewalling is active, incoming connections on excluded ports will not receive a response. The packets will be dropped. .LP Among other things, this means that nmap scans take much more time to complete. .LP .B Other ports: Ports that are neither active nor excluded are .I passively monitored for incoming SYN activity. At startup, they behave as an excluded port (i.e. packets are dropped). .LP However, if there is enough activity on a given port, it will dynamically become active. The threshold is more than 6 SYNs for a given port in an hour. However every 15 minutes, the port's SYN count is reduced by 1 to eliminate noise. .LP If the SYN count for a port finally reaches 255, then the port is considered permanently active. .SH USAGE This section describes the configuration statements and their usage: .TP .BR "nnn.nnn.nnn.nnn [- nnn.nnn.nnn.nnn] EXC" Never capture the specified IP addresses. This applies to local IP addresses (i.e. on the local capture netblock) only. .TP .BR "nnn.nnn.nnn.nnn [- nnn.nnn.nnn.nnn] HAR" WHen "hard capturing" is in effect ("-h"), then never hard capture the specified IP addresses. (i.e. Always wait for the ARP timeout before responding.) Applies to local IP addresses only. .TP .BR "nnn.nnn.nnn.nnn[/nn] IPI" Ignore any packets with source IP address in the specified netblock. labrea will not tarpit or persist capture connections from the specified IP addresses. .RS .LP Note that this statement can apply to .I any IP address. .LP Note also that the netblock is specified in .I CIDR notation (ie nnn.nnn.nnn.nnn/nn) and not as a range of IP addresses. .RE .TP .B "nnnnn [- nnnnn] POR" These ports are excluded. labrea will not tarpit / persist capture incoming connections on these ports. A RST will be returned unless firewalling is active. In that case, the incoming packet will be dropped. .TP .B "nnnnn [- nnnnn] PMN" At startup, mark the indicated ports as being active. Incoming connections to these ports are subject to tarpitting / persist capturing. .RS .LP This configuration statement is useful only when firewalling is active. The port becomes immediately active, instead of waiting for enough SYNs to bump the port's SYN count above the activity threshold. .RE .SH EXAMPLES .LP Suppose that the capture subnet is 192.168.10.0/24. .LP Exclude 192.168.10.5 through .7 from being captured: .IP 192.168.10.5 - 192.168.10.7 EXC .LP "Hard exclude" 192.168.10.100: .IP 192.168.10.100 HAR .LP Do not attempt to tarpit / persist capture packets from the class C subnet 10.2.3.x: .IP 10.2.3.0/24 IPI .LP Put in some comments: .IP .nf # # This is a comment # .fi .LP Do not tarpit / persist capture on ports 21-25: .IP 21-25 POR .LP When firewalling, make port 12345 active at startup: .IP 12345 PMN .SH FILES .TP .I /usr/local/etc/labrea.conf Default configuration file on unix systems .TP .I (current directory) LaBrea.cfg Default configuration file on Windows systems .SH SEE ALSO .B labrea(1) .SH AUTHOR Tom Liston Bugs: lorgor@users.sourceforge.net or http://labrea.sourceforge.net labrea-2.5-stable-1.orig/inc/0040777000550600055060000000000007750022577015031 5ustar tonontononlabrea-2.5-stable-1.orig/inc/bget.h0100644000550600055060000000175307727437052016124 0ustar tonontonon/* Interface definitions for bget.c, the memory management package. */ #ifndef _ #ifdef PROTOTYPES #define _(x) x /* If compiler knows prototypes */ #else #define _(x) () /* It it doesn't */ #endif /* PROTOTYPES */ #endif typedef long bufsize; void bpool _((void *buffer, bufsize len)); void *bget _((bufsize size)); void *bgetz _((bufsize size)); void *bgetr _((void *buffer, bufsize newsize)); void brel _((void *buf)); void bectl _((int (*compact)(bufsize sizereq, int sequence), void *(*acquire)(bufsize size), void (*release)(void *buf), bufsize pool_incr)); void bstats _((bufsize *curalloc, bufsize *totfree, bufsize *maxfree, long *nget, long *nrel)); void bstatse _((bufsize *pool_incr, long *npool, long *npget, long *nprel, long *ndget, long *ndrel)); void bufdump _((void *buf)); void bpoold _((void *pool, int dumpalloc, int dumpfree)); int bpoolv _((void *pool)); labrea-2.5-stable-1.orig/inc/ctl.h0100644000550600055060000001034707730434533015757 0ustar tonontonon/* ctl.h * This file is part of the LaBrea package * * Copyright (C) 2001, 2002 Tom Liston * * 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. * * $Id: ctl.h,v 1.2 2003/09/12 21:23:39 lorgor Exp $ */ #ifndef CTL_H #define CTL_H #include #include #include "queue.h" /* * Note that data in these control structures is kept in host byte * order. However, mac addresses are the exception. They are not * manipulated by the code, so they are kept in network byte order. * */ /* "new kid on the block" list: IPs that have shown life since their capture */ struct nk_s { struct addr nk_mac; /* corresponding MAC addr (netwk byte order) */ time_t nk_time; /* Time entry will be culled due to inactivity */ }; typedef struct nk_s nk_t; /* IP ignore list */ struct ipig { struct addr ipig_addr; SLIST_ENTRY(ipig) ipig_next; }; SLIST_HEAD(ipig_q, ipig); /* Main control structure */ struct ctl_s { /* Controlling arrays and structures */ uint8_t *exclusion; /* 1 byte / addr in subnet */ ip_addr_t *addr_array; /* IP src addr for last WHO-HAS ARP seen */ time_t *time_array; /* Time of last WHO-HAS ARP */ uint8_t *port_array; /* 1 byte / port to monitor */ nk_t * *nk_array; /* "new kids on block: gratuitous arps seen */ uint32_t randqueue2[RANDSIZE2]; /* For linux win probe detection */ struct ipig_q ipig_q; /* IP exclude list */ /* globals */ char cfg_file_name[BUFSIZE]; /* Configuration file name */ int debuglevel; /* Level of debug output */ /* capture performance */ uint32_t throttlesize; /* Window size for incoming tcp sessions */ uint32_t currentbytes; /* # bytes transmitted this minute */ uint32_t maxbw; /* User-specified maximum bandwidth - implies persist mode */ uint32_t newthisminute; /* # bytes due to new connections still allowed this minute */ uint32_t totalbytes; /* Total bytes transmitted over whole history period */ uint32_t rate; uint32_t past[HIST_MIN+1]; /* History array of bandwidth use */ /* each entry = bytes for the corresponding minute */ int soft_restart; /* used to delay captures for some minutes */ /* after startup to avoid having too many */ /* connections if scanned during this period */ int boolThread; /* Win32: signal handling */ char syslog_server[MAXHOSTNAMELEN]; /* Win32: Remote syslog server */ int syslog_port; /* Win32: Port to use for remote syslog */ /* capture range */ ip_addr_t base; /* Beginning IP addr of range */ ip_addr_t topend; /* Ending IP addr of range */ uint32_t addresses; /* # addr in range */ /* flags */ uint16_t feature; #define FL_EXCL_RESOLV_IPS 0x0001 /* -X */ #define FL_SAFE_SWITCH 0x0002 /* -s */ #define FL_NO_RESP 0x0004 /* -a */ #define FL_NO_RST_EXCL_PORT 0x0008 /* -f */ uint16_t logging; #define FL_LOG_BDWTH_SYSLOG 0x0001 /* -b */ #define FL_LOG_ODD_ARPS 0x0002 /* -q */ uint16_t capture; #define FL_CAPTURE 0x0001 /* -x */ #define FL_HARD_CAPTURE 0x0002 /* -h */ #define FL_AUTO_HARD_CAPTURE 0x0004 /* -H */ #define FL_PERSIST_MODE_ONLY 0x0008 /* -P */ #define FL_PERSIST 0x0010 /* -p */ uint16_t mode; #define FL_TESTMODE 0x0001 /* -T */ #define FL_DONT_DETACH 0x0002 /* -d */ #define FL_DONT_NAG 0x0004 /* -z */ #define FL_SOFT_RESTART 0x0008 /* -R */ #define FL_NO_ARP_SWEEP 0x0010 volatile sig_atomic_t signals; #define SIG_RESTART 0x0001 #define SIG_QUIT 0x0002 #define SIG_TIMER 0x0004 #define SIG_TOGGLE_LOGGING 0x0008 }; typedef struct ctl_s ctl_t; extern ctl_t ctl; int ctl_init_arrays (int wait); int ctl_init(); #endif /* CTL_H */ labrea-2.5-stable-1.orig/inc/err.h0100644000550600055060000000421607727437052015770 0ustar tonontonon/* * err.h * * Adapted from OpenBSD libc *err* *warn* code. * * Copyright (c) 2000 Dug Song * * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)err.h 8.1 (Berkeley) 6/2/93 */ #ifndef _ERR_H_ #define _ERR_H_ void err(int eval, const char *fmt, ...); void warn(const char *fmt, ...); void errx(int eval, const char *fmt, ...); void warnx(const char *fmt, ...); #endif /* !_ERR_H_ */ labrea-2.5-stable-1.orig/inc/getopt.h0100644000550600055060000001447207727437052016507 0ustar tonontonon/* Declarations for getopt. Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _GETOPT_H #ifndef __need_getopt # define _GETOPT_H 1 #endif /* If __GNU_LIBRARY__ is not already defined, either we are being used standalone, or this is the first header included in the source file. If we are being used with glibc, we need to include , but that does not exist if we are standalone. So: if __GNU_LIBRARY__ is not defined, include , which will pull in for us if it's from glibc. (Why ctype.h? It's guaranteed to exist and it doesn't flood the namespace with stuff the way some other headers do.) */ #if !defined __GNU_LIBRARY__ # include #endif #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; #ifndef __need_getopt /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { # if (defined __STDC__ && __STDC__) || defined __cplusplus const char *name; # else char *name; # endif /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ # define no_argument 0 # define required_argument 1 # define optional_argument 2 #endif /* need getopt */ /* Get definitions and prototypes for functions to process the arguments in ARGV (ARGC of them, minus the program name) for options given in OPTS. Return the option character from OPTS just read. Return -1 when there are no more options. For unrecognized options, or options missing arguments, `optopt' is set to the option letter, and '?' is returned. The OPTS string is a list of characters which are recognized option letters, optionally followed by colons, specifying that that letter takes an argument, to be placed in `optarg'. If a letter in OPTS is followed by two colons, its argument is optional. This behavior is specific to the GNU `getopt'. The argument `--' causes premature termination of argument scanning, explicitly telling `getopt' that there are no more options. If OPTS begins with `--', then non-option arguments are treated as arguments to the option '\0'. This behavior is specific to the GNU `getopt'. */ #if (defined __STDC__ && __STDC__) || defined __cplusplus # ifdef __GNU_LIBRARY__ /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts); # else /* not __GNU_LIBRARY__ */ extern int getopt (); # endif /* __GNU_LIBRARY__ */ # ifndef __need_getopt extern int getopt_long (int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind); extern int getopt_long_only (int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind); /* Internal only. Users should not call this directly. */ extern int _getopt_internal (int ___argc, char *const *___argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only); # endif #else /* not __STDC__ */ extern int getopt (); # ifndef __need_getopt extern int getopt_long (); extern int getopt_long_only (); extern int _getopt_internal (); # endif #endif /* __STDC__ */ #ifdef __cplusplus } #endif /* Make sure we later can get all the definitions and declarations. */ #undef __need_getopt #endif /* getopt.h */ labrea-2.5-stable-1.orig/inc/labrea.h0100644000550600055060000001117407730434533016422 0ustar tonontonon/* labrea.h * This file is part of the LaBrea package * * Copyright (C) 2001, 2002 Tom Liston * * 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. * * $Id: labrea.h,v 1.2 2003/09/12 21:23:39 lorgor Exp $ */ #ifndef LABREA_H #define LABREA_H #include "debug.h" /* set this to FALSE to eliminate the requirement that the user */ /* supply a "-z" to the program to run it. Make's 'em read */ /* the instructions... */ #define USEZFLAG TRUE /* #define to LOG_LOCAL0 (see /usr/include/syslog.h ) or whatever */ /* FACILITY to get logging other than log_DAEMON (djs) */ #define LOGFAC LOG_DAEMON /* define to whatever makes sense to you for your system setup */ #define LOGTYPE LOG_WARNING #define INFOTYPE LOG_INFO /* don't mess with these, unless you know what you're doing */ enum timings_sec { MAXARPTIME = 60, /* If nothing happens within 60 sec of original arp req, */ /* the whole capturing cycle restarts again */ ARP_TIMEOUT = 3, /* Default arp timeout */ CULLTIME = 2400, /* "New kids" entries are culled after 40 minutes of */ /* inactivity */ PCAP_TIMEOUT = 100, /* Wait .1 sec for incoming packets before looping to check signals */ WAKEUP_MSEC = 1000, /* Thread wakes up every 1 sec to check for termination */ WAKEUP_SEC = 60 /* Wake up for periodic cleanup every minute */ /* Note that the following defines depend on this one */ }; enum timings_min { NK_CULL_INTVL = 2, /* Cull "new kids" queue every 2 min */ /* Also controls timing of arp sweeps */ DYN_PORT_INTVL = 15, /* Recalculate dynamic ports every 15 min */ SOFT_RESTART = 5 /* Hold off captures for 5 min on startup */ /* to avoid having too many connections */ /* if scanned during this time */ }; enum sizes { RANDSIZE2 = 12, /* Keep 12 different random numbers */ BUFSIZE = 1024, /* General character buffer size */ BPFSIZE = 65536, /* Holds entire bpf filter */ IP_INP_SIZE = 20, /* Max length of IP addr when input: xxx.xxx.xxx.xxx/nn */ ONE_K = 1024, /* For conversions */ HIST_MIN = 4, /* Keep 5 minutes of bandwidth history */ MAX_NUM_ADAPTER = 10, /* Windows only: max num of adapters in list */ PGM_NAME_SIZE = 50 /* Ident tag for syslog */ }; #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 256 /* Maximum size of a hostname */ #endif /* For control of ports */ enum port_constants { PORT_IGNORE = 0, /* Ignore this port */ PORT_MONITOR = 1, /* Monitor this port for activity */ PORT_NUM = 65535, PORT_MAX = 255, /* Max count possible for a given port */ PORT_NOISE = 6 /* 1st n SYNs to a given port are considered noise */ }; enum perf_constants { THROTTLE_WINDOW_ORD = 10, /* Window size since if no max b/w specified */ THROTTLE_WINDOW_SLOW = 3, /* Window size if b/w limited */ MAX_BW = 1048576, /* Maximum bandwidth = 1 Gbyte/sec */ MAX_ARP_BURST = 85, /* During arp sweeps, not more than 85 at one time */ MAX_SUBNET_SIZE = 1024 /* Turn off arp sweep for subnets bigger than this */ }; #define ETH_ADDR_BOGUS "\x00\x00\x0f\xff\xff\xff" /* Bogus MAC addr used in IP capture */ #define IP_ADDR_ZEROS "\x00\x00\x00\x00" /* Used in broadcast arps */ #define LOOPBACK "127.0.0.1" /* Configuration file directives and types of capture */ enum cfg_type_enum { PT_IGNORE, /* POR */ IP_MONITOR=0, /* initial state for ctl.exclusion array */ IP_EXCLUDE, /* EXC */ IP_HARD_EXCLUDE, /* HAR */ IP_HARD_CAPTURED, IP_IGNORE, /* IPI */ PT_MONITOR, /* PMN */ IP_INVALID, CFG_INVALID /* Cfg directive invalid or missing */ }; typedef enum cfg_type_enum config_t; #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE 1 #endif #define MYFREE(x) free(x); x = NULL; #define SWAP(A, B) ((A) ^= (B) ^= (A) ^= (B)) /* Defines to eliminate some ifdefs in the code */ #ifndef WIN32 #define WIN32_FLG FALSE #else #define WIN32_FLG TRUE #endif #ifdef WIN32 static inline void setlinebuf(void *iobuf) {} #endif void labrea_init(int argc, char **argv); #endif /* LABREA_H */ labrea-2.5-stable-1.orig/inc/lbio.h0100644000550600055060000000510507730434533016116 0ustar tonontonon/* lbio.h * This file is part of the LaBrea package * * Copyright (C) 2001, 2002 Tom Liston * * 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. * * $Id: lbio.h,v 1.2 2003/09/12 21:23:39 lorgor Exp $ */ #ifndef LBIO_H #define LBIO_H #include /* Main IO ctl structure */ struct io_s { /* control structures (mostly uses netwk byte order) */ struct intf_entry *ifent; /* Interface */ ip_addr_t myip; /* My own IP addr (in host byte order) */ struct addr *mymac; /* My own IP MAC addr */ struct addr *bogus_mac; /* Bogus mac addr */ struct pkt *bcast; /* Contains broadcast ARP WHO HAS for */ /* switch environment */ /* global variables */ u_char buf[BUFSIZE]; int mtu; int dloff; /* Data link offset */ uint32_t net; /* Subnet for capture */ uint32_t mask; /* Netmask for capture */ /* Declarations for WinPcap list */ char adapter_name_list[MAX_NUM_ADAPTER][BUFSIZE]; /* WinPcap driver adapter name */ char adapter_desc_list[MAX_NUM_ADAPTER][BUFSIZE]; /* Adapter descriptions */ int adapter_total_num; /* total # adapters in all */ int adapter_num; int intf_num; /* handles */ eth_t *eth; intf_t *intf; pcap_t *pcap; rand_t *rnd; }; typedef struct io_s io_t; extern io_t io; /* Let others get at this structure */ void lbio_init(u_char *dev, u_char *texpr); int lbio_send_pkt(const struct pkt *pkt); int lbio_send_ip_pkt (struct pkt *new, const struct pkt *pkt, const uint16_t ipl, const u_char *msg); uint32_t lbio_rand(void); void lbio_send_ARP_Who_Has (ip_addr_t tpa); void lbio_send_bogus_ARP (const ip_addr_t tpa, const struct pkt *pkt); void lbio_close(void); char *lbio_ntoa (const ip_addr_t ip); int lbio_ip_offset (const ip_addr_t ip, ip_addr_t *offset); int lbio_print_libdnet_intf_list(void); int lbio_print_pcap_adapter_list(void); #endif /* LBIO_H */ labrea-2.5-stable-1.orig/inc/pcaputil.h0100644000550600055060000000063507730434533017015 0ustar tonontonon/* * pcaputil.h * * Copyright (c) 2001 Dug Song * * $Id: pcaputil.h,v 1.2 2003/09/12 21:23:39 lorgor Exp $ */ #ifndef PCAPUTIL_H #define PCAPUTIL_H #include #ifdef notyet # include #endif pcap_t * pcap_open(char *device); int pcap_dloff(pcap_t *pcap); int pcap_filter(pcap_t *pcap, const char *fmt, ...); void pcap_stat (pcap_t *pd); #endif /* PCAPUTIL_H */ labrea-2.5-stable-1.orig/inc/pkt.h0100644000550600055060000000255407730434533015774 0ustar tonontonon /* * pkt.h * * Copyright (c) 2001 Dug Song * * Note that data in struct pkt is kept in byte network order * * $Id: pkt.h,v 1.2 2003/09/12 21:23:39 lorgor Exp $ */ #ifndef PKT_H #define PKT_H #include #define PKT_BUF_LEN (ETH_HDR_LEN + ETH_MTU) #define PKT_BUF_ALIGN 2 struct pkt { struct eth_hdr *pkt_eth; union { u_char *eth_data; struct ip_hdr *ip; struct arp_hdr *arp; } pkt_n_hdr_u; union { u_char *ip_data; struct icmp_hdr *icmp; struct tcp_hdr *tcp; struct udp_hdr *udp; struct arp_ethip *a_data; } pkt_t_hdr_u; union { u_char *t_data; union icmp_msg *icmp; } pkt_t_data_u; u_char pkt_buf[PKT_BUF_ALIGN + PKT_BUF_LEN]; u_char *pkt_data; u_char *pkt_end; }; #define pkt_arp pkt_n_hdr_u.arp #define pkt_ip pkt_n_hdr_u.ip #define pkt_eth_data pkt_n_hdr_u.eth_data #define pkt_icmp pkt_t_hdr_u.icmp #define pkt_tcp pkt_t_hdr_u.tcp #define pkt_udp pkt_t_hdr_u.udp #define pkt_ip_data pkt_t_hdr_u.ip_data #define pkt_arp_data pkt_t_hdr_u.a_data #define pkt_tcp_data pkt_t_data_u.t_data #define pkt_udp_data pkt_t_data_u.t_data #define pkt_icmp_msg pkt_t_data_u.icmp typedef struct pkt pkt_t; void pkt_init(int size); pkt_t *pkt_new(void); pkt_t *pkt_dup(pkt_t *pkt); void pkt_decorate(pkt_t *pkt); void pkt_free(pkt_t *pkt); #endif /* PKT_H */ labrea-2.5-stable-1.orig/inc/pkt_handler.h0100644000550600055060000000211207730434533017457 0ustar tonontonon/* pkt_handler.h * This file is part of the LaBrea package * * Copyright (C) 2001, 2002 Tom Liston * * 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. * * $Id: pkt_handler.h,v 1.2 2003/09/12 21:23:39 lorgor Exp $ */ #ifndef PKT_HANDLER_H #define PKT_HANDLER_H #include void pkt_handler (u_char* client_data, const struct pcap_pkthdr* pcpkt, const u_char* pktdata); #endif /* PKT_HANDLER_H */ labrea-2.5-stable-1.orig/inc/queue.h0100644000550600055060000004162407727437052016330 0ustar tonontonon/* $OpenBSD: queue.h,v 1.22 2001/06/23 04:39:35 angelos Exp $ */ /* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */ /* * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)queue.h 8.5 (Berkeley) 8/20/94 */ #ifndef _SYS_QUEUE_H_ #define _SYS_QUEUE_H_ /* * This file defines five types of data structures: singly-linked lists, * lists, simple queues, tail queues, and circular queues. * * * A singly-linked list is headed by a single forward pointer. The elements * are singly linked for minimum space and pointer manipulation overhead at * the expense of O(n) removal for arbitrary elements. New elements can be * added to the list after an existing element or at the head of the list. * Elements being removed from the head of the list should use the explicit * macro for this purpose for optimum efficiency. A singly-linked list may * only be traversed in the forward direction. Singly-linked lists are ideal * for applications with large datasets and few or no removals or for * implementing a LIFO queue. * * A list is headed by a single forward pointer (or an array of forward * pointers for a hash table header). The elements are doubly linked * so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before * or after an existing element or at the head of the list. A list * may only be traversed in the forward direction. * * A simple queue is headed by a pair of pointers, one the head of the * list and the other to the tail of the list. The elements are singly * linked to save space, so elements can only be removed from the * head of the list. New elements can be added to the list before or after * an existing element, at the head of the list, or at the end of the * list. A simple queue may only be traversed in the forward direction. * * A tail queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before or * after an existing element, at the head of the list, or at the end of * the list. A tail queue may be traversed in either direction. * * A circle queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before or after * an existing element, at the head of the list, or at the end of the list. * A circle queue may be traversed in either direction, but has a more * complex end of list detection. * * For details on the use of these macros, see the queue(3) manual page. */ /* * Singly-linked List definitions. */ #define SLIST_HEAD(name, type) \ struct name { \ struct type *slh_first; /* first element */ \ } #define SLIST_HEAD_INITIALIZER(head) \ { NULL } #define SLIST_ENTRY(type) \ struct { \ struct type *sle_next; /* next element */ \ } /* * Singly-linked List access methods. */ #define SLIST_FIRST(head) ((head)->slh_first) #define SLIST_END(head) NULL #define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head)) #define SLIST_NEXT(elm, field) ((elm)->field.sle_next) #define SLIST_FOREACH(var, head, field) \ for((var) = SLIST_FIRST(head); \ (var) != SLIST_END(head); \ (var) = SLIST_NEXT(var, field)) /* * Singly-linked List functions. */ #define SLIST_INIT(head) { \ SLIST_FIRST(head) = SLIST_END(head); \ } #define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ (elm)->field.sle_next = (slistelm)->field.sle_next; \ (slistelm)->field.sle_next = (elm); \ } while (0) #define SLIST_INSERT_HEAD(head, elm, field) do { \ (elm)->field.sle_next = (head)->slh_first; \ (head)->slh_first = (elm); \ } while (0) #define SLIST_REMOVE_HEAD(head, field) do { \ (head)->slh_first = (head)->slh_first->field.sle_next; \ } while (0) #define SLIST_REMOVE(head, elm, type, field) do { \ if ((head)->slh_first == (elm)) { \ SLIST_REMOVE_HEAD((head), field); \ } \ else { \ struct type *curelm = (head)->slh_first; \ while( curelm->field.sle_next != (elm) ) \ curelm = curelm->field.sle_next; \ curelm->field.sle_next = \ curelm->field.sle_next->field.sle_next; \ } \ } while (0) /* * List definitions. */ #define LIST_HEAD(name, type) \ struct name { \ struct type *lh_first; /* first element */ \ } #define LIST_HEAD_INITIALIZER(head) \ { NULL } #define LIST_ENTRY(type) \ struct { \ struct type *le_next; /* next element */ \ struct type **le_prev; /* address of previous next element */ \ } /* * List access methods */ #define LIST_FIRST(head) ((head)->lh_first) #define LIST_END(head) NULL #define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head)) #define LIST_NEXT(elm, field) ((elm)->field.le_next) #define LIST_FOREACH(var, head, field) \ for((var) = LIST_FIRST(head); \ (var)!= LIST_END(head); \ (var) = LIST_NEXT(var, field)) /* * List functions. */ #define LIST_INIT(head) do { \ LIST_FIRST(head) = LIST_END(head); \ } while (0) #define LIST_INSERT_AFTER(listelm, elm, field) do { \ if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ (listelm)->field.le_next->field.le_prev = \ &(elm)->field.le_next; \ (listelm)->field.le_next = (elm); \ (elm)->field.le_prev = &(listelm)->field.le_next; \ } while (0) #define LIST_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.le_prev = (listelm)->field.le_prev; \ (elm)->field.le_next = (listelm); \ *(listelm)->field.le_prev = (elm); \ (listelm)->field.le_prev = &(elm)->field.le_next; \ } while (0) #define LIST_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.le_next = (head)->lh_first) != NULL) \ (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ (head)->lh_first = (elm); \ (elm)->field.le_prev = &(head)->lh_first; \ } while (0) #define LIST_REMOVE(elm, field) do { \ if ((elm)->field.le_next != NULL) \ (elm)->field.le_next->field.le_prev = \ (elm)->field.le_prev; \ *(elm)->field.le_prev = (elm)->field.le_next; \ } while (0) #define LIST_REPLACE(elm, elm2, field) do { \ if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \ (elm2)->field.le_next->field.le_prev = \ &(elm2)->field.le_next; \ (elm2)->field.le_prev = (elm)->field.le_prev; \ *(elm2)->field.le_prev = (elm2); \ } while (0) /* * Simple queue definitions. */ #define SIMPLEQ_HEAD(name, type) \ struct name { \ struct type *sqh_first; /* first element */ \ struct type **sqh_last; /* addr of last next element */ \ } #define SIMPLEQ_HEAD_INITIALIZER(head) \ { NULL, &(head).sqh_first } #define SIMPLEQ_ENTRY(type) \ struct { \ struct type *sqe_next; /* next element */ \ } /* * Simple queue access methods. */ #define SIMPLEQ_FIRST(head) ((head)->sqh_first) #define SIMPLEQ_END(head) NULL #define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head)) #define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) #define SIMPLEQ_FOREACH(var, head, field) \ for((var) = SIMPLEQ_FIRST(head); \ (var) != SIMPLEQ_END(head); \ (var) = SIMPLEQ_NEXT(var, field)) /* * Simple queue functions. */ #define SIMPLEQ_INIT(head) do { \ (head)->sqh_first = NULL; \ (head)->sqh_last = &(head)->sqh_first; \ } while (0) #define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ (head)->sqh_last = &(elm)->field.sqe_next; \ (head)->sqh_first = (elm); \ } while (0) #define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.sqe_next = NULL; \ *(head)->sqh_last = (elm); \ (head)->sqh_last = &(elm)->field.sqe_next; \ } while (0) #define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ (head)->sqh_last = &(elm)->field.sqe_next; \ (listelm)->field.sqe_next = (elm); \ } while (0) #define SIMPLEQ_REMOVE_HEAD(head, elm, field) do { \ if (((head)->sqh_first = (elm)->field.sqe_next) == NULL) \ (head)->sqh_last = &(head)->sqh_first; \ } while (0) /* * Tail queue definitions. */ #define TAILQ_HEAD(name, type) \ struct name { \ struct type *tqh_first; /* first element */ \ struct type **tqh_last; /* addr of last next element */ \ } #define TAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).tqh_first } #define TAILQ_ENTRY(type) \ struct { \ struct type *tqe_next; /* next element */ \ struct type **tqe_prev; /* address of previous next element */ \ } /* * tail queue access methods */ #define TAILQ_FIRST(head) ((head)->tqh_first) #define TAILQ_END(head) NULL #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) #define TAILQ_LAST(head, headname) \ (*(((struct headname *)((head)->tqh_last))->tqh_last)) /* XXX */ #define TAILQ_PREV(elm, headname, field) \ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) #define TAILQ_EMPTY(head) \ (TAILQ_FIRST(head) == TAILQ_END(head)) #define TAILQ_FOREACH(var, head, field) \ for((var) = TAILQ_FIRST(head); \ (var) != TAILQ_END(head); \ (var) = TAILQ_NEXT(var, field)) #define TAILQ_FOREACH_REVERSE(var, head, field, headname) \ for((var) = TAILQ_LAST(head, headname); \ (var) != TAILQ_END(head); \ (var) = TAILQ_PREV(var, headname, field)) /* * Tail queue functions. */ #define TAILQ_INIT(head) do { \ (head)->tqh_first = NULL; \ (head)->tqh_last = &(head)->tqh_first; \ } while (0) #define TAILQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ (head)->tqh_first->field.tqe_prev = \ &(elm)->field.tqe_next; \ else \ (head)->tqh_last = &(elm)->field.tqe_next; \ (head)->tqh_first = (elm); \ (elm)->field.tqe_prev = &(head)->tqh_first; \ } while (0) #define TAILQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.tqe_next = NULL; \ (elm)->field.tqe_prev = (head)->tqh_last; \ *(head)->tqh_last = (elm); \ (head)->tqh_last = &(elm)->field.tqe_next; \ } while (0) #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ (elm)->field.tqe_next->field.tqe_prev = \ &(elm)->field.tqe_next; \ else \ (head)->tqh_last = &(elm)->field.tqe_next; \ (listelm)->field.tqe_next = (elm); \ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ } while (0) #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ (elm)->field.tqe_next = (listelm); \ *(listelm)->field.tqe_prev = (elm); \ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ } while (0) #define TAILQ_REMOVE(head, elm, field) do { \ if (((elm)->field.tqe_next) != NULL) \ (elm)->field.tqe_next->field.tqe_prev = \ (elm)->field.tqe_prev; \ else \ (head)->tqh_last = (elm)->field.tqe_prev; \ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ } while (0) #define TAILQ_REPLACE(head, elm, elm2, field) do { \ if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \ (elm2)->field.tqe_next->field.tqe_prev = \ &(elm2)->field.tqe_next; \ else \ (head)->tqh_last = &(elm2)->field.tqe_next; \ (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \ *(elm2)->field.tqe_prev = (elm2); \ } while (0) /* * Circular queue definitions. */ #define CIRCLEQ_HEAD(name, type) \ struct name { \ struct type *cqh_first; /* first element */ \ struct type *cqh_last; /* last element */ \ } #define CIRCLEQ_HEAD_INITIALIZER(head) \ { CIRCLEQ_END(&head), CIRCLEQ_END(&head) } #define CIRCLEQ_ENTRY(type) \ struct { \ struct type *cqe_next; /* next element */ \ struct type *cqe_prev; /* previous element */ \ } /* * Circular queue access methods */ #define CIRCLEQ_FIRST(head) ((head)->cqh_first) #define CIRCLEQ_LAST(head) ((head)->cqh_last) #define CIRCLEQ_END(head) ((void *)(head)) #define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) #define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) #define CIRCLEQ_EMPTY(head) \ (CIRCLEQ_FIRST(head) == CIRCLEQ_END(head)) #define CIRCLEQ_FOREACH(var, head, field) \ for((var) = CIRCLEQ_FIRST(head); \ (var) != CIRCLEQ_END(head); \ (var) = CIRCLEQ_NEXT(var, field)) #define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ for((var) = CIRCLEQ_LAST(head); \ (var) != CIRCLEQ_END(head); \ (var) = CIRCLEQ_PREV(var, field)) /* * Circular queue functions. */ #define CIRCLEQ_INIT(head) do { \ (head)->cqh_first = CIRCLEQ_END(head); \ (head)->cqh_last = CIRCLEQ_END(head); \ } while (0) #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ (elm)->field.cqe_next = (listelm)->field.cqe_next; \ (elm)->field.cqe_prev = (listelm); \ if ((listelm)->field.cqe_next == CIRCLEQ_END(head)) \ (head)->cqh_last = (elm); \ else \ (listelm)->field.cqe_next->field.cqe_prev = (elm); \ (listelm)->field.cqe_next = (elm); \ } while (0) #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ (elm)->field.cqe_next = (listelm); \ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ if ((listelm)->field.cqe_prev == CIRCLEQ_END(head)) \ (head)->cqh_first = (elm); \ else \ (listelm)->field.cqe_prev->field.cqe_next = (elm); \ (listelm)->field.cqe_prev = (elm); \ } while (0) #define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ (elm)->field.cqe_next = (head)->cqh_first; \ (elm)->field.cqe_prev = CIRCLEQ_END(head); \ if ((head)->cqh_last == CIRCLEQ_END(head)) \ (head)->cqh_last = (elm); \ else \ (head)->cqh_first->field.cqe_prev = (elm); \ (head)->cqh_first = (elm); \ } while (0) #define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.cqe_next = CIRCLEQ_END(head); \ (elm)->field.cqe_prev = (head)->cqh_last; \ if ((head)->cqh_first == CIRCLEQ_END(head)) \ (head)->cqh_first = (elm); \ else \ (head)->cqh_last->field.cqe_next = (elm); \ (head)->cqh_last = (elm); \ } while (0) #define CIRCLEQ_REMOVE(head, elm, field) do { \ if ((elm)->field.cqe_next == CIRCLEQ_END(head)) \ (head)->cqh_last = (elm)->field.cqe_prev; \ else \ (elm)->field.cqe_next->field.cqe_prev = \ (elm)->field.cqe_prev; \ if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) \ (head)->cqh_first = (elm)->field.cqe_next; \ else \ (elm)->field.cqe_prev->field.cqe_next = \ (elm)->field.cqe_next; \ } while (0) #define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \ if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == \ CIRCLEQ_END(head)) \ (head).cqh_last = (elm2); \ else \ (elm2)->field.cqe_next->field.cqe_prev = (elm2); \ if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == \ CIRCLEQ_END(head)) \ (head).cqh_first = (elm2); \ else \ (elm2)->field.cqe_prev->field.cqe_next = (elm2); \ } while (0) #endif /* !_SYS_QUEUE_H_ */ labrea-2.5-stable-1.orig/inc/syslog.h0100644000550600055060000002232407727437052016520 0ustar tonontonon#ifdef WIN32 /* -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/ . Copyright (c) 2001 Michael Davis . All rights reserved. . . Redistribution and use in source and binary forms, with or without . modification, are permitted provided that the following conditions . are met: . . 1. Redistributions of source code must retain the above copyright . notice, this list of conditions and the following disclaimer. . . 2. Redistributions in binary form must reproduce the above copyright . notice, this list of conditions and the following disclaimer in the . documentation and/or other materials provided with the distribution. . . 3. The name of author may not be used to endorse or promote products . derived from this software without specific prior written permission. . . THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, . INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY . AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL . THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, . EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, . PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; . OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, . WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR . OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF . ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\ */ /* $OpenBSD: syslog.h,v 1.5 1998/02/10 18:41:57 deraadt Exp $ */ /* $NetBSD: syslog.h,v 1.14 1996/04/03 20:46:44 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)syslog.h 8.1 (Berkeley) 6/2/93 */ #define _PATH_LOG "/dev/log" /* * priorities/facilities are encoded into a single 32-bit quantity, where the * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility * (0-big number). Both the priorities and the facilities map roughly * one-to-one to strings in the syslogd(8) source code. This mapping is * included in this file. * * priorities (these are ordered) */ #define LOG_EMERG 0 /* system is unusable */ #define LOG_ALERT 1 /* action must be taken immediately */ #define LOG_CRIT 2 /* critical conditions */ #define LOG_ERR 3 /* error conditions */ #define LOG_WARNING 4 /* warning conditions */ #define LOG_NOTICE 5 /* normal but significant condition */ #define LOG_INFO 6 /* informational */ #define LOG_DEBUG 7 /* debug-level messages */ #define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ /* extract priority */ #define LOG_PRI(p) ((p) & LOG_PRIMASK) #define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) #ifdef SYSLOG_NAMES #define INTERNAL_NOPRI 0x10 /* the "no priority" priority */ /* mark "facility" */ #define INTERNAL_MARK LOG_MAKEPRI(LOG_NFACILITIES, 0) typedef struct _code { char *c_name; int c_val; } CODE; CODE prioritynames[] = { { "alert", LOG_ALERT }, { "crit", LOG_CRIT }, { "debug", LOG_DEBUG }, { "emerg", LOG_EMERG }, { "err", LOG_ERR }, { "error", LOG_ERR }, /* DEPRECATED */ { "info", LOG_INFO }, { "none", INTERNAL_NOPRI }, /* INTERNAL */ { "notice", LOG_NOTICE }, { "panic", LOG_EMERG }, /* DEPRECATED */ { "warn", LOG_WARNING }, /* DEPRECATED */ { "warning", LOG_WARNING }, { NULL, -1 }, }; #endif /* facility codes */ #define LOG_KERN (0<<3) /* kernel messages */ #define LOG_USER (1<<3) /* random user-level messages */ #define LOG_MAIL (2<<3) /* mail system */ #define LOG_DAEMON (3<<3) /* system daemons */ #define LOG_AUTH (4<<3) /* security/authorization messages */ #define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ #define LOG_LPR (6<<3) /* line printer subsystem */ #define LOG_NEWS (7<<3) /* network news subsystem */ #define LOG_UUCP (8<<3) /* UUCP subsystem */ #define LOG_CRON (9<<3) /* clock daemon */ #define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */ #define LOG_FTP (11<<3) /* ftp daemon */ /* other codes through 15 reserved for system use */ #define LOG_LOCAL0 (16<<3) /* reserved for local use */ #define LOG_LOCAL1 (17<<3) /* reserved for local use */ #define LOG_LOCAL2 (18<<3) /* reserved for local use */ #define LOG_LOCAL3 (19<<3) /* reserved for local use */ #define LOG_LOCAL4 (20<<3) /* reserved for local use */ #define LOG_LOCAL5 (21<<3) /* reserved for local use */ #define LOG_LOCAL6 (22<<3) /* reserved for local use */ #define LOG_LOCAL7 (23<<3) /* reserved for local use */ #define LOG_NFACILITIES 24 /* current number of facilities */ #define LOG_FACMASK 0x03f8 /* mask to extract facility part */ /* facility of pri */ #define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) #ifdef SYSLOG_NAMES CODE facilitynames[] = { { "auth", LOG_AUTH }, { "authpriv", LOG_AUTHPRIV }, { "cron", LOG_CRON }, { "daemon", LOG_DAEMON }, { "ftp", LOG_FTP }, { "kern", LOG_KERN }, { "lpr", LOG_LPR }, { "mail", LOG_MAIL }, { "mark", INTERNAL_MARK }, /* INTERNAL */ { "news", LOG_NEWS }, { "security", LOG_AUTH }, /* DEPRECATED */ { "syslog", LOG_SYSLOG }, { "user", LOG_USER }, { "uucp", LOG_UUCP }, { "local0", LOG_LOCAL0 }, { "local1", LOG_LOCAL1 }, { "local2", LOG_LOCAL2 }, { "local3", LOG_LOCAL3 }, { "local4", LOG_LOCAL4 }, { "local5", LOG_LOCAL5 }, { "local6", LOG_LOCAL6 }, { "local7", LOG_LOCAL7 }, { NULL, -1 }, }; #endif #ifdef _KERNEL #define LOG_PRINTF -1 /* pseudo-priority to indicate use of printf */ #endif /* * arguments to setlogmask. */ #define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ /* * Option flags for openlog. * * LOG_ODELAY no longer does anything. * LOG_NDELAY is the inverse of what it used to be. */ #define LOG_PID 0x01 /* log the pid with each message */ #define LOG_CONS 0x02 /* log on the console if errors in sending */ #define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ #define LOG_NDELAY 0x08 /* don't delay open */ #define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ #define LOG_PERROR 0x20 /* log to stderr as well */ #ifndef _KERNEL /* * Don't use va_list in the vsyslog() prototype. Va_list is typedef'd in two * places ( and ), so if we include one * of them here we may collide with the utility's includes. It's unreasonable * for utilities to have to include one of them to include syslog.h, so we get * _BSD_VA_LIST_ from and use it. */ #ifndef WIN32 #include #include #endif /* L Gordon 2002-9-2 fix for cygwin/mingw: need stdarg.h for va_list and friends */ #ifdef WIN32 #include void AddEventSource(char *); void syslog(int, char *, ...); void vsyslog(int, char *, va_list); void openlog(char *, int, int); void closelog(void); unsigned long resolve_host(char *); #else __BEGIN_DECLS void closelog __P((void)); void openlog __P((const char *, int, int)); int setlogmask __P((int)); void syslog __P((int, const char *, ...)) __attribute__((__format__(__printf__,2,3))); void vsyslog __P((int, const char *, _BSD_VA_LIST_)); __END_DECLS #endif #else /* !_KERNEL */ void logpri __P((int)); void log __P((int, const char *, ...)) __kprintf_attribute__((__format__(__kprintf__,2,3))); int addlog __P((const char *, ...)) __kprintf_attribute__((__format__(__kprintf__,1,2))); void logwakeup __P((void)); #endif /* !_KERNEL */ #endif labrea-2.5-stable-1.orig/inc/syslog_name.h0100644000550600055060000000442207727437052017517 0ustar tonontonon#ifdef WIN32 // // Values are 32 bit values layed out as follows: // // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 // +---+-+-+-----------------------+-------------------------------+ // |Sev|C|R| Facility | Code | // +---+-+-+-----------------------+-------------------------------+ // // where // // Sev - is the severity code // // 00 - Success // 01 - Informational // 10 - Warning // 11 - Error // // C - is the Customer code flag // // R - is a reserved bit // // Facility - is the facility code // // Code - is the facility's status code // // // Define the facility codes // // // Define the severity codes // // // MessageId: MSG // // MessageText: // // %1 // #define MSG ((WORD)0x00000001L) // // MessageId: EVMSG_INSTALLED // // MessageText: // // The %1 service was installed. // #define EVMSG_INSTALLED ((WORD)0x00000002L) // // MessageId: EVMSG_REMOVED // // MessageText: // // The %1 service was removed. // #define EVMSG_REMOVED ((WORD)0x00000003L) // // MessageId: EVMSG_NOTREMOVED // // MessageText: // // The %1 service could not be removed. // #define EVMSG_NOTREMOVED ((WORD)0x00000004L) // // MessageId: EVMSG_CTRLHANDLERNOTINSTALLED // // MessageText: // // The control handler could not be installed. // #define EVMSG_CTRLHANDLERNOTINSTALLED ((WORD)0x00000005L) // // MessageId: EVMSG_FAILEDINIT // // MessageText: // // The initialization process failed. // #define EVMSG_FAILEDINIT ((WORD)0x00000006L) // // MessageId: EVMSG_STARTED // // MessageText: // // The service was started. // #define EVMSG_STARTED ((WORD)0x00000007L) // // MessageId: EVMSG_BADREQUEST // // MessageText: // // The service received an unsupported request. // #define EVMSG_BADREQUEST ((WORD)0x00000008L) // // MessageId: EVMSG_DEBUG // // MessageText: // // Debug: %1 // #define EVMSG_DEBUG ((WORD)0x00000009L) // // MessageId: EVMSG_STOPPED // // MessageText: // // The service was stopped. // #define EVMSG_STOPPED ((WORD)0x00000010L) #endif labrea-2.5-stable-1.orig/inc/utils.h0100644000550600055060000000416207730434533016333 0ustar tonontonon/* utils.h * This file is part of the LaBrea package * * Copyright (C) 2001, 2002 Tom Liston * * 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. * * $Id: utils.h,v 1.2 2003/09/12 21:23:39 lorgor Exp $ */ #ifndef UTILS_H #define UTILS_H #include /* Degree of verbosity in logging */ typedef enum {QUIET, NORMAL, VERBOSE, VERY_VERBOSE} amt_log_t; /* Output / logging control structure */ struct outp_s { /* flags */ uint16_t output; #define FL_OUTP_STDOUT_EPOCH 0x0001 /* -O */ #define FL_OUTP_STDOUT 0x0002 /* -o */ /* globals */ amt_log_t verbose; /* Degree of verbosity in logging */ int savedatalog; /* Save old logging level when logging turned off */ int syslog_open; /* TRUE if syslog open */ }; typedef struct outp_s outp_t; extern outp_t outp; void util_init(void); void util_open_syslog(char *ident); void util_print(const amt_log_t verbosity_msg, const char *fmt, ...); void util_clean_exit(int err); int util_nk_new (const ip_addr_t offset, const time_t culltime, const uint8_t *mac); void util_nk_free( const ip_addr_t offset ); void util_detach (void); void util_set_signal_handlers(void); void util_quit (void); void util_restart (void); #ifndef WIN32 void util_toggle_logging(void); #endif #ifdef WIN32 DWORD WINAPI util_timer(LPVOID lpAintGonnaUseThis); #else void util_timer(void); #endif int util_check_version_win98(void); int util_check_version_winNT(void); #endif /* UTILS_H */ labrea-2.5-stable-1.orig/inc/debug.h0100644000550600055060000000414607730434533016263 0ustar tonontonon/* $Id: debug.h,v 1.2 2003/09/12 21:23:39 lorgor Exp $ */ /* ** Copyright (C) 1998-2002 Martin Roesch ** ** 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. ** ** $Id: debug.h,v 1.2 2003/09/12 21:23:39 lorgor Exp $ */ #ifndef DEBUG_H #define DEBUG_H #define DEBUG_TEXT "LABREA_DEBUG: " #define DEBUG_ALL 0xffffffff #define DEBUG_INIT 0x00000001 /* 1 */ #define DEBUG_PKTIO 0x00000002 /* 2 */ #define DEBUG_PKTPROC 0x00000004 /* 4 */ #define DEBUG_SIGNAL 0x00000008 /* 8 */ #define DEBUG_xxx3 0x00000010 /* 16 */ #define DEBUG_xxx4 0x00000020 /* 32 */ #define DEBUG_xxx5 0x00000040 /* 64 */ #define DEBUG_xxx6 0x00000080 /* 128 */ #define DEBUG_xxx7 0x00000100 /* 256 */ #define DEBUG_xxx8 0x00000200 /* 512 */ #define DEBUG_xxx9 0x00000400 /* 1024 */ #define DEBUG_xxx10 0x00000800 /* 2048 */ #define DEBUG_xxx11 0x00001000 /* 4096 */ #define DEBUG_xxx12 0x00002000 /* 8192 */ #define DEBUG_xxx13 0x00004000 /* 16384 */ #define DEBUG_xxx14 0x00008000 /* 32768 */ #define DEBUG_xxx15 0x00010000 /* 65536 */ #define DEBUG_xxx16 0x00020000 /* 131072 */ #define DEBUG_xxx17 0x00040000 /* 262144 */ #define DEBUG_xxx18 0x00080000 /* 524288 / (+ conv2 ) 589824 */ #ifdef DEBUG_LB #define DEBUG_PRT(dbg,fmt,arg...) \ if (ctl.debuglevel & dbg) util_print(QUIET,"Labrea_DEBUG: " fmt,##arg); #else #define DEBUG_PRT(dbg,fmt,arg...) #endif #endif /* DEBUG_H */ labrea-2.5-stable-1.orig/inc/Makefile.am0100644000550600055060000000044307607335677017070 0ustar tonontonon## Process this file with automake to produce Makefile.in ## ## $Id: Makefile.am,v 1.1.1.1 2003/01/09 18:13:19 lorgor Exp $ noinst_HEADERS = bget.h ctl.h err.h getopt.h labrea.h lbio.h \ pcaputil.h pkt.h pkt_handler.h queue.h syslog.h syslog_name.h utils.h \ debug.h DISTCLEANFILES = *~ labrea-2.5-stable-1.orig/inc/Makefile.in0100644000550600055060000002065107750022034017057 0ustar tonontonon# Makefile.in generated by automake 1.7.5 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # 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@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = : host_triplet = @host@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DNETINC = @DNETINC@ DNETLIB = @DNETLIB@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LABREA_CONF = @LABREA_CONF@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCAPINC = @PCAPINC@ PCAPLIB = @PCAPLIB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ noinst_HEADERS = bget.h ctl.h err.h getopt.h labrea.h lbio.h \ pcaputil.h pkt.h pkt_handler.h queue.h syslog.h syslog_name.h utils.h \ debug.h DISTCLEANFILES = *~ subdir = inc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = HEADERS = $(noinst_HEADERS) DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in all: all-am .SUFFIXES: $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu inc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) uninstall-info-am: ETAGS = etags ETAGSFLAGS = CTAGS = ctags CTAGSFLAGS = tags: TAGS 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ 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; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ 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; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$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 $(HEADERS) 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_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am 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-info-am .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic ctags \ distclean distclean-generic distclean-tags distdir dvi dvi-am \ info info-am install install-am install-data install-data-am \ install-exec install-exec-am install-info install-info-am \ install-man install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ uninstall uninstall-am uninstall-info-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: labrea-2.5-stable-1.orig/src/0040777000550600055060000000000007750022577015047 5ustar tonontononlabrea-2.5-stable-1.orig/src/Makefile.am0100644000550600055060000000065707607335677017115 0ustar tonontonon## Process this file with automake to produce Makefile.in ## ## $Id: Makefile.am,v 1.1.1.1 2003/01/09 18:13:19 lorgor Exp $ AM_CPPFLAGS = -I../inc -I- @DNETINC@ @PCAPINC@ sbin_PROGRAMS = labrea labrea_SOURCES = labrea.c labrea_init.c pkt_handler.c lbio.c ctl.c \ utils.c pcaputil.c bget.c pkt.c labrea_LDADD = @LIBOBJS@ @DNETLIB@ @PCAPLIB@ EXTRA_DIST = getopt1.c getopt.c memcmp.c \ strlcpy.c syslog.c DISTCLEANFILES = *~ labrea-2.5-stable-1.orig/src/Makefile.in0100644000550600055060000003262707750022034017103 0ustar tonontonon# Makefile.in generated by automake 1.7.5 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # 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@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ 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 = : host_triplet = @host@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DNETINC = @DNETINC@ DNETLIB = @DNETLIB@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LABREA_CONF = @LABREA_CONF@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCAPINC = @PCAPINC@ PCAPLIB = @PCAPLIB@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ ac_ct_CC = @ac_ct_CC@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ AM_CPPFLAGS = -I../inc -I- @DNETINC@ @PCAPINC@ sbin_PROGRAMS = labrea labrea_SOURCES = labrea.c labrea_init.c pkt_handler.c lbio.c ctl.c \ utils.c pcaputil.c bget.c pkt.c labrea_LDADD = @LIBOBJS@ @DNETLIB@ @PCAPLIB@ EXTRA_DIST = getopt1.c getopt.c memcmp.c \ strlcpy.c syslog.c DISTCLEANFILES = *~ subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = sbin_PROGRAMS = labrea$(EXEEXT) PROGRAMS = $(sbin_PROGRAMS) am_labrea_OBJECTS = labrea.$(OBJEXT) labrea_init.$(OBJEXT) \ pkt_handler.$(OBJEXT) lbio.$(OBJEXT) ctl.$(OBJEXT) \ utils.$(OBJEXT) pcaputil.$(OBJEXT) bget.$(OBJEXT) pkt.$(OBJEXT) labrea_OBJECTS = $(am_labrea_OBJECTS) labrea_DEPENDENCIES = @LIBOBJS@ labrea_LDFLAGS = DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = $(DEPDIR)/getopt.Po $(DEPDIR)/getopt1.Po \ @AMDEP_TRUE@ $(DEPDIR)/memcmp.Po $(DEPDIR)/strlcpy.Po \ @AMDEP_TRUE@ $(DEPDIR)/syslog.Po ./$(DEPDIR)/bget.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ctl.Po ./$(DEPDIR)/labrea.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/labrea_init.Po ./$(DEPDIR)/lbio.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pcaputil.Po ./$(DEPDIR)/pkt.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pkt_handler.Po ./$(DEPDIR)/utils.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ DIST_SOURCES = $(labrea_SOURCES) DIST_COMMON = Makefile.am Makefile.in getopt.c getopt1.c memcmp.c \ strlcpy.c syslog.c SOURCES = $(labrea_SOURCES) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(sbindir) @list='$(sbin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f"; \ $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f || exit 1; \ else :; fi; \ done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f $(DESTDIR)$(sbindir)/$$f"; \ rm -f $(DESTDIR)$(sbindir)/$$f; \ done clean-sbinPROGRAMS: -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) labrea$(EXEEXT): $(labrea_OBJECTS) $(labrea_DEPENDENCIES) @rm -f labrea$(EXEEXT) $(LINK) $(labrea_LDFLAGS) $(labrea_OBJECTS) $(labrea_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/memcmp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strlcpy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/syslog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bget.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/labrea.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/labrea_init.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lbio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcaputil.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pkt_handler.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ distclean-depend: -rm -rf $(DEPDIR) ./$(DEPDIR) .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ @am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ @am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ @am__fastdepCC_TRUE@ fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ @am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ @am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ @am__fastdepCC_TRUE@ fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` uninstall-info-am: ETAGS = etags ETAGSFLAGS = CTAGS = ctags CTAGSFLAGS = tags: TAGS 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; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ 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; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ 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; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: $(mkinstalldirs) $(DESTDIR)$(sbindir) 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_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-compile distclean-depend \ distclean-generic distclean-tags dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-exec-am: install-sbinPROGRAMS install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am 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-info-am uninstall-sbinPROGRAMS .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-sbinPROGRAMS ctags distclean distclean-compile \ distclean-depend distclean-generic distclean-tags distdir dvi \ dvi-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man 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-info-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: labrea-2.5-stable-1.orig/src/getopt.c0100644000550600055060000010245207727437047016520 0ustar tonontonon/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* This tells Alpha OSF/1 not to define a getopt prototype in . Ditto for AIX 3.2 and . */ #ifndef _NO_PROTO # define _NO_PROTO #endif #ifdef HAVE_CONFIG_H # include "config.h" #endif #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ # ifndef const # define const # endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 # include # if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION # define ELIDE_CODE # endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ # include # include #endif /* GNU C library. */ #ifdef VMS # include # if HAVE_STRING_H - 0 # include # endif #endif #ifndef _ /* This is for other GNU distributions with internationalized messages. */ # if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC # include # ifndef _ # define _(msgid) gettext (msgid) # endif # else # define _(msgid) (msgid) # endif # if defined _LIBC && defined USE_IN_LIBIO # include # endif #endif /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Formerly, initialization of getopt depended on optind==0, which causes problems with re-calling getopt as programs generally don't know that. */ int __getopt_initialized; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; /* Value of POSIXLY_CORRECT environment variable. */ static char *posixly_correct; #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ # include # define my_index strchr #else # if HAVE_STRING_H # include # else # include # endif /* Avoid depending on library functions or files whose names are inconsistent. */ #ifndef getenv extern char *getenv (); #endif static char * my_index (str, chr) const char *str; int chr; { while (*str) { if (*str == chr) return (char *) str; str++; } return 0; } /* If using GCC, we can safely declare strlen this way. If not using GCC, it is ok not to declare it. */ #ifdef __GNUC__ /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. That was relevant to code that was here before. */ # if (!defined __STDC__ || !__STDC__) && !defined strlen /* gcc with -traditional declares the built-in strlen to return int, and has done so at least since version 2.4.5. -- rms. */ extern int strlen (const char *); # endif /* not __STDC__ */ #endif /* __GNUC__ */ #endif /* not __GNU_LIBRARY__ */ /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; #ifdef _LIBC /* Stored original parameters. XXX This is no good solution. We should rather copy the args so that we can compare them later. But we must not use malloc(3). */ extern int __libc_argc; extern char **__libc_argv; /* Bash 2.0 gives us an environment variable containing flags indicating ARGV elements that should not be considered arguments. */ # ifdef USE_NONOPTION_FLAGS /* Defined in getopt_init.c */ extern char *__getopt_nonoption_flags; static int nonoption_flags_max_len; static int nonoption_flags_len; # endif # ifdef USE_NONOPTION_FLAGS # define SWAP_FLAGS(ch1, ch2) \ if (nonoption_flags_len > 0) \ { \ char __tmp = __getopt_nonoption_flags[ch1]; \ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ __getopt_nonoption_flags[ch2] = __tmp; \ } # else # define SWAP_FLAGS(ch1, ch2) # endif #else /* !_LIBC */ # define SWAP_FLAGS(ch1, ch2) #endif /* _LIBC */ /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ #if defined __STDC__ && __STDC__ static void exchange (char **); #endif static void exchange (argv) char **argv; { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS /* First make sure the handling of the `__getopt_nonoption_flags' string can work normally. Our top argument must be in the range of the string. */ if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) { /* We must extend the array. The user plays games with us and presents new arguments. */ char *new_str = malloc (top + 1); if (new_str == NULL) nonoption_flags_len = nonoption_flags_max_len = 0; else { memset (__mempcpy (new_str, __getopt_nonoption_flags, nonoption_flags_max_len), '\0', top + 1 - nonoption_flags_max_len); nonoption_flags_max_len = top + 1; __getopt_nonoption_flags = new_str; } } #endif while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; SWAP_FLAGS (bottom + i, middle + i); } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ #if defined __STDC__ && __STDC__ static const char *_getopt_initialize (int, char *const *, const char *); #endif static const char * _getopt_initialize (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind; nextchar = NULL; posixly_correct = getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (posixly_correct != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; #if defined _LIBC && defined USE_NONOPTION_FLAGS if (posixly_correct == NULL && argc == __libc_argc && argv == __libc_argv) { if (nonoption_flags_max_len == 0) { if (__getopt_nonoption_flags == NULL || __getopt_nonoption_flags[0] == '\0') nonoption_flags_max_len = -1; else { const char *orig_str = __getopt_nonoption_flags; int len = nonoption_flags_max_len = strlen (orig_str); if (nonoption_flags_max_len < argc) nonoption_flags_max_len = argc; __getopt_nonoption_flags = (char *) malloc (nonoption_flags_max_len); if (__getopt_nonoption_flags == NULL) nonoption_flags_max_len = -1; else memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), '\0', nonoption_flags_max_len - len); } } nonoption_flags_len = nonoption_flags_max_len; } else nonoption_flags_len = 0; #endif return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int argc; char *const *argv; const char *optstring; const struct option *longopts; int *longind; int long_only; { int print_errors = opterr; if (optstring[0] == ':') print_errors = 0; if (argc < 1) return -1; optarg = NULL; if (optind == 0 || !__getopt_initialized) { if (optind == 0) optind = 1; /* Don't scan ARGV[0], the program name. */ optstring = _getopt_initialize (argc, argv, optstring); __getopt_initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ || (optind < nonoption_flags_len \ && __getopt_nonoption_flags[optind] == '1')) #else # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') #endif if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (last_nonopt > optind) last_nonopt = optind; if (first_nonopt > optind) first_nonopt = optind; if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && NONOPTION_P) optind++; last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp (argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) return -1; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag || pfound->val != p->val) /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); #endif } nextchar += strlen (nextchar); optind++; optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; #endif if (argv[optind - 1][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("\ %s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); #else fprintf (stderr, _("\ %s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } else { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("\ %s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); #else fprintf (stderr, _("\ %s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #endif } nextchar += strlen (nextchar); optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); #endif } nextchar += strlen (nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index (optstring, *nextchar) == NULL) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; #endif if (argv[optind][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); #else fprintf (stderr, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); #endif } else { /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); #else fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #endif } nextchar = (char *) ""; optind++; optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = my_index (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; #endif if (posixly_correct) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("%s: illegal option -- %c\n"), argv[0], c); #else fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); #endif } else { #if defined _LIBC && defined USE_IN_LIBIO __asprintf (&buf, _("%s: invalid option -- %c\n"), argv[0], c); #else fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #endif } optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("%s: option requires an argument -- %c\n"), argv[0], c); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); #endif } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); #endif } nextchar += strlen (nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); #endif } nextchar += strlen (nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (print_errors) { #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("\ %s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); #endif } nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (print_errors) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO char *buf; __asprintf (&buf, _("%s: option requires an argument -- %c\n"), argv[0], c); if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); free (buf); #else fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); #endif } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif /* Not ELIDE_CODE. */ #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == -1) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ labrea-2.5-stable-1.orig/src/getopt1.c0100644000550600055060000001065007727437047016577 0ustar tonontonon/* getopt_long and getopt_long_only entry points for GNU getopt. Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "getopt.h" #if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const #define const #endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 #include #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION #define ELIDE_CODE #endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #include #endif #ifndef NULL #define NULL 0 #endif int getopt_long (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 1); } #endif /* Not ELIDE_CODE. */ #ifdef TEST #include int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; int option_index = 0; static struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 0, 0, 0}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); if (c == -1) break; switch (c) { case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case 'd': printf ("option d with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ labrea-2.5-stable-1.orig/src/memcmp.c0100644000550600055060000002233107727437047016471 0ustar tonontonon/* Copyright (C) 1991, 1993, 1995, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Torbjorn Granlund (tege@sics.se). The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #undef __ptr_t #if defined __cplusplus || (defined __STDC__ && __STDC__) # define __ptr_t void * #else /* Not C++ or ANSI C. */ # undef const # define const # define __ptr_t char * #endif /* C++ or ANSI C. */ #ifndef __P # if defined __GNUC__ || (defined __STDC__ && __STDC__) # define __P(args) args # else # define __P(args) () # endif /* GCC. */ #endif /* Not __P. */ #if defined HAVE_STRING_H || defined _LIBC # include #endif #undef memcmp #ifdef _LIBC # include # include # if __BYTE_ORDER == __BIG_ENDIAN # define WORDS_BIGENDIAN # endif #else /* Not in the GNU C library. */ # include /* Type to use for aligned memory operations. This should normally be the biggest type supported by a single load and store. Must be an unsigned type. */ # define op_t unsigned long int # define OPSIZ (sizeof(op_t)) /* Threshold value for when to enter the unrolled loops. */ # define OP_T_THRES 16 /* Type to use for unaligned operations. */ typedef unsigned char byte; # ifndef WORDS_BIGENDIAN # define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2))) # else # define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2))) # endif #endif /* In the GNU C library. */ #ifdef WORDS_BIGENDIAN # define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1) #else # define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b)) #endif /* BE VERY CAREFUL IF YOU CHANGE THIS CODE! */ /* The strategy of this memcmp is: 1. Compare bytes until one of the block pointers is aligned. 2. Compare using memcmp_common_alignment or memcmp_not_common_alignment, regarding the alignment of the other block after the initial byte operations. The maximum number of full words (of type op_t) are compared in this way. 3. Compare the few remaining bytes. */ #ifndef WORDS_BIGENDIAN /* memcmp_bytes -- Compare A and B bytewise in the byte order of the machine. A and B are known to be different. This is needed only on little-endian machines. */ static int memcmp_bytes __P((op_t, op_t)); # ifdef __GNUC__ __inline # endif static int memcmp_bytes (a, b) op_t a, b; { long int srcp1 = (long int) &a; long int srcp2 = (long int) &b; op_t a0, b0; do { a0 = ((byte *) srcp1)[0]; b0 = ((byte *) srcp2)[0]; srcp1 += 1; srcp2 += 1; } while (a0 == b0); return a0 - b0; } #endif static int memcmp_common_alignment __P((long, long, size_t)); /* memcmp_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t' objects (not LEN bytes!). Both SRCP1 and SRCP2 should be aligned for memory operations on `op_t's. */ #ifdef __GNUC__ __inline #endif static int memcmp_common_alignment (srcp1, srcp2, len) long int srcp1; long int srcp2; size_t len; { op_t a0, a1; op_t b0, b1; switch (len % 4) { default: /* Avoid warning about uninitialized local variables. */ case 2: a0 = ((op_t *) srcp1)[0]; b0 = ((op_t *) srcp2)[0]; srcp1 -= 2 * OPSIZ; srcp2 -= 2 * OPSIZ; len += 2; goto do1; case 3: a1 = ((op_t *) srcp1)[0]; b1 = ((op_t *) srcp2)[0]; srcp1 -= OPSIZ; srcp2 -= OPSIZ; len += 1; goto do2; case 0: if (OP_T_THRES <= 3 * OPSIZ && len == 0) return 0; a0 = ((op_t *) srcp1)[0]; b0 = ((op_t *) srcp2)[0]; goto do3; case 1: a1 = ((op_t *) srcp1)[0]; b1 = ((op_t *) srcp2)[0]; srcp1 += OPSIZ; srcp2 += OPSIZ; len -= 1; if (OP_T_THRES <= 3 * OPSIZ && len == 0) goto do0; /* Fall through. */ } do { a0 = ((op_t *) srcp1)[0]; b0 = ((op_t *) srcp2)[0]; if (a1 != b1) return CMP_LT_OR_GT (a1, b1); do3: a1 = ((op_t *) srcp1)[1]; b1 = ((op_t *) srcp2)[1]; if (a0 != b0) return CMP_LT_OR_GT (a0, b0); do2: a0 = ((op_t *) srcp1)[2]; b0 = ((op_t *) srcp2)[2]; if (a1 != b1) return CMP_LT_OR_GT (a1, b1); do1: a1 = ((op_t *) srcp1)[3]; b1 = ((op_t *) srcp2)[3]; if (a0 != b0) return CMP_LT_OR_GT (a0, b0); srcp1 += 4 * OPSIZ; srcp2 += 4 * OPSIZ; len -= 4; } while (len != 0); /* This is the right position for do0. Please don't move it into the loop. */ do0: if (a1 != b1) return CMP_LT_OR_GT (a1, b1); return 0; } static int memcmp_not_common_alignment __P((long, long, size_t)); /* memcmp_not_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t' objects (not LEN bytes!). SRCP2 should be aligned for memory operations on `op_t', but SRCP1 *should be unaligned*. */ #ifdef __GNUC__ __inline #endif static int memcmp_not_common_alignment (srcp1, srcp2, len) long int srcp1; long int srcp2; size_t len; { op_t a0, a1, a2, a3; op_t b0, b1, b2, b3; op_t x; int shl, shr; /* Calculate how to shift a word read at the memory operation aligned srcp1 to make it aligned for comparison. */ shl = 8 * (srcp1 % OPSIZ); shr = 8 * OPSIZ - shl; /* Make SRCP1 aligned by rounding it down to the beginning of the `op_t' it points in the middle of. */ srcp1 &= -OPSIZ; switch (len % 4) { default: /* Avoid warning about uninitialized local variables. */ case 2: a1 = ((op_t *) srcp1)[0]; a2 = ((op_t *) srcp1)[1]; b2 = ((op_t *) srcp2)[0]; srcp1 -= 1 * OPSIZ; srcp2 -= 2 * OPSIZ; len += 2; goto do1; case 3: a0 = ((op_t *) srcp1)[0]; a1 = ((op_t *) srcp1)[1]; b1 = ((op_t *) srcp2)[0]; srcp2 -= 1 * OPSIZ; len += 1; goto do2; case 0: if (OP_T_THRES <= 3 * OPSIZ && len == 0) return 0; a3 = ((op_t *) srcp1)[0]; a0 = ((op_t *) srcp1)[1]; b0 = ((op_t *) srcp2)[0]; srcp1 += 1 * OPSIZ; goto do3; case 1: a2 = ((op_t *) srcp1)[0]; a3 = ((op_t *) srcp1)[1]; b3 = ((op_t *) srcp2)[0]; srcp1 += 2 * OPSIZ; srcp2 += 1 * OPSIZ; len -= 1; if (OP_T_THRES <= 3 * OPSIZ && len == 0) goto do0; /* Fall through. */ } do { a0 = ((op_t *) srcp1)[0]; b0 = ((op_t *) srcp2)[0]; x = MERGE(a2, shl, a3, shr); if (x != b3) return CMP_LT_OR_GT (x, b3); do3: a1 = ((op_t *) srcp1)[1]; b1 = ((op_t *) srcp2)[1]; x = MERGE(a3, shl, a0, shr); if (x != b0) return CMP_LT_OR_GT (x, b0); do2: a2 = ((op_t *) srcp1)[2]; b2 = ((op_t *) srcp2)[2]; x = MERGE(a0, shl, a1, shr); if (x != b1) return CMP_LT_OR_GT (x, b1); do1: a3 = ((op_t *) srcp1)[3]; b3 = ((op_t *) srcp2)[3]; x = MERGE(a1, shl, a2, shr); if (x != b2) return CMP_LT_OR_GT (x, b2); srcp1 += 4 * OPSIZ; srcp2 += 4 * OPSIZ; len -= 4; } while (len != 0); /* This is the right position for do0. Please don't move it into the loop. */ do0: x = MERGE(a2, shl, a3, shr); if (x != b3) return CMP_LT_OR_GT (x, b3); return 0; } int memcmp (s1, s2, len) const __ptr_t s1; const __ptr_t s2; size_t len; { op_t a0; op_t b0; long int srcp1 = (long int) s1; long int srcp2 = (long int) s2; op_t res; if (len >= OP_T_THRES) { /* There are at least some bytes to compare. No need to test for LEN == 0 in this alignment loop. */ while (srcp2 % OPSIZ != 0) { a0 = ((byte *) srcp1)[0]; b0 = ((byte *) srcp2)[0]; srcp1 += 1; srcp2 += 1; res = a0 - b0; if (res != 0) return res; len -= 1; } /* SRCP2 is now aligned for memory operations on `op_t'. SRCP1 alignment determines if we can do a simple, aligned compare or need to shuffle bits. */ if (srcp1 % OPSIZ == 0) res = memcmp_common_alignment (srcp1, srcp2, len / OPSIZ); else res = memcmp_not_common_alignment (srcp1, srcp2, len / OPSIZ); if (res != 0) return res; /* Number of bytes remaining in the interval [0..OPSIZ-1]. */ srcp1 += len & -OPSIZ; srcp2 += len & -OPSIZ; len %= OPSIZ; } /* There are just a few bytes to compare. Use byte memory operations. */ while (len != 0) { a0 = ((byte *) srcp1)[0]; b0 = ((byte *) srcp2)[0]; srcp1 += 1; srcp2 += 1; res = a0 - b0; if (res != 0) return res; len -= 1; } return 0; } #ifdef weak_alias # undef bcmp weak_alias (memcmp, bcmp) #endif labrea-2.5-stable-1.orig/src/strlcpy.c0100644000550600055060000000464007727437047016716 0ustar tonontonon/* $OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $ */ /* * Copyright (c) 1998 Todd C. Miller * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include #include /* * Copy src to string dst of size siz. At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). * Returns strlen(src); if retval >= siz, truncation occurred. */ size_t strlcpy(dst, src, siz) char *dst; const char *src; size_t siz; { register char *d = dst; register const char *s = src; register size_t n = siz; /* Copy as many bytes as will fit */ if (n != 0 && --n != 0) { do { if ((*d++ = *s++) == 0) break; } while (--n != 0); } /* Not enough room in dst, add NUL and traverse rest of src */ if (n == 0) { if (siz != 0) *d = '\0'; /* NUL-terminate dst */ while (*s++) ; } return(s - src - 1); /* count does not include NUL */ } labrea-2.5-stable-1.orig/src/syslog.c0100644000550600055060000002432607727437047016541 0ustar tonontonon#ifdef WIN32 /* -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/ . Copyright (c) 2001 Michael Davis . All rights reserved. . . Redistribution and use in source and binary forms, with or without . modification, are permitted provided that the following conditions . are met: . . 1. Redistributions of source code must retain the above copyright . notice, this list of conditions and the following disclaimer. . . 2. Redistributions in binary form must reproduce the above copyright . notice, this list of conditions and the following disclaimer in the . documentation and/or other materials provided with the distribution. . . 3. The name of author may not be used to endorse or promote products . derived from this software without specific prior written permission. . . THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, . INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY . AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL . THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, . EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, . PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; . OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, . WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR . OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF . ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. . -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\ */ #include "config.h" // LG 2002-11-28 ajout pour strlcpy #include #include #include #include #include #include #include #include #ifdef HAVE_ERR_H #include #else #include "err.h" #endif #include "syslog_name.h" #include "syslog.h" #include "utils.h" #include "labrea.h" #include "ctl.h" #define TBUF_LEN 2048 #define FMT_LEN 1024 #define INTERNALLOG LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID static int LogStat = 0; /* status bits, set by openlog() */ static char LogTag[PGM_NAME_SIZE] = ""; /* string to tag the entry with */ /* LG 2002-11-28 allocate space for entire string */ static int LogFacility = LOG_USER; /* default facility code */ static int LogMask = 0xff; /* mask of priorities to be logged */ /* LG 2002-11-28 open syslog once for all */ static SOCKET sockfd; /* for remote syslog */ static struct sockaddr_in sin; void syslog(int pri, char *fmt, ...) { va_list ap; va_start(ap, fmt); vsyslog(pri, fmt, ap); va_end(ap); } void vsyslog(int pri, char *fmt, va_list ap){ char ch, *p, *t; LPSTR lpstrings[1]; /* array of strings containing msg */ register int cnt; int tbuf_left, fmt_left, prlen, saved_errno=0; char *stdp, tbuf[TBUF_LEN], fmt_cpy[FMT_LEN]; time_t now; HANDLE hEventLog; /* handle to the Event Log. */ /* * Log to event log locally if remote syslog server * not opened or not specified */ if(strlen(ctl.syslog_server) == 0) { /* Log to Event Log. */ p = tbuf; tbuf_left = TBUF_LEN; saved_errno = errno; /* * We wouldn't need this mess if printf handled %m, or if * strerror() had been invented before syslog(). */ for (t = fmt_cpy, fmt_left = FMT_LEN; (ch = *fmt); ++fmt) { if (ch == '%' && fmt[1] == 'm') { ++fmt; prlen = _snprintf(t, fmt_left, "%s", strerror(saved_errno)); if (prlen >= fmt_left) prlen = fmt_left - 1; t += prlen; fmt_left -= prlen; } else { if (fmt_left > 1) { *t++ = ch; fmt_left--; } } } *t = '\0'; _vsnprintf(p, tbuf_left, fmt_cpy, ap); /* Get connected, output the message to the local logger. */ assert(outp.syslog_open); /* * if (!opened) * openlog(LogTag, LogStat, 0); */ hEventLog = RegisterEventSource(NULL, LogTag); if (hEventLog == NULL) return; /* Now, actually report it. */ lpstrings[0] = p; ReportEvent(hEventLog, EVENTLOG_INFORMATION_TYPE, 0, MSG, NULL, 1, 0, (LPCTSTR *)lpstrings, NULL); DeregisterEventSource(hEventLog); return; } /* * Else log to remote syslog server */ /* Check for invalid bits. */ if (pri & ~(LOG_PRIMASK|LOG_FACMASK)) { syslog(INTERNALLOG, "syslog: unknown facility/priority: %x", pri); pri &= LOG_PRIMASK|LOG_FACMASK; } /* Check priority against setlogmask values. */ if (!(LOG_MASK(LOG_PRI(pri)) & LogMask)) return; saved_errno = errno; /* Set default facility if none specified. */ if ((pri & LOG_FACMASK) == 0) pri |= LogFacility; /* Build the message. */ /* * Although it's tempting, we can't ignore the possibility of * overflowing the buffer when assembling the "fixed" portion * of the message. Strftime's "%h" directive expands to the * locale's abbreviated month name, but if the user has the * ability to construct to his own locale files, it may be * arbitrarily long. */ (void)time(&now); p = tbuf; tbuf_left = TBUF_LEN; #define DEC() \ do { \ if (prlen >= tbuf_left) \ prlen = tbuf_left - 1; \ p += prlen; \ tbuf_left -= prlen; \ } while (0) prlen = _snprintf(p, tbuf_left, "<%d>", pri); DEC(); prlen = strftime(p, tbuf_left, "%h %e %T ", localtime(&now)); DEC(); if (LogStat & LOG_PERROR) stdp = p; /* if (LogTag == NULL) LogTag = 0; //VERSION zappe a 0 L Gordon 2002-11-13 */ if (LogTag != NULL) { prlen = _snprintf(p, tbuf_left, "%s", LogTag); DEC(); } if (LogStat & LOG_PID) { prlen = _snprintf(p, tbuf_left, "[%d]", _getpid()); DEC(); } if (LogTag != NULL) { if (tbuf_left > 1) { *p++ = ':'; tbuf_left--; } if (tbuf_left > 1) { *p++ = ' '; tbuf_left--; } } /* * We wouldn't need this mess if printf handled %m, or if * strerror() had been invented before syslog(). */ for (t = fmt_cpy, fmt_left = FMT_LEN; (ch = *fmt); ++fmt) { if (ch == '%' && fmt[1] == 'm') { ++fmt; prlen = _snprintf(t, fmt_left, "%s", strerror(saved_errno)); if (prlen >= fmt_left) prlen = fmt_left - 1; t += prlen; fmt_left -= prlen; } else { if (fmt_left > 1) { *t++ = ch; fmt_left--; } } } *t = '\0'; prlen = vsnprintf(p, tbuf_left, fmt_cpy, ap); DEC(); cnt = p - tbuf; if(sendto(sockfd,tbuf,cnt,(int)NULL, (SOCKADDR *)&sin, sizeof(SOCKADDR_IN)) == SOCKET_ERROR) { warnx("*** Could not send the alert to the syslog server. Error Number: %d.\n", WSAGetLastError()); closesocket(sockfd); return; } } /* * openlog - open remote syslog server or event logging */ void openlog(char *ident, int logstat, int logfac){ /* * Open remote syslog server */ if(strlen(ctl.syslog_server) > 0){ /* Connect to Target server. */ if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == SOCKET_ERROR){ warnx("*** Could not create the socket to send the syslog alert. Error Number: %d.\n", WSAGetLastError()); } else { sin.sin_port = htons((u_short)ctl.syslog_port); sin.sin_family = AF_INET; if (!(sin.sin_addr.s_addr = resolve_host(ctl.syslog_server))){ warnx("*** Could not resolve syslog server's hostname. Error Number: %d.\n", WSAGetLastError()); closesocket(sockfd); } else { outp.syslog_open = TRUE; return; } } warnx("*** Remote syslog not working, will now fail over to local event log"); ctl.syslog_server[0] = '\0'; /* Null string to show are logging locally */ } /* * Open local event logging */ if (!util_check_version_winNT()) { warnx("*** Local event logging requires WinNT or better"); return; } if(ident != NULL){ strlcpy(LogTag, ident, sizeof(LogTag)); LogStat = logstat; if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0) LogFacility = logfac; /* Add the registry key each time openlog is called. */ AddEventSource(LogTag); } outp.syslog_open = TRUE; } void closelog(void) { if((strlen(ctl.syslog_server) > 0) && outp.syslog_open) closesocket(sockfd); } /* Taken from MSDN. */ void AddEventSource(char *ident) { HKEY hk; DWORD dwData; char szFilePath[_MAX_PATH]; char key[_MAX_PATH]; // Add your source name as a subkey under the Application // key in the EventLog registry key. _snprintf(key, sizeof(key), "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\%s", ident); if (RegCreateKey(HKEY_LOCAL_MACHINE, key, &hk)) { warnx("*** Could not create the registry key."); exit(-1); } // Set the name of the message file. GetModuleFileName(NULL, szFilePath, sizeof(szFilePath)); // Add the name to the EventMessageFile subkey. if (RegSetValueEx(hk, // subkey handle "EventMessageFile", // value name 0, // must be zero REG_EXPAND_SZ, // value type (LPBYTE) szFilePath, // pointer to value data strlen(szFilePath) + 1)) { // length of value data warnx("*** Could not set the event message file. - Labrea needs admin privileges to run."); exit(-1); } // Set the supported event types in the TypesSupported subkey. dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE | EVENTLOG_AUDIT_SUCCESS | EVENTLOG_AUDIT_FAILURE; if (RegSetValueEx(hk, // subkey handle "TypesSupported", // value name 0, // must be zero REG_DWORD, // value type (LPBYTE) &dwData, // pointer to value data sizeof(DWORD))){ // length of value data warnx("*** Could not set the supported types."); exit(-1); } RegCloseKey(hk); } unsigned long resolve_host(char *host) { struct hostent *he; unsigned long ip; if (inet_addr(host) == INADDR_NONE) { he = gethostbyname(host); if (!he) { printf("Unable to resolve address: %s", host); return 0; } else memcpy((char FAR *)&(ip), he->h_addr, he->h_length); } else { ip = inet_addr(host); } return ip; } #endif labrea-2.5-stable-1.orig/src/labrea.c0100644000550600055060000000541707730434533016436 0ustar tonontonon/* * LaBrea * * A program to create a tar pit for the connection attempts to a * block of ip addresses. LaBrea sits and listens for ARP "who-has" * requests. When an ARP request for a particular IP goes unanswered * for longer than it's "rate" setting (default: 3 seconds), LaBrea * crafts an ARP reply that routes all traffic destined for the IP to * a "bogus" MAC address. LaBrea then listens for TCP/IP traffic * routed to that MAC address and then responds to any SYN packet with * a SYN/ACK packet that it creates. * * LaBrea completely ignores any other input. This, forces the * "client" to wait for its TCP stack to time-out the connection. * Because stacks tend to be a bit tenacious about "established" * connections, this should bog down the scanner for quite a long * while. * * THIS PROGRAM REQUIRES BOTH LIBDNET and LIBPCAP in order to compile. * * Copyright (C) 2001, 2002 Tom Liston * * 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. * * $Id: labrea.c,v 1.3 2003/09/12 21:23:39 lorgor Exp $ */ #include "config.h" #ifdef HAVE_ERR_H #include #else #include "err.h" #endif #include "labrea.h" #include "ctl.h" #include "utils.h" #include "lbio.h" #include "pkt_handler.h" /* Definitions of main control structures */ io_t io; ctl_t ctl; outp_t outp; int main (int argc, char **argv) { labrea_init(argc, argv); /* Do initialisation */ if (!WIN32_FLG) util_detach(); /* Fork to become a daemon if unix*/ util_set_signal_handlers(); util_alarm(); /* Set an alarm to cause timer pop */ util_print(NORMAL,"Labrea started"); /* loop! */ for(;;) { if (pcap_dispatch(io.pcap, -1, &pkt_handler, (u_char *)&ctl) < 0) { util_print(NORMAL, "Error in pcap loop - EXITING: %s", pcap_geterr(io.pcap)); util_clean_exit(1); } /* Handle signal(s) if set */ if (ctl.signals) { if (ctl.signals & SIG_RESTART) util_restart(); if (ctl.signals & SIG_QUIT) util_quit(); #ifndef WIN32 if (ctl.signals & SIG_TIMER) util_timer(); if (ctl.signals & SIG_TOGGLE_LOGGING) util_toggle_logging(); #endif } } util_clean_exit(0); } labrea-2.5-stable-1.orig/src/labrea_init.c0100644000550600055060000005236407730434533017464 0ustar tonontonon/* * labrea_init.c * * This file is part of the LaBrea package * * Copyright (C) 2001, 2002 Tom Liston * * 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. * * $Id: labrea_init.c,v 1.2 2003/09/12 21:23:39 lorgor Exp $ */ #include "config.h" #include #include #include #ifdef HAVE_UNISTD_H #include #endif #include #include #ifdef HAVE_GETOPT_H #include #else #include "getopt.h" #endif #ifdef HAVE_ERR_H #include #else #include "err.h" #endif #include "labrea.h" #include "pcaputil.h" #include "ctl.h" #include "utils.h" #include "lbio.h" int input_error = FALSE; /* True if errors on input */ static void __inline Usage (void) { if (WIN32_FLG) /* Windows-specific options */ warnx("\n\n\nUsage: LaBrea \n" "Options:\n" "--winpcap-dev (-j) intfnum : libdnet interface to be used i.e. -j 3\n" "--list-interfaces (-D) : Lists available adapters / interfaces for -i/-j\n" "--syslog-server addr : IP address or hostname of remote syslog server\n" "--syslog-port : Remote syslog port" ); else /* Unix-specific options */ warnx("\n\n\nUsage: LaBrea \n" "Options:\n" "--device (-i) interface : Set a non-default interface\n" "--foreground (-d) : Do NOT detach process\n" ); /* General options */ warnx( "--bpf-file (-F) filename : Specify a BPF filter filename\n" "--network (-n) nnn.nnn.nnn.nnn[/mm] : User specified capture subnet\n" "--mask (-m) nnn.nnn.nnn.nnn : User specified capture subnet mask\n" "--throttle-size (-t) datasize : Connection throttling size (bytes)\n" "--arp-timeout (-r) rate : Arp timeout rate (seconds)\n" "--switch-safe (-s) : \"Safe\" operation in a switched environment\n" "--log-to-syslog (-l) : Log activity to syslog\n" "--verbose (-v) : Verbosely log activity\n" "--init-file filename : Specify alternative config file\n" "--hard-capture (-h) : \"Hard\" capture IPs\n" "--disable-capture (-x) : Disable IP capture\n" "--version (-V) : Print version information and exit\n" "--no-resp-synack (-a) : Do not respond to SYN/ACKs and PINGs\n" "--quiet (-q) : Do not report odd (out of netblock) ARPs\n" "--dry-run (-T) : Test mode - Prints out messages but DOES NOT RUN\n" "--soft-restart (-R) : Soft restart - Wait while recapturing active connects\n" "--max-rate (-p) maxrate : \"Persist\" state capture connect attempts up to Kb/sec\n" "--persist-mode-only (-P): Persist mode capture only\n" "--log-bandwidth (-b) : Log bandwidth usage to syslog\n" "--log-to-stdout (-o) : Output to stdout instead of syslog, implies -d\n" "--log-timestamp-epoch (-O) : Same as -o w/time output in seconds since epoch\n" "--exclude-resolvable-ips (-X) : Automatically exclude resolvable IPs from capture\n" "--auto-hard-capture (-H) : Automatically hard capture addresses not excluded\n" "--no-resp-excluded-ports (-f) : \"Firewall\" excluded ports\n" "--no-arp-sweep : Do not arp sweep subnet for occupied IPs\n" "--my-ip-addr (-I) ipaddr : IP address of this system\n" "--my-mac-addr (-E) macaddr : MAC address of this system\n" "--debug nnn : Debug output for debug levels nnn (requires compile option)\n" "--no-nag (-z) : Allow execution and bypass nag reminder\n" "--help --usage (-?) : This message\n" ); util_clean_exit(1); } /* * Concatenate string chunk to string texpr, taking care not to run * off the end of texpr */ static void build_bpf_filter(u_char *texpr, const u_char *chunk, const size_t siz) { u_char *p = texpr; int len = strlen(texpr); p += len; len = siz - len -1; if (strlcpy(p, chunk, len) >= len) { warnx("*** Truncation occurred - bpf filter too long"); input_error = TRUE; } } /* * used to clean up stuff in in the input files, this changes line feeds * and carriage returns to spaces * */ static void cleanup2 (char *p) { while(*p != '\0') { if ((*p == '\r') || (*p == '\n')) *p = ' '; p++; } } /* * input a number, checking for validity and watching for buffer overflow * */ static int read_number (u_char *p) { char buf[BUFSIZE]=""; char *invalid = NULL; int result = 0; strlcpy(buf, p, sizeof(buf)); /* Copy, watching for buffer overflow */ result = strtol(buf, &invalid, 10); /* Convert to integer, checking validity */ if ((strlen(invalid) > 0) || (result < 0)) { strlcpy(buf, invalid, sizeof(buf)); warnx("*** Invalid integer input: %s", buf); input_error = TRUE; } return(result); } void labrea_init (int argc, char **argv) { int usernet = FALSE; /* True if user-specified subnet for capturing */ int man_host_info = FALSE; /* True if user-specified host information */ char *texpr = NULL; /* Buffer for holding bpf filter */ char dev[BUFSIZE]=""; /* Input device name */ char pgm_name[PGM_NAME_SIZE]=""; /* Name of invoking pgm */ struct addr cap_net; /* For manual input of capture subnet */ struct addr cap_mask; /* For manual input of capture subnet mask */ struct addr myip_tmp={ADDR_TYPE_NONE}; /* For manual input of system IP address */ /* decl for reading input files */ char ffname[BUFSIZE] = ""; /* Input file name */ FILE *in = NULL; /* Input file descriptor */ char *rtn = NULL; /* Return ptr from fgets */ static char mybuffer[BUFSIZE] = ""; /* Buffer to hold input string */ int c = 0; /* Index for getopt */ /* decl for getopt_long */ int option_index = 0; /* Option index */ static struct option long_options[] = { {"network", required_argument, 0, 'n'}, {"mask", required_argument, 0, 'm'}, {"device", required_argument, 0, 'i'}, {"winpcap-dev", required_argument, 0, 'j'}, {"my-ip-addr", required_argument, 0, 'I'}, {"my-mac-addr", required_argument, 0, 'E'}, {"quiet", no_argument, 0, 'q'}, {"bpf-file", required_argument, 0, 'F'}, {"throttle-size", required_argument, 0, 't'}, {"arp-timeout", required_argument, 0, 'r'}, {"switch-safe", no_argument, 0, 's'}, {"exclude-resolvable-ips", no_argument, 0, 'X'}, {"disable-capture", no_argument, 0, 'x'}, {"hard-capture", no_argument, 0, 'h'}, {"soft-restart", no_argument, 0, 'R'}, {"auto-hard-capture", no_argument, 0, 'H'}, {"max-rate", required_argument, 0, 'p'}, {"log-bandwidth", no_argument, 0, 'b'}, {"persist-mode-only", no_argument, 0, 'P'}, {"no-resp-synack", no_argument, 0, 'a'}, {"no-resp-excluded-ports", no_argument, 0, 'f'}, {"log-to-syslog", no_argument, 0, 'l'}, {"verbose", no_argument, 0, 'v'}, {"log-to-stdout", no_argument, 0, 'o'}, {"log-timestamp-epoch", no_argument, 0, 'O'}, {"version", no_argument, 0, 'V'}, {"dry-run", no_argument, 0, 'T'}, {"foreground", no_argument, 0, 'd'}, {"no-nag", no_argument, 0, 'z'}, {"usage", no_argument, 0, '?'}, {"help", no_argument, 0, '?'}, {"init-file", required_argument, 0, '2'}, {"no-arp-sweep", no_argument, 0, '3'}, {"syslog-server", required_argument, 0, '4'}, {"syslog-port", required_argument, 0, '5'}, #ifdef DEBUG_LB {"debug", required_argument, 0, '6'}, #endif {"list-interfaces", no_argument, 0, 'D'}, {0, 0, 0, 0} }; static char rcsid[] = PACKAGE_STRING " " PACKAGE_BUGREPORT; static char bpf[] = "arp or (ip and ether dst host 00:00:0F:FF:FF:FF)"; char bigstring2[] = "You MUST read the INSTALL file! Don't try to run this\n" "program without understanding how it works and what it can do!\n" "In the INSTALL file, you'll find the command line switch\n" "necessary to allow LaBrea to run."; /* Allocate / initialize main ctl structures and set defaults */ memset(&ctl, 0, sizeof(ctl)); /* Initialize ctl and io structures */ memset(&io, 0, sizeof(io)); strlcpy(pgm_name, argv[0], sizeof(pgm_name)); /* Get name of pgm for log msgs */ util_init(); io.mymac = NULL; ctl.throttlesize = THROTTLE_WINDOW_ORD; /* Default window size = 10 */ ctl.rate = ARP_TIMEOUT; /* Default arp timeout rate = 3 sec */ ctl.logging |= FL_LOG_ODD_ARPS; ctl.capture |= FL_CAPTURE; strlcpy(ctl.cfg_file_name, LABREA_CONF, sizeof(ctl.cfg_file_name)); if ((texpr = calloc(BPFSIZE ,sizeof(* texpr))) == NULL) { warnx( "*** calloc error: texpr - unable to allocate memory" ); util_clean_exit(1); } addr_pack(&cap_net, ADDR_TYPE_NONE, 0, IP_ADDR_ZEROS,IP_ADDR_LEN); addr_pack(&cap_mask, ADDR_TYPE_NONE, 0, IP_ADDR_ZEROS,IP_ADDR_LEN); /* * Windows-only defaults */ if (WIN32_FLG) { ctl.syslog_port = 514; /* Windows-only: default syslog port */ outp.output |= FL_OUTP_STDOUT; /* Log to stdout */ } /* parse the command line */ while(TRUE){ c = getopt_long(argc, argv, "n:m:i:j:I:E:qF:t:r:sXxhRHp:bPaflvoOVTdz?2:3D", long_options, &option_index); if (c == EOF) /* If at end of options, then stop */ break; DEBUG_PRT(DEBUG_INIT, "labrea_init: option: %d", c); switch(c) { case 'X': ctl.feature |= FL_EXCL_RESOLV_IPS; break; case 'O': outp.output |= (FL_OUTP_STDOUT_EPOCH | FL_OUTP_STDOUT); ctl.mode |= FL_DONT_DETACH; break; case 'T': ctl.mode |= FL_TESTMODE; outp.verbose = VERY_VERBOSE; outp.output |= FL_OUTP_STDOUT; ctl.mode |= FL_DONT_DETACH; break; case 'R': ctl.soft_restart = SOFT_RESTART; assert( (HIST_MIN+1) >= SOFT_RESTART); /* If not will overflow past[] array */ break; case 'o': outp.output |= FL_OUTP_STDOUT; ctl.mode |= FL_DONT_DETACH; break; case 'd': ctl.mode |= FL_DONT_DETACH; break; case 'x': ctl.capture &= ~(FL_CAPTURE); /* Turn off capture */ break; case 'b': ctl.logging |= FL_LOG_BDWTH_SYSLOG; break; case 'v': outp.verbose += 1; break; case 'z': ctl.mode |= FL_DONT_NAG; break; case 's': ctl.feature |= FL_SAFE_SWITCH; break; case 'q': ctl.logging &= ~(FL_LOG_ODD_ARPS); break; case 'a': ctl.feature |= FL_NO_RESP; break; case 'l': outp.output &= ~FL_OUTP_STDOUT; break; case 'n': if ((addr_aton(optarg, &cap_net) < 0)) { warnx("*** Subnet to be captured must be specified as xxx.xxx.xxx.xxx[/nn]"); input_error = TRUE; } else usernet = TRUE; break; case 'm': if ((addr_aton(optarg, &cap_mask) < 0)) { warnx("*** Subnet mask should be specified as xxx.xxx.xxx.xxx"); input_error = TRUE; } else usernet = TRUE; break; case 'F': strlcpy(ffname, optarg, sizeof(ffname)); break; case 'f': ctl.feature |= FL_NO_RST_EXCL_PORT; break; case 'i': strlcpy(dev, optarg, sizeof(dev)); /* lbio_init will do further checking */ break; case 'j': if (WIN32_FLG) { io.intf_num = read_number(optarg); if (io.intf_num <=0 || io.intf_num > MAX_NUM_ADAPTER) { warnx("*** Winpcap device specified %d is invalid", io.intf_num); input_error = TRUE; } } else { warnx( "*** Option -j not supported on unix."); input_error = TRUE; } break; case 'D': if (WIN32_FLG) { lbio_print_pcap_adapter_list(); lbio_print_libdnet_intf_list(); util_clean_exit(0); } else { warnx( "*** Option -D not supported on unix."); input_error = TRUE; } break; case 'E': if ((io.mymac = calloc(1, sizeof(struct addr))) == NULL) { warnx( "*** calloc error: io.mymac - unable to allocate memory" ); util_clean_exit(1); } if ((addr_aton(optarg, io.mymac) < 0) || (io.mymac->addr_type != ADDR_TYPE_ETH)) { warnx("*** MAC addr should be specified as xx:xx:xx:xx:xx:xx"); input_error = TRUE; } else man_host_info = TRUE; break; case 'I': if ((addr_aton(optarg, &myip_tmp) < 0) || (myip_tmp.addr_type != ADDR_TYPE_IP)) { warnx("*** IP addr should be specified as nn.nn.nn.nn"); input_error = TRUE; } else { io.myip = ntohl(myip_tmp.addr_ip); man_host_info = TRUE; } break; case 't': ctl.throttlesize = read_number(optarg); break; case 'r': ctl.rate = read_number(optarg); break; case 'h': ctl.capture |= FL_HARD_CAPTURE; break; case 'H': ctl.capture |= (FL_HARD_CAPTURE | FL_AUTO_HARD_CAPTURE); break; case '?': Usage(); break; case 'P': ctl.capture |= FL_PERSIST_MODE_ONLY; break; case 'p': ctl.maxbw = read_number(optarg); break; case 'V': puts(rcsid); util_clean_exit(0); case '2': strlcpy(ctl.cfg_file_name, optarg, sizeof(ctl.cfg_file_name)); break; case '3': ctl.mode |= FL_NO_ARP_SWEEP; break; case '4': if (WIN32_FLG) { strlcpy(ctl.syslog_server, optarg, MAXHOSTNAMELEN); } else { warnx("*** option --syslog-server is not supported on unix"); input_error = TRUE; } break; case '5': if (WIN32_FLG) { ctl.syslog_port = read_number(optarg); if ((ctl.syslog_port < 0) || (ctl.syslog_port > PORT_NUM)) { warnx("*** Remote syslog port %d is invalid", ctl.syslog_port); input_error = TRUE; } } else { warnx("*** option --syslog-port is not supported on unix"); input_error = TRUE; } break; case '6': ctl.debuglevel = read_number(optarg); break; default: Usage(); break; } } if (ctl.maxbw > 0) { ctl.maxbw = ctl.maxbw >> 3; /* Convert Kbits to Kbytes */ if (ctl.maxbw > MAX_BW) { ctl.maxbw = MAX_BW; /* Max 1 GByte to avoid integer overflows */ } ctl.throttlesize = THROTTLE_WINDOW_SLOW; ctl.newthisminute = ctl.maxbw * ONE_K; /* Convert Kbytes to bytes */ } if (!WIN32_FLG) { /* line buffer the output */ if (outp.output & FL_OUTP_STDOUT) setlinebuf(stdout); } if (USEZFLAG) { if (!(ctl.mode & FL_DONT_NAG)) { if (ctl.mode & FL_TESTMODE) warnx("*** You're missing the \"-z\" flag. See the docs."); else { warnx( bigstring2 ); } input_error = TRUE; } } if (man_host_info && ((io.myip == 0) || (io.mymac == NULL))) { warnx("*** Both the system IP addr and MAC addr must be specified (-I -E)\n" " In addition, the capture subnet must also be specified (-n)"); input_error = TRUE; } /* calculate subnet and netmask values from the user-specified values, if any */ if (usernet) { /* If mask specified with -m parameter, then use it */ if (cap_mask.addr_type != ADDR_TYPE_NONE) addr_mtob(&(cap_mask.addr_ip), IP_ADDR_LEN, &(cap_net.addr_bits)); } if (usernet || man_host_info) { if ((cap_net.addr_bits == 0) || (cap_net.addr_bits == IP_ADDR_BITS) || (cap_net.addr_ip == 0)) { warnx("*** Both the capture subnet address and subnet mask must be specified.\n" "Consider using the -n parameter with CIDR notation (ie xx.xx.xx.xx/nn)."); input_error = TRUE; } util_print(VERBOSE, "User specified capture subnet / mask: %s", addr_ntoa(&cap_net)); addr_btom(cap_net.addr_bits, &io.mask, IP_ADDR_LEN); io.mask = ntohl(io.mask); io.net = ntohl(cap_net.addr_ip); io.net &= io.mask; } /* create our bpf filter */ if (ctl.capture & FL_CAPTURE) { build_bpf_filter(texpr, bpf, BPFSIZE); util_print(VERBOSE, "LaBrea will attempt to capture unused IPs."); /* tack any additional stuff onto our BPF filter */ if (optind < argc) { if (strlen(ffname) > 0) { warnx("*** Command line filter and filter file specified - Ambiguous!"); input_error = TRUE; } build_bpf_filter(texpr, " or (", BPFSIZE); for(c = optind; c < argc; c++) build_bpf_filter(texpr, argv[c], BPFSIZE); /* tack on another argument */ build_bpf_filter(texpr, ")", BPFSIZE); } else { /* handle filter file */ if (strlen(ffname) > 0) { if ((in = fopen(ffname, "r")) == NULL) { warnx( "*** Unable to open filter file %s", ffname ); input_error = TRUE; } else { build_bpf_filter(texpr, " or (", BPFSIZE); while ((rtn = fgets(mybuffer, sizeof(mybuffer), in)) != NULL) { if (*mybuffer != '#') { cleanup2(mybuffer); build_bpf_filter(texpr, mybuffer, BPFSIZE); } fclose(in); build_bpf_filter(texpr, ")", BPFSIZE); } } } } } else { util_print(VERBOSE, "LaBrea will NOT attempt to capture unused IPs."); /* * Turn off Arp sweep as well since makes no sense unless are capturing IPs. */ ctl.mode |= FL_NO_ARP_SWEEP; } util_print(VERBOSE, "Full internal BPF filter: %s", texpr); /* * Windows-specific checks */ if (WIN32_FLG) { if (io.intf_num > 0) util_print(VERBOSE, "Winpcap device %d will be used", io.intf_num); if (strlen(ctl.syslog_server) > 0) { util_print(VERBOSE, "Syslog will be sent to %s, port %d", ctl.syslog_server, ctl.syslog_port); } else { if (!(outp.output & FL_OUTP_STDOUT)) { if (!util_check_version_winNT()) { warnx("*** Syslog output to Windows event file requires WinNT or better"); input_error = TRUE; } } } } if (!(ctl.logging & FL_LOG_ODD_ARPS)) util_print(VERBOSE, "LaBrea will NOT warn when it sees ARPs from outside the netblock"); util_print(VERBOSE, "LaBrea will log to %s", (outp.output & FL_OUTP_STDOUT)? "stdout" : "syslog"); if (outp.verbose == VERBOSE) util_print(VERBOSE, "Logging will be verbose."); else util_print(VERY_VERBOSE, "Logging will be very verbose."); if (ctl.capture & FL_HARD_CAPTURE) util_print(VERBOSE, "IPs will be \"hard captured\"."); if (ctl.feature & FL_SAFE_SWITCH) util_print(VERBOSE, "LaBrea will attempt to operate safely in a switched environment"); if (ctl.feature & FL_NO_RESP) util_print(VERBOSE, "SYN/ACKs or PINGS will not be answered."); if (ctl.feature & FL_NO_RST_EXCL_PORT) util_print(VERBOSE, "Ports will be firewalled. No RST will be returned for excluded ports."); if (ctl.maxbw > 0) { util_print(VERBOSE, "Connections will be captured in persist state up to %u Kb/sec", ctl.maxbw << 3); if (ctl.logging & FL_LOG_BDWTH_SYSLOG) util_print(VERBOSE, "Bandwidth use will be logged every minute."); } else { if (ctl.logging & FL_LOG_BDWTH_SYSLOG) { warnx("*** The --max-rate (-p) option must be specified if bandwidth is to be logged."); input_error = TRUE; } } if (ctl.capture & FL_HARD_CAPTURE) util_print(VERBOSE, "Non-excluded addresses will be automatically marked as being hard captured"); if (ctl.soft_restart > 0) util_print(VERBOSE, "A soft restart will be attempted during %i minutes.", ctl.soft_restart); if (ctl.capture & FL_PERSIST_MODE_ONLY) { if (ctl.maxbw == 0) { warnx("(*** If --persist-mode-only (-P) is specified," "then --max-rate (-p) must also be specified."); input_error = TRUE; } else { util_print(VERBOSE, "ONLY Persist mode capture will be done."); } } if (input_error) { warnx("*** Errors in input - exiting."); } /* Initialize IO */ lbio_init(dev, texpr); /* Now we know how many IP addresses are in the subnet */ if (ctl.addresses >= MAX_SUBNET_SIZE) { warnx("*** The Capture subnet is large. labrea works better if the capture subnet size\n" "is limited to the actual physical segment size (hub or switch vlan).\n" "Consider using -n or -m parameters."); ctl.mode |= FL_NO_ARP_SWEEP; /* Too big to do arp sweeping */ } if (ctl.mode & FL_NO_ARP_SWEEP) util_print(VERBOSE, "An arp sweep for occupied IP addresses will not be performed."); /* Initialize main ctl structures */ if (ctl_init() < 0) { input_error = TRUE; } util_print(VERBOSE, "Network number: %s", lbio_ntoa(io.net)); util_print(VERBOSE, "Netmask: %s", lbio_ntoa(io.mask)); util_print(VERBOSE, "Number of addresses LaBrea will watch for ARPs: %u", ctl.addresses); util_print(VERBOSE, "Range: %s - %s", lbio_ntoa(ctl.base), lbio_ntoa(ctl.topend)); util_print(VERBOSE, "Throttle size set to WIN %i", ctl.throttlesize); util_print(VERBOSE, "Rate (-r) set to %i", ctl.rate); if (ctl.mode & FL_TESTMODE) { util_print(NORMAL, "Test mode run complete... LaBrea is exiting."); util_clean_exit(0); } else { if (input_error) { warnx("*** Errors in initialization ... exiting"); util_clean_exit(0); } } if (!(outp.output & FL_OUTP_STDOUT)) util_open_syslog(pgm_name); /* Open up syslog */ return; } labrea-2.5-stable-1.orig/src/pkt_handler.c0100644000550600055060000005610507730434533017503 0ustar tonontonon/* * pkt_handler.c * This file is part of the LaBrea package * * Copyright (C) 2001, 2002 Tom Liston * * 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. * * $Id: pkt_handler.c,v 1.2 2003/09/12 21:23:39 lorgor Exp $ */ #include "config.h" #include #ifdef HAVE_TIME_H #include #endif #include #include #ifdef HAVE_ERR_H #include #else #include "err.h" #endif #include "labrea.h" #include "pkt.h" #include "bget.h" #include "ctl.h" #include "lbio.h" #include "utils.h" #include "pkt_handler.h" /* * Check if (IP) addr a is in (IP) subnet b */ static int addr_in_subnet(const ip_addr_t a, const struct addr *b) { struct addr atmp; if (b->addr_type != ADDR_TYPE_IP) return(FALSE); addr_pack(&atmp, ADDR_TYPE_IP, b->addr_bits, &a, IP_ADDR_LEN); return( (addr_cmp(&atmp, b) == 0) ); } /* * Have an established TCP session. Throttle down the data flow as * much as possible. * pkt incoming TCP pkt * new our response pkt * dport destination port of incoming TCP pkt * sport source port of incoming TCP pkt * ack incoming ack # * seq incoming seq # * offset -> offset in capture subnet for tgt IP addr * */ static void throttle_data(struct pkt *pkt, const uint16_t dport, const uint16_t sport, const uint32_t ack, const uint32_t seq, const ip_addr_t offset) { char *msgptr = NULL; uint32_t ack_out; struct pkt *new = NULL; int i = 0; int boolLinuxWinProbe = 0; /* True if have received a Linux-style windows probe pkt */ int headersize = 0; /* Size of packet header */ uint16_t tlength; /* Total length of pkt */ /* Handle a TCP data packet by attempting to throttle down the data flow */ DEBUG_PRT(DEBUG_PKTPROC, "throttle_data: dport %d, sport %d, offset %d, ack %x, seq %x", dport, sport, offset, ack, seq); /* If persist mode capture only */ if (ctl.maxbw > 0) { tlength = ntohs(pkt->pkt_ip->ip_len);/* Total length of pkt */ headersize = IP_HDR_LEN + (pkt->pkt_tcp->th_off << 2); /* TCP + IP hdr size */ DEBUG_PRT(DEBUG_PKTPROC, "throttle_data: persist mode ctl.maxbw %d, tlength %d, headersize %d, " "newthismin %d", ctl.maxbw, tlength, headersize, ctl.newthisminute); /* * The 1st data packet. * * They're sending a packet that is a header plus our throttle * size... */ if (tlength == (headersize + ctl.throttlesize)) { /* * If we've already added all of the connections that we can * during this minute, then ignore this packet. This should allow * us to ease up toward maximum bw... even when we're being * hammered by inbound connects. */ if (ctl.newthisminute <= 0) return; /* lower b/w due to possible new connects ... */ ctl.newthisminute -= (tlength + ETH_HDR_LEN); if ((new = pkt_new()) == NULL) return; new->pkt_end = new->pkt_data + ETH_HDR_LEN + IP_HDR_LEN + TCP_HDR_LEN; /* Add base tcp hdr without options */ tcp_pack_hdr( new->pkt_tcp, dport, /* orig dst port becomes src port */ sport, ack, /* seq # is incoming ack # (ie unchanged) */ seq + ctl.throttlesize, /* ack # is incoming seq # + throttlesize */ (TH_ACK), /* ACK packet */ 0, /* throttle down window to 0 ==> persist */ 0 ); /* urg */ lbio_send_ip_pkt(new, pkt, IP_HDR_LEN + TCP_HDR_LEN, "Persist Trapping"); ctl.currentbytes += (tlength + ETH_HDR_LEN); return; } else { /* * Check for oddball Linux winprobe * * Decode the ack and see if it matches the inbound sequence * number... if it does, then it's a win probe */ ack_out = ack; ack_out ^= ntohl(pkt->pkt_ip->ip_src); ack_out ^= ((sport << 16) + dport); for(i = 0; i < RANDSIZE2; i++) { if ((ack_out ^ ctl.randqueue2[i]) == seq) boolLinuxWinProbe = 1; } DEBUG_PRT(DEBUG_PKTPROC, "throttle_data: check Linux winprobe ack_out %x, Linuxprobe %d", ack_out, boolLinuxWinProbe); if ((tlength == (headersize + 1)) || boolLinuxWinProbe) { /* * we'll send back syn = inbound ack and ack = inbound syn... */ msgptr = (boolLinuxWinProbe) ? "Linux Persist Activity" : "Persist Activity"; if ((new = pkt_new()) == NULL) return; new->pkt_end = new->pkt_data + ETH_HDR_LEN + IP_HDR_LEN + TCP_HDR_LEN; /* Add base tcp hdr without options */ tcp_pack_hdr( new->pkt_tcp, dport, /* orig dst port becomes src port */ sport, ack, /* seq # is inbound ack */ seq, /* ack # is inbound seq */ (TH_ACK), 0, /* windowsize = 0 - they keep waiting */ 0 ); /* urg */ lbio_send_ip_pkt(new, pkt, IP_HDR_LEN + TCP_HDR_LEN, msgptr); ctl.currentbytes += (tlength + ETH_HDR_LEN); return; } else { /* * we ignore everything else, but (optionally) log the fact * that we saw activity... */ util_print(VERBOSE, "Additional Activity %s", lbio_ntoa(ctl.base+offset)); return; } } } } /* * Check if IP is on the "IP ignore" list. If so then just ignore this * packet. Check if the IP is on the "New kids" list (ie a machine * that recently announced itself via a gratuitous ARP). If so, then * just forward the packet on to the existing machine. * * pkt -> incoming pkt to be examined * * Returns TRUE if pkt is found on one of the lists (and should be ignored). * */ static int check_ip_ignore_or_new_kid( struct pkt *pkt, ip_addr_t offset) { nk_t *nk; struct ipig *ipig; time_t current = 0; /* * * First, run the list of source IPs that we are supposed to * ignore... * * If we find the IP on the list, then just return without * doing anything... * */ SLIST_FOREACH(ipig, &ctl.ipig_q, ipig_next){ if (addr_in_subnet(pkt->pkt_ip->ip_src, &(ipig->ipig_addr))) { DEBUG_PRT(DEBUG_PKTPROC, "check_ip_ignore_or_new_kid: ignore ip %d", offset); return(TRUE); } } /* Next see if this IP is a "new kid" (ie, already belongs to someone) */ if ((nk = ctl.nk_array[offset]) != NULL) { if (addr_cmp(&(nk->nk_mac), io.bogus_mac) != 0) { /* * The incoming IP is already owned by someone. * * This is a real machine, so just forward the pkt on by * stuffing in the "correct" MAC * */ memmove(&(pkt->pkt_eth->eth_dst), &(nk->nk_mac.addr_eth), ETH_ADDR_LEN); lbio_send_pkt(pkt); /* reset the cull time, because obviously SOMEONE ain't got a clue */ nk->nk_time = current + CULLTIME; util_print(VERY_VERBOSE,"Packet forwarded to owner of IP %s (MAC: %s)", lbio_ntoa(ctl.base + offset), addr_ntoa(&(nk->nk_mac))); } return(TRUE); } return(FALSE); } /* * Handle incoming IP pkt: TCP and ICMP ping * * pkt -> incoming pkt. * */ static void ip_handler (struct pkt *pkt) { ip_addr_t offset = 0; /* Deplacement into array of captured IP addresses */ uint32_t ack_out; /* Computed ack # */ struct pkt *new = NULL; static uint16_t currentrand2 = 0; /* Index into array of random #'s used for detecting window probes */ uint16_t dport = 0; /* Destination port */ uint16_t sport = 0; /* Source port */ uint32_t ack = 0; /* Incoming ack # */ uint32_t seq = 0; /* Incoming seq # */ DEBUG_PRT(DEBUG_PKTPROC, "ip_handler: start"); /* Calculate offset in subnet to be captured */ if( lbio_ip_offset(pkt->pkt_ip->ip_dst, &offset) < 0) return; /* Check to see that this isn't an excluded address... */ if (ctl.exclusion[offset] == IP_EXCLUDE) return; if (check_ip_ignore_or_new_kid(pkt, offset)) return; DEBUG_PRT(DEBUG_PKTPROC, "ip_handler: process ip packet - offset %d", offset); /* switch on the protocol */ switch(pkt->pkt_ip->ip_p) { case IPPROTO_TCP: if (pkt->pkt_tcp == NULL) /* Ignore malformed pkts */ return; sport = ntohs(pkt->pkt_tcp->th_sport); /* incoming Tcp source port */ dport = ntohs(pkt->pkt_tcp->th_dport); /* incoming Tcp dest port */ ack = ntohl(pkt->pkt_tcp->th_ack); /* incoming ack # */ seq = ntohl(pkt->pkt_tcp->th_seq); DEBUG_PRT(DEBUG_PKTPROC, "ip_handler: tcp pkt sport: %d, dport: %d, ack: %x, seq: %x", sport, dport, ack, seq); /* ************************************************* * Special code to handle funky Linux win probes ************************************************* * * We're going to "encode" the remote sequence number that we * should be seeing on the first inbound window probe - we use this * encoded value as *our* sequence number... * * when we get an inbound packet that could be a win probe we'll * "decode" the ack... if it matches the sequence number, then it's * a win probe... * * This is one of those cool hacks that no one else is ever going * to understand. Oh Well... * */ ack_out = seq + ctl.throttlesize; ack_out ^= ctl.randqueue2[currentrand2]; ack_out ^= ((sport << 16) + dport); ack_out ^= (ntohl(pkt->pkt_ip->ip_src)); ack_out--; currentrand2++; if (currentrand2 == RANDSIZE2) currentrand2 = 0; /* * Now, we want to check our list of port numbers that we're * supposed to ignore... if we find it on the list, then return * without doing anything... * */ if (ctl.port_array[dport] == PORT_IGNORE) { if (!(ctl.feature & FL_NO_RST_EXCL_PORT)) { if ((new = pkt_new()) == NULL) return; new->pkt_end = new->pkt_data + ETH_HDR_LEN + IP_HDR_LEN + TCP_HDR_LEN; /* Add base tcp hdr without options */ DEBUG_PRT(DEBUG_PKTPROC, "ip_handler: send RST sport %d dport %d ack %x seq %x", dport, sport, ack_out, seq+1); tcp_pack_hdr( new->pkt_tcp, dport, /* orig dst port becomes src port */ sport, ack_out, /* seq # = our coded number */ seq+1, /* ack # = (orig seq # + 1) */ (TH_RST | TH_ACK), /* send a Reset */ ctl.throttlesize, 0 ); /* urg */ lbio_send_ip_pkt(new, pkt, IP_HDR_LEN + TCP_HDR_LEN, NULL); } return; } /* * If firewalling ports, then don't give a response unless this * port has seen sufficient activity. This will slow down nmap * scans. But still record that a SYN came in. */ if (ctl.feature & FL_NO_RST_EXCL_PORT) { if ((ctl.port_array[dport] < PORT_MAX) && (pkt->pkt_tcp->th_flags) & TH_SYN) ctl.port_array[dport]++; if (ctl.port_array[dport] <= PORT_NOISE) { DEBUG_PRT(DEBUG_PKTPROC, "ip_handler: SYN so bump cnt port %d = %d but ignore for now", dport, ctl.port_array[dport]); return; } } /* Switch on type of incoming TCP packet */ switch((pkt->pkt_tcp->th_flags) & (TH_SYN | TH_ACK)) { case (TH_SYN): /* * SYN ==> reply SYN/ACK * * If we're persist only, and at bandwidth limit then return */ DEBUG_PRT(DEBUG_PKTPROC, "ip_handler: receive SYN"); if ((ctl.capture & FL_PERSIST_MODE_ONLY) && (ctl.newthisminute <= 0)) return; if ((new = pkt_new()) == NULL) return; new->pkt_end = new->pkt_data + ETH_HDR_LEN + IP_HDR_LEN + TCP_HDR_LEN; /* Add base tcp hdr without options */ DEBUG_PRT(DEBUG_PKTPROC, "ip_handler: send SYN-ACK sport %d, dport %d, ack %x, seq %x, win %d", dport, sport, ack_out, seq+1, ctl.throttlesize); tcp_pack_hdr( new->pkt_tcp, dport, /* orig dst port becomes src port */ sport, ack_out, /* seq # is our random # */ seq+1, /* ack # = (inbnd seq + 1) */ (TH_SYN | TH_ACK), /* Send a SYN/ACK */ ctl.throttlesize, 0 ); /* urg */ lbio_send_ip_pkt(new, pkt, IP_HDR_LEN + TCP_HDR_LEN, "Initial Connect - tarpitting"); return; /* break; */ case (TH_SYN | TH_ACK): /* * SYN/ACK ==> reply RST */ DEBUG_PRT(DEBUG_PKTPROC, "ip_handler: receive SYN-ACK"); if (ctl.feature & FL_NO_RESP) return; if ((new = pkt_new()) == NULL) return; new->pkt_end = new->pkt_data + ETH_HDR_LEN + IP_HDR_LEN + TCP_HDR_LEN; /* Add base tcp hdr without options */ DEBUG_PRT(DEBUG_PKTPROC, "ip_handler: send ACK sport %d, dport %d, ack %x, seq %x, win %d", dport, sport, ack_out, seq+1, ctl.throttlesize); tcp_pack_hdr( new->pkt_tcp, dport, /* orig dst port becomes src port */ sport, ack_out, /* seq # is our random # */ seq+1, /* ack # = (inbnd seq + 1) */ TH_RST, /* Send a RST */ ctl.throttlesize, 0 ); /* urg */ lbio_send_ip_pkt(new, pkt, IP_HDR_LEN + TCP_HDR_LEN, "Inbound SYN/ACK"); return; /* break */ case (TH_ACK): /* * Ack packet */ DEBUG_PRT(DEBUG_PKTPROC, "ip_handler: receive ACK"); throttle_data(pkt, dport, sport, ack, seq, offset); } /* end switch tcp */ break; case IPPROTO_ICMP: /* * Respond to an incoming ping */ DEBUG_PRT(DEBUG_PKTPROC, "ip_handler: receive Icmp pkt"); if (pkt->pkt_icmp == NULL) /* Ignore malformed pkts */ return; if (!(ctl.feature & FL_NO_RESP) && (pkt->pkt_icmp->icmp_type == ICMP_ECHO) && (pkt->pkt_icmp->icmp_code == ICMP_CODE_NONE)) { /* Allocate the new outbound pkt */ if ((new = pkt_dup(pkt)) == NULL) return; new->pkt_icmp->icmp_type = ICMP_ECHOREPLY; /* Change to a reply */ lbio_send_ip_pkt(new, pkt, ntohs(new->pkt_ip->ip_len), "Responded to a Ping"); } return; /* break */ default: break; } /* end switch ip */ return; } /* * NEW KIDS ON THE BLOCK * * If we see a gratuitous arp, or if someone else replies to an ARP * request indicating that an IP address belongs to them (and not * us!), then we want to attempt to gracefully step out of the way * even if we've "hard" captured this IP. * * We're going to make a list of anyone who pops up new, using an arp * to announce their presence. We hang onto this information for some * time, and then route anything that comes through to the correct * place. Hopefully this will help keep us from really screwing * things up... */ static void handle_new_kid_ARP (const ip_addr_t offset, ip_addr_t tpa, const uint8_t *mac) { time_t current = time(NULL); nk_t *nk; /* Ptr to "new kid" element */ struct addr adr_tmp; DEBUG_PRT(DEBUG_PKTPROC, "handle_new_kid_ARP: offset %d, tgt ip %s", offset, ip_ntoa(&tpa)); /* Check if this arp is from a bogus virtual machine (ie from us) */ addr_pack(&adr_tmp, ADDR_TYPE_ETH, ETH_ADDR_BITS, mac, ETH_ADDR_LEN); if (addr_cmp(&adr_tmp, io.bogus_mac) == 0) return; /* reset our arrays */ ctl.time_array[offset] = 0; ctl.addr_array[offset] = 0; /* * A new kid on the block... check if this IP is marked as belonging * to someone else */ if ((nk = ctl.nk_array[offset]) != NULL) { /* * If there is already a bogus nk entry (i.e. to force an arp sweep), then * free it. */ if (addr_cmp(&(nk->nk_mac), io.bogus_mac) == 0) util_nk_free(offset); else { /* * Otherwise are already tracking this IP so simply bump the * expiry time... */ nk->nk_time = current + CULLTIME; DEBUG_PRT(DEBUG_PKTPROC, "handle_new_kid_ARP: already tracking IP, bump expiry time"); return; } } /* * The IP/MAC is a new one, so allocate a new element and mark * this IP as belonging to the MAC */ util_nk_new(offset, current + CULLTIME, mac); DEBUG_PRT(DEBUG_PKTPROC, "handle_new_kid_ARP: mark IP as belonging to Mac"); return; } /* * Handle incoming ARP WHO HAS. * * pkt -> incoming ARP packet * */ static void handle_ARP_req (pkt_t *pkt) { nk_t *nk; ip_addr_t spa, tpa; /* Arp source / tgt protocol addr */ ip_addr_t offset = 0; /* Deplacement into array of captured IP addresses */ time_t addrtime=0, current=time(NULL); /* calculate our offset from "base" of available local IPs */ #ifdef LB_SYSTEM_IS_SUN memmove(&spa, &(pkt->pkt_arp_data->ar_spa), sizeof(ip_addr_t)); memmove(&tpa, &(pkt->pkt_arp_data->ar_tpa), sizeof(ip_addr_t)); #else spa = *( (ip_addr_t *)(pkt->pkt_arp_data->ar_spa)); /* is in netwk byte order */ tpa = *( (ip_addr_t *)(pkt->pkt_arp_data->ar_tpa)); #endif DEBUG_PRT(DEBUG_PKTPROC, "handle_ARP_req: spa %s, tpa %s", ip_ntoa(&spa), ip_ntoa(&tpa)); if( lbio_ip_offset(tpa, &offset) < 0) { /* * This is a goofy IP address - don't touch it, and (if we're * supposed to) tell someone that we saw it * */ if (ctl.logging & FL_LOG_ODD_ARPS) util_print(NORMAL, "IP address not in netblock - ARP WHO-HAS %s TELL %s", ip_ntoa( &tpa ), ip_ntoa( &spa )); return; } spa = ntohl(spa); /* now convert to host byte order */ tpa = ntohl(tpa); /* ignore our own arps */ if (io.myip == spa) return; /* handle excluded IPs */ if (ctl.exclusion[offset] == IP_EXCLUDE) return; DEBUG_PRT(DEBUG_PKTPROC, "handle_ARP_req: Check for gratuitous Arp"); /* * Gratuitous ARP * * Added spa = 0 for the Macs... they do a wacky gratuitous arp: * * arp who-has 192.168.0.1 tell 0.0.0.0 - Why... why... WHY??? * */ if ((spa == tpa) || (spa == 0)) { handle_new_kid_ARP(offset, tpa, pkt->pkt_arp_data->ar_sha); return; /* We're done */ } /* * If we get here, we know the following: * * the IP isn't excluded... * this isn't a gratuitous arp... * this isn't a wacky IP... * this isn't one of our own arps... * so... * * If we've already hard captured it, it's ours... * * Otherwise, check to see if we should capture this IP address... */ DEBUG_PRT(DEBUG_PKTPROC, "handle_ARP_req: Check if should capture IP" "- offset %d, ctl.addr_array %x, ctl.exclusion %d, ctl.time_array %x", offset, ctl.addr_array[offset], ctl.exclusion[offset], ctl.time_array[offset]); if (ctl.exclusion[offset] != IP_HARD_CAPTURED) { /* pull the stored time out of the array */ addrtime = ctl.time_array[offset]; /* * If this arp request came from someone new, or if it's been more * than MAXARPTIME, start over */ if ((ctl.addr_array[offset] != spa) || ((addrtime + MAXARPTIME) <= current)) addrtime = 0; /* * If the stored time is 0, we're starting fresh... * * Store the current time so we know when the arp hit. * * This will happen on the first arp, when we timeout, * or when we get another arp request for the same IP * but from a different source... */ if (addrtime == 0) { /* store current time and arp source */ ctl.time_array[offset] = current; ctl.addr_array[offset] = spa; if (ctl.feature & FL_SAFE_SWITCH) lbio_send_ARP_Who_Has(tpa); /* send our own ARP if on a switch */ return; } else { /* there is a time stored, but if we haven't timed out ... */ if ((addrtime + ctl.rate) > current) { if (ctl.feature & FL_SAFE_SWITCH) /* and are on a switch */ lbio_send_ARP_Who_Has(tpa); /* then send our own ARP */ return; } } } /* * If we're here, we've timed out, or we've hard captured this IP * already... * * In either case, we need to send out an arp reply, to route any * traffic to this IP address to our bogus ARP address... creating a * virtual machine... * If we're hard capturing, and this address isn't hard excluded, we want to * hard capture it... */ if ((ctl.capture & FL_HARD_CAPTURE) && (ctl.exclusion[offset] != IP_HARD_EXCLUDE)) { DEBUG_PRT(DEBUG_PKTPROC, "handle_ARP_req: Mark offset %d hard captured", offset); ctl.exclusion[offset] = IP_HARD_CAPTURED; } /* * Check if this IP is on our "new kids" list.. if it is, remove * it... Why? * * Well, since we're here, whatever sent out the gratuitous arp that * got this IP listed as a "new kid" isn't answering arp requests... * * So we'll re-take the IP and kick if off the "new kids" * list. Whatever wanted this IP, didn't want it very bad... or * else, has left the scene... */ if ((nk = ctl.nk_array[offset]) != NULL) util_nk_free(offset); /* back to zero to start over...*/ ctl.time_array[offset] = 0; ctl.addr_array[offset] = 0; lbio_send_bogus_ARP(tpa, pkt); /* Send the bogus ARP to capture the IP addr */ return; } /* * Main packet Handler rtn called by pcap rtn */ void pkt_handler (u_char* client_data, const struct pcap_pkthdr* pcpkt, const u_char* pktdata) { /* locals */ struct pkt *pkt; int len = pcpkt->caplen; /* Length of captured data */ ip_addr_t offset; /* Offset into ctl arrays (== ip addr) */ ip_addr_t spa=0; /* Arp source protocol addr */ DEBUG_PRT(DEBUG_PKTIO, "pkt_handler - start"); if (pktdata == NULL) return; if (len > PKT_BUF_LEN) { warnx("Dropping oversize packet"); return; } if ((pkt = pkt_new()) == NULL) { warnx("Error allocating new packet"); return; } /* Copy received data into a new pkt element */ memcpy(pkt->pkt_data, pktdata, len); pkt->pkt_end = pkt->pkt_data + len; pkt_decorate(pkt); /* Verify that pkt is well-constructed */ DEBUG_PRT(DEBUG_PKTIO, "pkt_handler - pkt accepted"); switch (ntohs(pkt->pkt_eth->eth_type)){ case ETH_TYPE_IP: /* Handle incoming IP pkt */ if (pkt->pkt_ip == NULL) /* Ignore malformed pkt */ break; ip_handler(pkt); break; case ETH_TYPE_ARP: /* Handle incomping ARP pkt */ if ((pkt->pkt_arp == NULL) || /* Ignore malformed pkts */ (pkt->pkt_arp_data == NULL)) break; if (ctl.capture & FL_CAPTURE) { switch(ntohs(pkt->pkt_arp->ar_op)) { case ARP_OP_REQUEST: handle_ARP_req(pkt); break; case ARP_OP_REPLY: /* * Received reply to an ARP "WHO-HAS" pkt */ #ifdef LB_SYSTEM_IS_SUN memmove(&spa, &(pkt->pkt_arp_data->ar_spa), sizeof(ip_addr_t)); #else spa = *( (ip_addr_t *)(pkt->pkt_arp_data->ar_spa)); /* is in netwk byte order */ #endif /* Check if the incoming IP address interests us */ if( lbio_ip_offset(spa, &offset) < 0) { if (ctl.logging & FL_LOG_ODD_ARPS) { util_print(NORMAL, "IP address %s not in capture subnet - ARP-REPLY", lbio_ntoa(spa)); } break; } /* * Someone replied to an ARP request ... * * Set up a "new * kid" element to mark this IP as belonging * to the machine that replied. We want to leave this IP * alone. */ handle_new_kid_ARP( offset, spa, pkt->pkt_arp_data->ar_sha); break; } /* end switch ARP */ } break; /* end arp case */ } /* end pkt switch */ pkt_free(pkt); return; } labrea-2.5-stable-1.orig/src/lbio.c0100644000550600055060000005010607730434533016130 0ustar tonontonon/* * lbio.c * * This file is part of the LaBrea package * * Copyright (C) 2001, 2002 Tom Liston * * 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. * * $Id: lbio.c,v 1.2 2003/09/12 21:23:39 lorgor Exp $ */ #include "config.h" #include #include #ifdef HAVE_ERR_H #include #else #include "err.h" #endif #ifdef HAVE_STDLIB_H #include #endif #include "labrea.h" #include "bget.h" #include "pkt.h" #include "ctl.h" #include "utils.h" #include "pcaputil.h" #include "lbio.h" #ifdef WIN32 /* has to be here to avoid compile errors with bpf structs */ #include #endif /* * Windows-only * * Build list of WinPcap device driver adapters * * returns 0 no errors detected * -1 error when opening interfaces * * 2002-10-5 Note that libdnet 1.7 requires WinPcap 2.3. In this version, you * have to interface directly with the packet driver to get the list of * devices. In WinPcap 3.0, the pcap_findalldevs function is introduced, and * this code should be updated to use the new function. * * This code was adapted from WinPcap 2.3 examples and libdnet 1.7. */ int build_pcap_adapter_list (void) { #ifdef WIN32 /* Declarations for WinPcap information */ int i=0,j=0; /* Unicode strings for WinNT and later */ WCHAR adapter_list[MAX_NUM_ADAPTER*2*BUFSIZE]; /* string that contains a list of the network adapters */ WCHAR *name; /* Name of adapter in list */ /* Ascii strings for Win98 / WinME */ char adapter_lista[MAX_NUM_ADAPTER*2*BUFSIZE]; /* list of adapters */ char *namea; /* Name of adapter */ char *desc; /* Description of adapter in list */ ULONG adapter_length; if (!util_check_version_win98()) { warnx("*** This version of Windows is not supported.\n" "*** System must be Windows 98 or better"); return(-1); } util_print(VERBOSE,"WinPcap library version: %s\n", PacketGetVersion()); /* * Get information from WinPcap.about driver adapters. * This is needed because eth_send opens a WinPcap device. */ if (util_check_version_winNT()) { adapter_length= sizeof(adapter_list) / sizeof(adapter_list[0]); if(PacketGetAdapterNames((PTSTR)adapter_list,&adapter_length)==FALSE){ warnx("*** Unable to retrieve the list of the adapters"); return (-1); } for (name = adapter_list, i = 0; *name != '\0' && i < MAX_NUM_ADAPTER; i++) { wcstombs(io.adapter_name_list[i], name, sizeof(io.adapter_name_list[0])); while (*name++ != '\0') ; } for (desc = (char *)name + 2, j = 0; *desc != '\0' && j < MAX_NUM_ADAPTER; j++) { strlcpy(io.adapter_desc_list[j], desc, sizeof(io.adapter_desc_list[0])); while (*desc++ != '\0') ; } /* * Windows 95 - 98 - ME is in ascii */ } else { adapter_length= sizeof(adapter_lista) / sizeof(adapter_lista[0]); if(PacketGetAdapterNames((PTSTR)adapter_lista,&adapter_length)==FALSE){ warnx("*** Unable to retrieve the list of the adapters"); return (-1); } for (namea = adapter_lista, i = 0; *namea != '\0' && i < MAX_NUM_ADAPTER; i++) { strlcpy(io.adapter_name_list[i], namea, sizeof(io.adapter_name_list[0])); while (*namea++ != '\0') ; } for (desc = (char *)namea + 1, j = 0; *desc != '\0' && j < MAX_NUM_ADAPTER; j++) { strlcpy(io.adapter_desc_list[j], desc, sizeof(io.adapter_desc_list[0])); while (*desc++ != '\0') ; } } io.adapter_total_num=i; #endif return (0); } /* * Windows-only * * Opens the nth WinPcap device driver adapter and libdnet eth interface * * returns 0 no errors detected * -1 errors */ int open_winpcap_adapter() { #ifdef WIN32 int j=0; /* * Get information from WinPcap.about driver adapters. * This is needed because eth_send opens a WinPcap device. */ if (build_pcap_adapter_list() < 0) { warnx("*** Problem building WinPcap adapter list."); return(-1); } j = io.intf_num <= 0 ? 0 : io.intf_num - 1; /* default is the first adapter in the list */ util_print(VERBOSE,"Using WinPcap adapter %d\n %s\n %s", j+1, io.adapter_name_list[j], io.adapter_desc_list[j]); /* * Open the WinPcap device for sniffing */ if ((io.pcap = pcap_open(io.adapter_name_list[j])) == NULL) { warnx("*** Couldn't open WinPcap adapter" ); return(-1); } #endif return(0); } /* * Callback rtn for libdnet's intf_loop * * Called once for each interface, and choses first that is: * - not the loopback. * - Ethernet */ static int _find_intf(const struct intf_entry *entry, void *arg) { struct addr *a = (struct addr *)arg; if ((entry->intf_addr.addr_type == ADDR_TYPE_IP) && (entry->intf_addr.addr_ip != a->addr_ip) && (entry->intf_link_addr.addr_type == ADDR_TYPE_ETH)) { /* * We've found an interface but intf_loop returns * an ephemeral intf_entry in the stack * so must copy it to more permanent storage */ io.ifent = (struct intf_entry *)io.buf; assert(entry->intf_len <= sizeof(io.buf)); memcpy(io.ifent, entry, entry->intf_len); return (TRUE); } return (FALSE); /* Keep on looking */ } /* * Initialize IO * dev device name (unix) * texpr bpf filter expression */ void lbio_init(u_char *dev, u_char *texpr) { struct addr loopback; ip_addr_t ip_tmp = 0; /* For construction of ARP Who-Has */ io.rnd = rand_open(); /* Initialize the libdnet random # generation */ /* Get the interface handle */ if ((io.intf = intf_open()) == NULL) { warnx("*** Unable to get libdnet handle for interface %s \n", io.ifent->intf_name); util_clean_exit(1); } addr_aton(LOOPBACK, &loopback); if (strlen(dev) > 0) { /* * User-specified device name */ io.ifent = (struct intf_entry *)io.buf; io.ifent->intf_len = sizeof(io.buf); strlcpy(io.ifent->intf_name, dev, sizeof(io.ifent->intf_name)); if (intf_get(io.intf, io.ifent) < 0) { warnx("*** Unable to get information for interface %s\n", io.ifent->intf_name); util_clean_exit(1); } } else { /* * Loop through the interfaces looking for one that is: * - not a loopback * - Ethernet */ if (intf_loop(io.intf, _find_intf, &loopback) <= 0) { warnx("*** Unable to find a suitable interface to open\n"); util_clean_exit(1); } } /* open link interface for raw packet output */ if ((io.eth = eth_open(io.ifent->intf_name)) == NULL ) { warnx("*** Couldn't open libdnet link interface"); util_clean_exit(1); } if (WIN32_FLG) { /* open WinPcap device */ if (open_winpcap_adapter() < 0) util_clean_exit(1); } else { /* open Unix pcap device for sniffing */ if ((io.pcap = pcap_open(io.ifent->intf_name)) == NULL) { warnx("*** Couldn't open pcap device for sniffing" ); util_clean_exit(1); } } util_print(NORMAL, "Initiated on interface: %s", io.ifent->intf_name); /* * If the host system IP address is not set yet, * then pick it up from the interface as well as * the capture subnet information */ if (io.myip == 0) { if (io.ifent->intf_addr.addr_type == ADDR_TYPE_IP) { if (io.mask == 0) { /* Initialise net/mask from interf. info */ addr_btom(io.ifent->intf_addr.addr_bits, &io.mask, IP_ADDR_LEN); io.mask = ntohl(io.mask); io.net = ntohl(io.ifent->intf_addr.addr_ip); io.net &= io.mask; } /* remember our IP address so that can build arps for virtual servers */ io.myip = ntohl(io.ifent->intf_addr.addr_ip); } else { warnx("*** Unable to determine IP address from the interface." ); util_clean_exit(1); } } /* * Same thing for the system MAC address */ if (io.mymac == NULL) { if (io.ifent->intf_link_addr.addr_type == ADDR_TYPE_ETH) { io.mymac = &(io.ifent->intf_link_addr); } else { warnx("*** The interface must be of type Ethernet." ); util_clean_exit(1); } } util_print(VERBOSE, "Host system IP addr: %s, MAC addr: %s", lbio_ntoa(io.myip), addr_ntoa(io.mymac)); if ((io.dloff = pcap_dloff(io.pcap)) < 0) { warnx("*** Couldn't determine link layer offset" ); util_clean_exit(1); } /* compile our BPF filter and attach it to the datalink */ if (pcap_filter(io.pcap, texpr) < 0) { warnx("*** Either pcap filter is invalid or error in activation of filter" ); util_clean_exit(1); } /* calculate max possible addresses in our netblock; allocate buffer pool */ if (ctl.capture & FL_CAPTURE) { if ((io.mask == 0) || (io.myip == 0)) { warnx("*** System IP address or host mask is invalid."); util_clean_exit(1); } ctl.addresses = io.mask ^ 0xFFFFFFFF; pkt_init(ctl.addresses+100); /* Initialize bget pkt pool */ } else { ctl.addresses = 0; pkt_init(100); } /* set our base address */ ctl.base = io.net; ctl.topend = ctl.base + ctl.addresses; /* allocate arp pkt used for WHO-HAS */ if ((io.bcast = pkt_new()) == NULL) { warnx("*** Problem allocating WHO-HAS arp pkt"); util_clean_exit(1); } io.bcast->pkt_end = io.bcast->pkt_data + ETH_HDR_LEN + ARP_HDR_LEN + ARP_ETHIP_LEN; io.bcast->pkt_arp = (struct arp_hdr *) (io.bcast->pkt_data + ETH_HDR_LEN); io.bcast->pkt_arp_data = (struct arp_ethip *) (io.bcast->pkt_data + ETH_HDR_LEN + ARP_HDR_LEN); ip_tmp = htonl(io.myip); /* build broadcast arp WHO HAS pkt used in switch environments */ arp_pack_hdr_ethip( io.bcast->pkt_arp, ARP_OP_REQUEST, io.mymac->addr_eth, /* We are the sender */ ip_tmp, ETH_ADDR_BROADCAST, /* Target is broadcast to find */ IP_ADDR_ZEROS); /* some IP addr */ eth_pack_hdr( io.bcast->pkt_eth, ETH_ADDR_BROADCAST, /* Broadcast addr */ io.mymac->addr_eth, /* our mac becomes src MAC */ ETH_TYPE_ARP); pkt_decorate(io.bcast); /* allocate and build bogus mac addr structure */ if ((io.bogus_mac = bget(sizeof(struct addr))) == NULL) { warnx("*** Problem allocating bogus mac addr structure"); util_clean_exit(1); } addr_pack(io.bogus_mac, ADDR_TYPE_ETH, ETH_ADDR_BITS, ETH_ADDR_BOGUS, ETH_ADDR_LEN); } /* * Send pkt "pkt" out the raw interface */ int lbio_send_pkt(const struct pkt *pkt) { int i = 0; i = eth_send(io.eth, pkt->pkt_eth, pkt->pkt_end - (u_char *) pkt->pkt_eth); return(i); } /* * Finish building the new tcp pkt "new", using information in * original pkt "pkt", and send out raw interface. Then log a message * using text "msg" * * new pkt to be sent * pkt original pkt * ipl length of ip pkt * msg msg for log */ int lbio_send_ip_pkt (struct pkt *new, const struct pkt *pkt, const uint16_t ipl, const u_char *msg) { u_char c[] = "*"; static int star=FALSE; int ret_code = 0; eth_pack_hdr( new->pkt_eth, pkt->pkt_eth->eth_src, /* orig src MAC becomes new dest MAC */ ETH_ADDR_BOGUS, /* bogus mac becomes new src MAC */ ETH_TYPE_IP); ip_pack_hdr( new->pkt_ip, 0, /* tos */ ipl, /* IP hdr length */ rand_uint16( io.rnd ), /* ipid */ 0, /* frag offset */ IP_TTL_DEFAULT, pkt->pkt_ip->ip_p, /* ip protocol of original pkt */ pkt->pkt_ip->ip_dst, /* orig dst becomes new src addr */ pkt->pkt_ip->ip_src ); ip_checksum(new->pkt_ip, new->pkt_end - new->pkt_eth_data); if ((ret_code = lbio_send_pkt(new)) < 0) warnx("*** Problem sending packet"); pkt_free(new); if (msg == NULL) return(ret_code); if (star) { /* Flip-flop "*" on output to avoid messages in log */ strncpy(c, " ", sizeof(c)); star = FALSE; } else star = TRUE; if (pkt->pkt_ip->ip_p == IP_PROTO_TCP) util_print(VERBOSE, "%s: %s %i -> %s %i %s", msg, ip_ntoa(&(pkt->pkt_ip->ip_src)), ntohs(pkt->pkt_tcp->th_sport), ip_ntoa(&(pkt->pkt_ip->ip_dst)), ntohs(pkt->pkt_tcp->th_dport), c); else util_print(VERBOSE, "%s: %s -> %s %s", msg, ip_ntoa(&(pkt->pkt_ip->ip_src)), ip_ntoa(&(pkt->pkt_ip->ip_dst)), c); return(ret_code); } /* * Generate a random number */ uint32_t lbio_rand(void) { return( rand_uint32(io.rnd) ); } /* * If we are in a switched environment, send our own ARP to be sure * that the IP is unused before capturing it. pkt is the incoming ARP * request. * */ void lbio_send_ARP_Who_Has (const ip_addr_t tpa) { ip_addr_t tpa_tmp = htonl(tpa); DEBUG_PRT(DEBUG_PKTPROC, "lbio_send_ARP_Who_Has: tpa %s", lbio_ntoa(tpa)); memmove(&(io.bcast->pkt_arp_data->ar_tpa), &tpa_tmp, sizeof(ip_addr_t)); eth_send(io.eth, io.bcast->pkt_eth, io.bcast->pkt_end - (u_char *) io.bcast->pkt_eth); } /* * Build and send a bogus ARP reply to capture an IP address * * tpa -> addr IP to be captured * pkt -> incoming ARP request pkt * */ void lbio_send_bogus_ARP (const ip_addr_t tpa, const struct pkt *pkt) { ip_addr_t ip_tmp; /* For construction of packets */ struct pkt *bogus; /* Contains bogus ARP reply used for */ /* IP capturing*/ ip_tmp = htonl(tpa); if ((bogus = pkt_new()) == NULL) { warnx("*** Problem initializing bogus arp pkt"); util_clean_exit(1); } DEBUG_PRT(DEBUG_PKTPROC, "lbio_send_bogus_ARP: tpa %s", lbio_ntoa(tpa)); bogus->pkt_end = bogus->pkt_data + ETH_HDR_LEN + ARP_HDR_LEN + ARP_ETHIP_LEN; bogus->pkt_arp = (struct arp_hdr *) (bogus->pkt_data + ETH_HDR_LEN); arp_pack_hdr_ethip(bogus->pkt_arp, ARP_OP_REPLY, ETH_ADDR_BOGUS, /* Bogus MAC is the "sender" */ ip_tmp, /* for the IP addr that was asked for */ pkt->pkt_arp_data->ar_sha, /* Answer is going back to requestor's */ pkt->pkt_arp_data->ar_spa); /* MAC and IP addr */ eth_pack_hdr( bogus->pkt_eth, pkt->pkt_eth->eth_src, /* Src MAC becomes the new dest MAC */ ETH_ADDR_BOGUS, /* Response is from bogus virtual machine */ ETH_TYPE_ARP); pkt_decorate(bogus); lbio_send_pkt(bogus); pkt_free(bogus); util_print(NORMAL, "Capturing local IP %s", lbio_ntoa(tpa)); } /* * Close I/O and associated services * */ void lbio_close (void) { struct pcap_stat stat; /* clean up our pcap stuff */ if(io.pcap != NULL) { /* show 'em some stats... */ if(pcap_stats(io.pcap, &stat) >= 0) { util_print(NORMAL, "%d/%d packets (received/dropped) by filter", stat.ps_recv, stat.ps_drop); } pcap_close(io.pcap); } /* clean up our libdnet stuff */ if (io.rnd != NULL) rand_close(io.rnd); if (io.eth != NULL) eth_close(io.eth); /* Free pre-allocated arp pkts */ if (io.bcast != NULL) pkt_free(io.bcast); } /* * Format IP address for printing * */ char * lbio_ntoa (const ip_addr_t ip) { ip_addr_t ip_tmp = htonl(ip); return(ip_ntoa(&ip_tmp)); } /* * convert IP address into offset in control arrays * * ip address to be converted * offset ptr to result * * returns 0 no errors detected * -1 address is not valid */ int lbio_ip_offset (const ip_addr_t ip, ip_addr_t *offset) { ip_addr_t ip_tmp = ntohl(ip); if (ip_tmp < ctl.base) { util_print(VERY_VERBOSE, "*** IP address %s is before start of capture subnet - Ignoring", ip_ntoa(&ip) ); return(-1); } *offset = ip_tmp - ctl.base; /* convert to relative offset in range */ if ((*offset) > ctl.addresses){ util_print(VERY_VERBOSE, "*** IP address %s is after end of capture subnet - Ignoring", ip_ntoa(&ip)); return(-1); } return(0); } /* * Windows-only * * Print list of libdnet interfaces * * returns 0 no errors detected * -1 error when opening interfaces * * * 2002-11-7 Note that both the libdnet interface and the WinPcap device * driver adapter are abstractions for the NIC. Unfortunately, the * human-readable description supplied by the libraries does not * match. So cannot correlate from one to the other. * * When doing packet I/O, it is the WinPcap driver adapter API that * is used. * * However, Labrea needs also to know the home system NIC's IP * and MAC addresses in order to do ARP WHO-HAS among other things. * The libdnet inferface API is used to determine this information. * * If there are multiple possibilities, we let the user tell us * which one to use from both lists. */ #ifdef WIN32 static int _print_intf(const struct intf_entry *entry, void *arg) { int *(n) = (int *)arg; struct addr loopback; /* Loopback is not allowed */ static int look_for_default; uint32_t mask; /* Get set to search for default interface */ if (*n == 0) look_for_default = TRUE; (*n)++; printf("%d %s:\n", *n, entry->intf_name); addr_aton(LOOPBACK, &loopback); if (entry->intf_addr.addr_type == ADDR_TYPE_IP) { addr_btom(entry->intf_addr.addr_bits, &mask, IP_ADDR_LEN); mask = ntohl(mask); printf("\tinet %s netmask 0x%x\n", ip_ntoa(&entry->intf_addr.addr_ip), mask); if (entry->intf_link_addr.addr_type == ADDR_TYPE_ETH) { printf("\tlink %s\n", addr_ntoa(&entry->intf_link_addr)); /* * If still searching for the default interface * and this is not the loopback interface, then * have found it. */ if (look_for_default && (entry->intf_addr.addr_ip != loopback.addr_ip)) { printf("===> Default interface\n\n"); look_for_default = FALSE; } } } return (0); } #endif int lbio_print_libdnet_intf_list (void) { #ifdef WIN32 intf_t *intf; int num_intf=0; if (!util_check_version_win98()) { warnx("*** This version of Windows is not supported.\n" "*** System must be Windows 98 or better"); return(-1); } /* * Get information from libdnet intf_xx functions. * For Windows, this comes from the Win32 MIB-II snmp functions. * Needed to get IP / MAC address. */ printf( "\n*** Libdnet interface list ***\n\n" "* Labrea uses libdnet to write packets, determine IP addr, etc.\n" "Labrea looks through the following list for the the first Ethernet\n" "interface that is not the loopback interface.\n" "* To override this behaviour and select interface \"ethn\", specify:\n" " -i ethn\n" "or manually specify the values to use:\n" " -I nnn.nnn.nnn.nnn -E xx:xx:xx:xx\n" "* Note that the libdnet interface and the Winpcap device MUST refer to the\n" "same physical NIC (network interface card).\n\n"); if ((intf = intf_open()) == NULL) err(1, "intf_open"); if (intf_loop(intf, _print_intf, &num_intf) < 0) warnx("*** Error in libdnet intf_loop. Note that on Win98, you \n" "must manually specify the NIC IP and MAC addresses (-I -E)."); printf("*** End of libdnet interface list ***\n"); #endif return (0); } /* * Windows-only * * Print list of WinPcap device driver adapters * * returns 0 no errors detected * -1 error when opening interfaces */ int lbio_print_pcap_adapter_list (void) { #ifdef WIN32 int i=0; printf( "\n*** WinPcap device list\n\n" "* Labrea uses Winpcap to sniff the network.\n" "The following is the list of Winpcap devices.\n" "The default is to use the first device in the list.\n" "* To override this behaviour and select device \"n\", specify\n" " -j n\n\n"); if (build_pcap_adapter_list() < 0) { warnx("*** Unable to build WinPcap device list"); return(-1); } /* * Now print out the resulting list */ for (i=0; i Default device\n\n"); } printf("*** End of WinPcap device list ***\n\n"); #endif return (0); } labrea-2.5-stable-1.orig/src/ctl.c0100644000550600055060000003531207730434533015767 0ustar tonontonon/* ctl.c * This file is part of the LaBrea package * * Copyright (C) 2001, 2002 Tom Liston * * 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. * * $Id: ctl.c,v 1.3 2003/09/12 21:23:39 lorgor Exp $ */ #include "config.h" #ifdef HAVE_UNISTD_H #include #endif #include #include #ifdef HAVE_TIME_H #include #endif #include #include #ifdef HAVE_ERR_H #include #else #include "err.h" #endif #ifdef HAVE_WINDOWS_H #include #endif #include "labrea.h" #include "bget.h" #include "pkt.h" #include "utils.h" #include "lbio.h" #include "ctl.h" /* * used to clean up stuff in the input files, this one skips over any * spaces and carriage returns and then changes a line feed to a null * */ static void cleanup (char *p) { char *p2 = p; while(*p != '\0') { /*Skip spaces and returns */ while((*p2 == ' ') || (*p2 == '\r') || (*p2 == '\t')) { p2++; } *p = (char)toupper(*p2); if (*p == '\n') *p = '\0'; else { p2++; p++; } } } static config_t parse_type (char *mybuffer) { char *p = NULL; config_t type = IP_INVALID; if ((p = strstr(mybuffer, "HAR")) != NULL){ type = IP_HARD_EXCLUDE; } else { if ((p = strstr(mybuffer,"EXC" )) != NULL){ type = IP_EXCLUDE; } else { if ((p = strstr(mybuffer, "IPI")) != NULL) { type = IP_IGNORE; } else { if ((p = strstr(mybuffer, "POR")) != NULL){ type = PT_IGNORE; } else { if ((p = strstr(mybuffer, "PMN")) != NULL){ type = PT_MONITOR; } else { type = CFG_INVALID; } } } } } if (p != NULL) /* Eliminate the specification field */ *p = '\0'; return( type ); } /* * Parses port or port range in configuration file * * mybuffer string with ports to be parsed * port_value value to be assigned to port_array * * Returns -1 if input_error found * 0 if input is correct * */ static int parse_port (char * mybuffer, uint16_t port_value) { char *p=NULL; unsigned int export=0, lowport=0; long i=0; char *msg=NULL; if ((p = strstr(mybuffer, "-")) != NULL) { /* check for range */ *p = '\0'; p++; } if ((sscanf(mybuffer, "%u", &lowport) != 1) || (lowport > PORT_NUM)){ warnx("***Invalid port: %i - Ignoring", lowport); return(-1); /* There is an error */ } if (p != NULL) { /* Handle range of ports */ if ((sscanf(p, "%u", &export) != 1) || (export > PORT_NUM)){ warnx("*** Invalid port: %i - Ignoring", export ); return(-1); /* There is an error */ } } else export = lowport; for(i = lowport; i <= export; i++) { ctl.port_array[i] = port_value; } msg = (port_value == PORT_MAX) ? "monitored" : "ignored"; if (lowport == export) util_print(VERBOSE, " Port %i %s", lowport, msg); else util_print(VERBOSE, " Ports %i-%i %s", lowport, export, msg); return(0); /* No errors were found */ } /* * Parses the HAR (hard exclude) and EXC (exclude) config file statements * * mybuffer contains the statement to be parsed * exclude_value is the type of exclusion to be done * * returns 0 if no errors were found * -1 if there were input errors * */ static int parse_ip_exclude (char *mybuffer, config_t exclude_value) { char *p = NULL; /* Used to find start of second addr in range */ ip_addr_t lowip=0, exip=0; /* Low / high IP offsets of addr range */ ip_addr_t ip=0; /* Loop index */ char *msg = NULL; /* Output msg */ struct addr inp_addr; /* I/P addr converted to structure */ if ((p = strstr(mybuffer, "-")) != NULL) { /* check for range */ *p = '\0'; p++; } /* Parse low IP in range */ if ((addr_aton(mybuffer, &inp_addr) < 0) || (inp_addr.addr_type != ADDR_TYPE_IP)){ warnx("*** Invalid IP address: %s - Ignoring", mybuffer); return( -1 ); } if( lbio_ip_offset(inp_addr.addr_ip, &lowip) < 0) { /* lowip is converted IP addr */ warnx("*** Excluded IP address %s not in capture subnet - Ignoring", mybuffer); return(-1); } /* Parse high IP in range if provided */ if (p != NULL){ if ((addr_aton(p, &inp_addr) < 0) || (inp_addr.addr_type != ADDR_TYPE_IP)){ warnx("*** Invalid IP address: %s - Ignoring", mybuffer); return( -1 ); } if( lbio_ip_offset(inp_addr.addr_ip, &exip) < 0) { /* exip is high IP addr */ warnx("*** Excluded IP address %s not in capture subnet - Ignoring", mybuffer); return(-1); } /* Otherwise there is no range: only 1 IP addr was input */ } else exip = lowip; msg = (exclude_value == IP_HARD_EXCLUDE) ? " hard excluded:" : " excluded:"; for(ip = lowip; ip <= exip; ip++) { ctl.exclusion[ip] = exclude_value; util_print(VERY_VERBOSE, " IP %s %s", msg, lbio_ntoa(ctl.base+ip)); } return(0); } static void init_port_array (void) { long i=0; /* ports that always respond (unless turned off in the config file) */ const long tgt_ports[] = { 1, /* tcpmux */ 7, /* echo */ 9, /* discard */ 11, /* systat */ 13, /* daytime */ 15, /* netstat */ 17, /* qotd */ 18, /* msp */ 19, /* chargen */ 20, /* ftp-data */ 21, /* ftp */ 22, /* ssh */ 23, /* telnet */ 25, /* smtp */ 37, /* time */ 53, /* dns */ 69, /* tftp */ 77, /* rje */ 79, /* finger */ 80, /* http */ 81, /* RemoConCH. */ 98, /* linuxconf */ 109, /* pop2 */ 110, /* pop3 */ 111, /* portmapper */ 113, /* ident */ 119, /* nntp */ 123, /* ntp */ 135, /* netbios win*/ 137, /* netbios-ns */ 138, /* netbios-dgm*/ 139, /* netbios-ssn*/ 143, /* imap2 */ 161, /* snmp */ 162, /* snmp */ 179, /* bgp */ 194, /* irc */ 389, /* ldap */ 443, /* https */ 445, /* cfs win2k */ 512, /* exec */ 513, /* login */ 514, /* shell */ 515, /* printer */ 530, /* courier */ 1080, /* socks */ 1443, /* MS-Sql */ 1812, /* radius */ 1813, /* radius-acct*/ 2049, /* nfs */ 3306, /* mysql */ 3389, /* RDP */ 4045, /* lockd */ 6000, /* Xwindows */ 6001, /* idem */ 6002, /* idem */ 6003, /* idem */ 6004, /* idem */ 6005, /* idem */ 6346, /* Gnutella */ 8000, /* web */ 8080, /* web cache */ 8081, /* web proxy */ 8888, /* Napster */ 12345,/* trojan */ 27374, /* trojan */ -1 /* Always the last one */ }; /* Set all ports to be monitored */ for(i=1; i<=PORT_NUM; i++) ctl.port_array[i] = PORT_MONITOR; /* Then set some ports to make us an attractive target */ i = 0; while(tgt_ports[i] > 0) { ctl.port_array[ tgt_ports[i] ] = PORT_MAX; i++; } } /* * Parse the configuration file * * There is a common file with "tags" on lines to indicate what type * of configuration the line is supposed to be... for example: * * 192.168.0.1 - 192.168.0.10 EXC * would exclude the range of IPs from 192.168.0.1 * through 192.168.0.10 * * 192.168.0.20 IPI * would cause connection attempts sourced from * 192.168.0.20 to NOT be * tarpitted or trapped * * Tags are: * HAR hard-exclude IPs * EXC exclude IPx * IPI IP ignore * POR port ignore * PMN port monitor * * Read exclusion files, then initialize control arrays and structures * to keep things straight * * wait TRUE if should wait before reinitializing * * returns -1 if configuration file has errors * 0 if config file processed correctly */ int ctl_init_arrays (int wait) { /* For reading the configuration file */ FILE *in = NULL; char mybuffer[BUFSIZE] = ""; int input_error = FALSE; /* Parsing the config parameters */ ip_addr_t ip=0, ip1=0; /* Loop indices */ char *rtn=NULL; config_t set_capture; /* For auto hard-capture */ uint16_t tempxflag; struct ipig *ipig; /* For arp sweep */ time_t current=time(NULL); int arp_cnt = 0; /* # of arps during this burst */ int arp_delay = -1; /* For delaying subsequent bursts */ /* shut off capture */ tempxflag = ctl.capture; ctl.capture &= ~(FL_CAPTURE); if (wait) { #ifdef WIN32 Sleep(1000); #endif } if (ctl.capture & FL_AUTO_HARD_CAPTURE) set_capture = IP_HARD_CAPTURED; else set_capture = IP_MONITOR; /* clear out the exclusion array */ for(ip = 0; ip < ctl.addresses + 2; ip++) ctl.exclusion[ip] = set_capture; /* clear the ARP addr array */ if (ctl.addr_array != NULL) { for(ip = 0; ip < ctl.addresses + 2; ip++) ctl.addr_array[ip] = 0; } /* clear out the ARP time array */ if (ctl.time_array != NULL) { for(ip = 0; ip < ctl.addresses + 2; ip++) ctl.time_array[ip] = 0; } /* clear out the nk array */ for (ip = 0; ip < ctl.addresses + 2; ip++) { util_nk_free(ip); } init_port_array(); /* free up our ignore list */ SLIST_FOREACH(ipig, &ctl.ipig_q, ipig_next){ brel(ipig); } SLIST_INIT(&ctl.ipig_q); /* Reinitialize the list */ /* parse the configuration file */ if ((in = fopen(ctl.cfg_file_name, "r")) == NULL) { warnx("*** Config file %s not found", ctl.cfg_file_name); } else { util_print(VERBOSE, "...Processing configuration file"); while((rtn = fgets(mybuffer, BUFSIZE, in)) != NULL ) { if ((*mybuffer != '#') && (strlen(mybuffer) > 2)) { util_print(VERBOSE, ">> %s", mybuffer); cleanup(mybuffer); } else continue; switch( parse_type( mybuffer )) { case IP_HARD_EXCLUDE: if (parse_ip_exclude(mybuffer, IP_HARD_EXCLUDE) < 0) input_error = TRUE; break; case IP_EXCLUDE : if (parse_ip_exclude(mybuffer, IP_EXCLUDE) < 0) input_error = TRUE; break; case IP_IGNORE: ipig = (struct ipig *) bget(sizeof(*ipig)); if (ipig == NULL) { warnx("***Problem allocating IP Ignore list element"); input_error = TRUE; break; } if ((addr_aton(mybuffer, &(ipig->ipig_addr)) < 0) || (ipig->ipig_addr.addr_type != ADDR_TYPE_IP)) { warnx("***Invalid IP address: %s - Ignoring", mybuffer); input_error = TRUE; break; } SLIST_INSERT_HEAD(&ctl.ipig_q, ipig, ipig_next); if (addr_ntop(&(ipig->ipig_addr), mybuffer, sizeof(mybuffer)) < 0) break; util_print(VERY_VERBOSE, " Ignoring IP: %s", mybuffer); break; case PT_IGNORE: if (parse_port(mybuffer, PORT_IGNORE) < 0) input_error = TRUE; break; case PT_MONITOR: if (parse_port(mybuffer, PORT_MAX) < 0) input_error = TRUE; break; case CFG_INVALID: default: warnx("*** Configuration file - line with missing or invalid specifier:\n%s", mybuffer); input_error = TRUE; } /* end switch on type of config stmt */ } /* end read loop */ util_print(VERBOSE, "... End of configuration file processing\n"); fclose(in); } if (ctl.feature & FL_EXCL_RESOLV_IPS) { util_print(VERBOSE, "LaBrea will exclude resolvable IP addresses."); for(ip1 = ctl.base; ip1 <= ctl.topend; ip1++) { ip = htonl(ip1); if (gethostbyaddr((void *)&ip,4,AF_INET)) { ctl.exclusion[ip1-ctl.base] = IP_EXCLUDE; util_print(VERBOSE, "IP excluded via DNS: %s", lbio_ntoa(ip1)); } } } /* turn on ARP capture -- if it was on */ ctl.capture |= (tempxflag & FL_CAPTURE); /* * Force an arp sweep for used IP addresses by setting expired nk * entries */ if ((!(ctl.mode & FL_NO_ARP_SWEEP)) && (ctl.capture & FL_CAPTURE)) { for (ip = 1; ip < ctl.addresses; ip++) { if ((ctl.exclusion[ip] == IP_MONITOR) || (ctl.exclusion[ip] == IP_HARD_EXCLUDE)) { /* * If have reached max # of arps for this burst, then delay * the next batch until the next nk cull pass */ if ((++arp_cnt) > MAX_ARP_BURST) { arp_cnt = 0; if (arp_delay == -1) arp_delay = 0; else arp_delay += (NK_CULL_INTVL*60); /* delay in seconds */ } /* Send immediate WHO-HAS ARP for first batch of IPs */ if (arp_delay == -1) lbio_send_ARP_Who_Has(ctl.base + ip); else /* Force an ARP WHO-HAS by setting an expired nk element */ util_nk_new(ip , current - CULLTIME + arp_delay, ETH_ADDR_BOGUS); } } } if (input_error) return(-1); else return(0); } /* * Initialize processing for ctl routines * * Returns -1 if initialization errors occurred * 0 if no errors occurred */ int ctl_init() { int c = 0; DEBUG_PRT(DEBUG_INIT, "ctl_init"); /* Initialize random #s for Linux window probe detection */ for(c = 0; c < RANDSIZE2; c++) ctl.randqueue2[c] = lbio_rand(); /* allocate our exclusion array */ if ((ctl.exclusion = calloc(ctl.addresses+2, sizeof(*ctl.exclusion))) == NULL) { warnx( "*** calloc error: exclusion - unable to allocate memory" ); util_clean_exit(1); } /* Allocate port array */ if ((ctl.port_array = calloc(PORT_NUM + 1,sizeof(*ctl.port_array))) == NULL) { warnx( "*** calloc error: port_array - unable to allocate memory" ); util_clean_exit(1); } /* if we're going to use it, allocate our array for holding ARP times */ if (ctl.capture & FL_CAPTURE) { if ((ctl.time_array = calloc(ctl.addresses+2,sizeof(*ctl.time_array))) == NULL) { warnx( "*** calloc error: time_array - unable to allocate memory" ); util_clean_exit(1); } if ((ctl.addr_array = calloc(ctl.addresses+2,sizeof(*ctl.addr_array))) == NULL) { warnx( "*** calloc error: addr_array - unable to allocate memory" ); util_clean_exit(1); } if ((ctl.nk_array = calloc(ctl.addresses+2,sizeof(*ctl.nk_array))) == NULL) { warnx( "*** calloc error: nk_array - unable to allocate memory" ); util_clean_exit(1); } } /* initialize IP ignore list */ SLIST_INIT(&ctl.ipig_q); /* and set up the list */ /* If soft restart enabled, then hold off captures for specified # minutes */ if (ctl.soft_restart > 0) { for (c = 0; c < ctl.soft_restart; c++) { ctl.past[c] = ctl.maxbw * 60; /* max bandwidth in bytes/sec * 60 sec/min = bytes for this min */ } ctl.newthisminute = 0; ctl.totalbytes = ctl.maxbw * ctl.soft_restart * 60; } return(ctl_init_arrays(0)); } labrea-2.5-stable-1.orig/src/utils.c0100644000550600055060000003322607730435013016341 0ustar tonontonon/* * utils.c * This file is part of the LaBrea package * * Copyright (C) 2001, 2002 Tom Liston * * 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. * * $Id: utils.c,v 1.4 2003/09/12 21:26:35 lorgor Exp $ */ #include "config.h" #ifdef HAVE_UNISTD_H #include #endif #include #ifdef HAVE_FCNTL_H #include #endif #include #include #include #include #ifdef HAVE_TIME_H #include #endif #include #ifdef HAVE_SYSLOG_H #include #else #include "syslog.h" #endif #include #ifdef HAVE_ERR_H #include #else #include "err.h" #endif #ifdef HAVE_WINSOCK_H #include #endif #ifdef HAVE_WINDOWS_H #include #endif #include "bget.h" #include "pkt.h" #include "labrea.h" #include "pcaputil.h" #include "ctl.h" #include "lbio.h" #include "utils.h" void util_init(void) { memset(&outp, 0, sizeof(outp)); outp.verbose = NORMAL; } void util_open_syslog(char *ident) { /* set up logging */ openlog(ident, 0, LOGFAC); if (!WIN32_FLG) outp.syslog_open = TRUE; } /* * Print a message to STDOUT, with the timestamp in one of two * formats, or we send it to syslog * */ void util_print(const amt_log_t verbosity_msg, const char *fmt, ...) { char buf[BUFSIZE] = ""; char tnow[BUFSIZE] = ""; time_t current = time(NULL); char *p = NULL; va_list ap; if (verbosity_msg > outp.verbose) return; va_start(ap, fmt); if (fmt != NULL) { vsnprintf(buf, sizeof(buf), fmt, ap); } va_end(ap); if (outp.output & FL_OUTP_STDOUT || !outp.syslog_open) { if (outp.output & FL_OUTP_STDOUT_EPOCH) (void)printf("%lu %s\n", current, buf); else { strlcpy(tnow, ctime(¤t),sizeof(tnow)); p = tnow + strlen(tnow) -1; /* Point to last character */ if (*p == '\n') *p = ' '; /* replace trailing \n by blank */ (void)printf("%s %s\n", tnow, buf); } } else syslog(INFOTYPE, buf); } /* * Cleanly exit by freeing arrays, list memory, closing down syslog, * pcap, etc. * */ void util_clean_exit(int err) { ip_addr_t offset; struct ipig *ipig, *next_i; /* free up our arrays */ if (ctl.nk_array != NULL) { for (offset = 0; offset <= ctl.addresses; offset++) util_nk_free(offset); MYFREE(ctl.nk_array); } if (ctl.addr_array != NULL) { MYFREE(ctl.addr_array); } if (ctl.time_array != NULL) { MYFREE(ctl.time_array); } if (ctl.exclusion != NULL) { MYFREE(ctl.exclusion); } if (ctl.port_array != NULL) { MYFREE(ctl.port_array); } for (ipig = SLIST_FIRST(&ctl.ipig_q); ipig != SLIST_END(&ctl.ipig_q); ipig = next_i) { next_i = SLIST_NEXT(ipig, ipig_next); SLIST_REMOVE_HEAD(&ctl.ipig_q, ipig_next); brel(ipig); } SLIST_INIT(&ctl.ipig_q); util_print(NORMAL, "Labrea exiting..."); /* shut down syslog connection */ if (outp.syslog_open) closelog(); /* shut down I/O */ lbio_close(); exit(err); } /* * detach this process and become a daemon (under unix) */ void util_detach (void) { #ifndef WIN32 pid_t fs; /* don't detach if not supposed to */ if ((ctl.mode & FL_DONT_DETACH) || (ctl.mode & FL_TESTMODE)) return; if (getppid() != 1) { fs = fork(); if (fs > 0) exit(0); /* parent */ if (fs < 0) { errx(EPERM, "Error starting fork"); } setsid(); } /* redirect stdin/stdout/stderr to /dev/null */ close(0); close(1); close(2); open("/dev/null", O_RDWR); dup(0); dup(0); #endif return; } /* * Allocate and initialize new "new kid" element * * This marks an IP address as belonging to another machine that has * sent a gratuitous ARP to announce its presence. * * offset offset in ctl arrays corresponding to ip addr * culltime expiry time for this element * mac corresponding mac addr * * returns 0 elt allocated and initialized * -1 problem encountered */ int util_nk_new (const ip_addr_t offset, const time_t culltime, const uint8_t *mac) { nk_t *nk; /* New nk element */ if ((nk = (nk_t *) bget(sizeof(nk_t))) == NULL) { warnx("Error allocating nk element"); return(-1); } ctl.nk_array[offset] = nk; nk->nk_time = culltime; /* Set time to be culled */ addr_pack(&(nk->nk_mac), ADDR_TYPE_ETH, ETH_ADDR_BITS, mac, ETH_ADDR_LEN); return(0); } /* * Free nk element * * offset offset in ctl arrays corresponding to ip addr */ void util_nk_free( const ip_addr_t offset ) { nk_t *nk; if ((nk = ctl.nk_array[offset]) != NULL) { DEBUG_PRT(DEBUG_SIGNAL, "util_nk_free: %d", offset); brel(nk); ctl.nk_array[offset] = NULL; } } /* * Do processing for a kill / int signal */ void util_quit (void) { #ifdef WIN32 DEBUG_PRT(DEBUG_SIGNAL, "util_quit"); WSACleanup(); if (ctl.boolThread){ ctl.boolThread = FALSE; while(!ctl.boolThread){ /* * util_timer will reset the boolThread flag once * the thread exits. */ DEBUG_PRT(DEBUG_SIGNAL, "util_quit: loop %d", ctl.boolThread); Sleep(300); /* Not too tight a loop */ } } #endif ctl.signals &= ~SIG_QUIT; util_clean_exit(0); } /* * Do processing for a HUP signal */ void util_restart (void) { DEBUG_PRT(DEBUG_SIGNAL, "util_restart"); ctl_init_arrays(1); util_print(NORMAL, "Received HUP signal, processing re-initialized..."); ctl.signals &= ~SIG_RESTART; /* reset flag */ return; } /* * Do processing of a USR1 signal: toggle logging off / on */ void util_toggle_logging(void) { if (WIN32_FLG) return; if ((outp.verbose == QUIET) && (outp.savedatalog == QUIET)) { outp.verbose = NORMAL; util_print(QUIET, "Received USR1 signal, starting data logging"); } else { if (outp.savedatalog != QUIET) { outp.verbose = outp.savedatalog; outp.savedatalog = QUIET; util_print(QUIET, "Received USR1 signal, restarting data logging"); } else { outp.savedatalog = outp.verbose; outp.verbose = QUIET; util_print(QUIET, "Received USR1 signal, stopping data logging"); } } ctl.signals &= ~SIG_TOGGLE_LOGGING; /* reset flag */ return; } /* * Handle timer interrupts * * This routine wakes up every minute to do processing. */ void timer_pop(void) { int avgbw, i; /* * Run nk list (count down to zero) every few min. But initialize to * force cull on 1st timer pop so that arp sweeps can start. */ static int nk_cull_cnt = 1; /* Recalculate dynamic ports every 15 min */ static int dyn_port_cnt = DYN_PORT_INTVL; nk_t *nk; /* Used to run nk list */ ip_addr_t offset=0; time_t current = 0; DEBUG_PRT(DEBUG_SIGNAL, "timer_pop: nk_cull_cnt: %d, soft_restart: %d" " dyn_port_cnt: %d", nk_cull_cnt, ctl.soft_restart, dyn_port_cnt); ctl.totalbytes -= ctl.past[HIST_MIN]; for(i = HIST_MIN; i; i--) ctl.past[i] = ctl.past[i - 1]; ctl.past[0] = ctl.currentbytes / ONE_K; /* Convert to Kbytes */ ctl.totalbytes += ctl.past[0]; ctl.currentbytes = 0; /* Avg Bandwidth = Total # Kbytes / total sec of hist */ avgbw = ctl.totalbytes / ((HIST_MIN+1)*60); if (ctl.logging & FL_LOG_BDWTH_SYSLOG) { util_print(NORMAL, "Current average bw: %i (Kb/sec)", avgbw << 3); } /* * This allows for a "soft" restart by letting 5 minutes go by * before allowing any new connections are captured. If you * restart with this enabled, then it should "recapture" the old * stuff, and base the bw calc on that before grabbing anything * new... * * I got bit by this... that's why I thought to do it... */ if (ctl.soft_restart > 0) ctl.soft_restart--; else /* * Attempt to keep bw in line when you're getting hammered by * limiting new connections that we'll allow to be captured per * minute */ ctl.newthisminute = (ctl.maxbw > avgbw) ? (ctl.maxbw - avgbw) * ONE_K : 0; /* Value is converted from Kbytes to bytes */ /* * When a machine sends out a gratuitous ARP to announce its * presence, then it is placed on the "new kids" list. * * Now run through the "new kids" array to cull out IP addr that have * shown no activity within the given time period. */ if ((--nk_cull_cnt) <= 0) { current = time(NULL); for (offset = 0; offset <= ctl.addresses; offset++) { /* * Cull the entries that have timed out with no response but * send a Who-Has arp to see if someone's still there */ if ((nk = ctl.nk_array[offset]) != NULL) { if ((nk->nk_time + CULLTIME) <= current) { lbio_send_ARP_Who_Has(ctl.base + offset); util_nk_free(offset); } } } nk_cull_cnt = NK_CULL_INTVL; /* Reset counter */ } /* * Recalculate dynamic port array if firewalling ports * * Reduce count on all ports being monitored so that random * "noise" is eliminated. However once / if a port has "maxed * out", it will always respond from then on. * */ if (ctl.feature & FL_NO_RST_EXCL_PORT) { if ((--dyn_port_cnt) <= 0) { for(i=1; i<=PORT_NUM; i++){ if ((ctl.port_array[i] > PORT_MONITOR) &&(ctl.port_array[i] < PORT_MAX)) { DEBUG_PRT(DEBUG_SIGNAL, "timer_pop: reducing count port %d = ", i, ctl.port_array[i]); ctl.port_array[i]--; } } dyn_port_cnt = DYN_PORT_INTVL; /* Reset counter */ } } } /* * Windows timer handler * * Under windows, a separate thread is set up. It sleeps * normally, waking up to check for termination (ie if * boolThread = FALSE). * * Every n cycles (= 1 min), a timer pop is simulated. */ #ifdef WIN32 DWORD WINAPI util_timer(LPVOID lpAintGonnaUseThis) { int j = 0; /* */ ctl.boolThread = TRUE; for(;;) { j++; if (!ctl.boolThread) { ctl.boolThread = TRUE; DEBUG_PRT(DEBUG_SIGNAL, "util_timer: exit thread"); ExitThread(0); } if (j >= WAKEUP_SEC) { j = 0; timer_pop(); /* Process timer pop */ } Sleep(WAKEUP_MSEC); } return(0); } #else /* * Unix timer handler */ void util_timer(void) { timer_pop(); /* Process timer pop */ ctl.signals &= ~SIG_TIMER; /* reset flag */ alarm(WAKEUP_SEC); } #endif /* * Signal handlers - just set flags to fire up mainline processing */ RETSIGTYPE catch_sig_restart(int sig) { ctl.signals |= SIG_RESTART; } RETSIGTYPE catch_sig_quit(int sig) { if (WIN32_FLG) ctl.signals |= SIG_QUIT; else util_quit(); /* * Quit directly since pcap_dispatch might not timeout on certain * systems. */ } RETSIGTYPE catch_sig_timer(int sig) { ctl.signals |= SIG_TIMER; } RETSIGTYPE catch_sig_toggle_logging(int sig) { ctl.signals |= SIG_TOGGLE_LOGGING; } /* * set up the signal handlers */ void util_set_signal_handlers(void) { #ifndef WIN32 static sigset_t set; sigemptyset(&set); sigprocmask(SIG_SETMASK, &set, NULL); #endif /* set signals so that we behave nicely */ #ifdef LB_SYSTEM_IS_SUN /* special function call for solaris so signal hdlr doesn't go away */ sigset(SIGTERM, catch_sig_quit); sigset(SIGINT, catch_sig_quit); sigset(SIGQUIT, catch_sig_quit); sigset(SIGHUP, catch_sig_restart); sigset(SIGALRM, catch_sig_timer); sigset(SIGUSR1, catch_sig_toggle_logging); #elif defined(WIN32) /* windows signal handlers */ signal(SIGTERM, catch_sig_quit); signal(SIGINT, catch_sig_quit); #else /* generic unix signal handlers */ signal(SIGTERM, catch_sig_quit); signal(SIGINT, catch_sig_quit); signal(SIGQUIT, catch_sig_quit); signal(SIGHUP, catch_sig_restart); signal(SIGALRM, catch_sig_timer); signal(SIGUSR1, catch_sig_toggle_logging); #endif } /* * set up the timer pop */ void util_alarm(void) { #ifndef WIN32 /* fire off an alarm */ alarm(WAKEUP_SEC); #else DWORD dummy; /* For thread creation */ /* Under windows, fire up a thread to simulate a timer pop */ CloseHandle(CreateThread(NULL,0,util_timer,0,0,&dummy)); #endif } /* * Windows only: Check version of Windows that are running on * * returns: 1 Version is Win98 or better * 0 Version is Win95 or something else not supported * */ int util_check_version_win98 (void) { #ifdef WIN32 OSVERSIONINFO osvi; BOOL bIsWindows98orLater = FALSE; if (util_check_version_winNT()) /* If WinNT or better then ok */ return (TRUE); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx (&osvi); bIsWindows98orLater = (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) && ( (osvi.dwMajorVersion > 4) || ( (osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion > 0) ) ); return(bIsWindows98orLater); #else return(0); #endif } /* * Windows only: Check version of Windows that are running on * * returns: 1 Version is NT4.0 or better * 0 Version is Win95/98 or something else not supported * */ int util_check_version_winNT (void) { #ifdef WIN32 OSVERSIONINFO osvi; BOOL bIsWindowsNTorLater = FALSE; osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx (&osvi); bIsWindowsNTorLater = (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) && (osvi.dwMajorVersion >= 4); return(bIsWindowsNTorLater); #else return(0); #endif } labrea-2.5-stable-1.orig/src/pcaputil.c0100644000550600055060000000625007730434533017025 0ustar tonontonon/* * Pcaputil.c * * Copyright (c) 2001, 2002 Dug Song * All rights reserved, all wrongs reversed. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The names of the authors and copyright holders may not be used to * endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $Id: pcaputil.c,v 1.2 2003/09/12 21:23:39 lorgor Exp $ */ #include "config.h" #ifndef WIN32 #include #ifdef HAVE_SYS_IOCTL_H #include #endif #endif #include #include #include #include #include "labrea.h" #include "utils.h" #include "pcaputil.h" pcap_t * pcap_open(char *device) { char ebuf[PCAP_ERRBUF_SIZE]; pcap_t *pcap; if (device == NULL) { if ((device = pcap_lookupdev(ebuf)) == NULL) return (NULL); } if ((pcap = pcap_open_live(device, 31337, 1, PCAP_TIMEOUT, ebuf)) == NULL) return (NULL); #ifdef BSD { int n = 1; if (ioctl(pcap_fileno(pcap), BIOCIMMEDIATE, &n) < 0) { pcap_close(pcap); return (NULL); } } #endif return (pcap); } int pcap_dloff(pcap_t *pd) { int i; i = pcap_datalink(pd); switch (i) { case DLT_EN10MB: i = 14; break; case DLT_IEEE802: i = 22; break; case DLT_FDDI: i = 21; break; #ifdef DLT_LOOP case DLT_LOOP: #endif case DLT_NULL: i = 4; break; default: i = -1; break; } return (i); } int pcap_filter(pcap_t *pcap, const char *fmt, ...) { struct bpf_program fcode; char buf[BUFSIZ]; va_list ap; va_start(ap, fmt); vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); #ifdef notyet pcap_freecode(&pcap->fcode); #endif if (pcap_compile(pcap, &fcode, buf, 1, 0) < 0) return (-1); if (pcap_setfilter(pcap, &fcode) == -1) return (-1); return (0); } void pcap_stat (pcap_t *pd) { struct pcap_stat stat; /* show 'em some stats... */ if (pd != NULL) { if (pcap_stats(pd, &stat) >= 0) { util_print(NORMAL, "%d/%d packets (received/dropped) by filter", stat.ps_recv, stat.ps_drop); } } } labrea-2.5-stable-1.orig/src/bget.c0100644000550600055060000014332307727437047016141 0ustar tonontonon/* B G E T Buffer allocator Designed and implemented in April of 1972 by John Walker, based on the Case Algol OPRO$ algorithm implemented in 1966. Reimplemented in 1975 by John Walker for the Interdata 70. Reimplemented in 1977 by John Walker for the Marinchip 9900. Reimplemented in 1982 by Duff Kurland for the Intel 8080. Portable C version implemented in September of 1990 by an older, wiser instance of the original implementor. Souped up and/or weighed down slightly shortly thereafter by Greg Lutz. AMIX edition, including the new compaction call-back option, prepared by John Walker in July of 1992. Bug in built-in test program fixed, ANSI compiler warnings eradicated, buffer pool validator implemented, and guaranteed repeatable test added by John Walker in October of 1995. This program is in the public domain. 1. This is the book of the generations of Adam. In the day that God created man, in the likeness of God made he him; 2. Male and female created he them; and blessed them, and called their name Adam, in the day when they were created. 3. And Adam lived an hundred and thirty years, and begat a son in his own likeness, and after his image; and called his name Seth: 4. And the days of Adam after he had begotten Seth were eight hundred years: and he begat sons and daughters: 5. And all the days that Adam lived were nine hundred and thirty years: and he died. 6. And Seth lived an hundred and five years, and begat Enos: 7. And Seth lived after he begat Enos eight hundred and seven years, and begat sons and daughters: 8. And all the days of Seth were nine hundred and twelve years: and he died. 9. And Enos lived ninety years, and begat Cainan: 10. And Enos lived after he begat Cainan eight hundred and fifteen years, and begat sons and daughters: 11. And all the days of Enos were nine hundred and five years: and he died. 12. And Cainan lived seventy years and begat Mahalaleel: 13. And Cainan lived after he begat Mahalaleel eight hundred and forty years, and begat sons and daughters: 14. And all the days of Cainan were nine hundred and ten years: and he died. 15. And Mahalaleel lived sixty and five years, and begat Jared: 16. And Mahalaleel lived after he begat Jared eight hundred and thirty years, and begat sons and daughters: 17. And all the days of Mahalaleel were eight hundred ninety and five years: and he died. 18. And Jared lived an hundred sixty and two years, and he begat Enoch: 19. And Jared lived after he begat Enoch eight hundred years, and begat sons and daughters: 20. And all the days of Jared were nine hundred sixty and two years: and he died. 21. And Enoch lived sixty and five years, and begat Methuselah: 22. And Enoch walked with God after he begat Methuselah three hundred years, and begat sons and daughters: 23. And all the days of Enoch were three hundred sixty and five years: 24. And Enoch walked with God: and he was not; for God took him. 25. And Methuselah lived an hundred eighty and seven years, and begat Lamech. 26. And Methuselah lived after he begat Lamech seven hundred eighty and two years, and begat sons and daughters: 27. And all the days of Methuselah were nine hundred sixty and nine years: and he died. 28. And Lamech lived an hundred eighty and two years, and begat a son: 29. And he called his name Noah, saying, This same shall comfort us concerning our work and toil of our hands, because of the ground which the LORD hath cursed. 30. And Lamech lived after he begat Noah five hundred ninety and five years, and begat sons and daughters: 31. And all the days of Lamech were seven hundred seventy and seven years: and he died. 32. And Noah was five hundred years old: and Noah begat Shem, Ham, and Japheth. And buffers begat buffers, and links begat links, and buffer pools begat links to chains of buffer pools containing buffers, and lo the buffers and links and pools of buffers and pools of links to chains of pools of buffers were fruitful and they multiplied and the Operating System looked down upon them and said that it was Good. INTRODUCTION ============ BGET is a comprehensive memory allocation package which is easily configured to the needs of an application. BGET is efficient in both the time needed to allocate and release buffers and in the memory overhead required for buffer pool management. It automatically consolidates contiguous space to minimise fragmentation. BGET is configured by compile-time definitions, Major options include: * A built-in test program to exercise BGET and demonstrate how the various functions are used. * Allocation by either the "first fit" or "best fit" method. * Wiping buffers at release time to catch code which references previously released storage. * Built-in routines to dump individual buffers or the entire buffer pool. * Retrieval of allocation and pool size statistics. * Quantisation of buffer sizes to a power of two to satisfy hardware alignment constraints. * Automatic pool compaction, growth, and shrinkage by means of call-backs to user defined functions. Applications of BGET can range from storage management in ROM-based embedded programs to providing the framework upon which a multitasking system incorporating garbage collection is constructed. BGET incorporates extensive internal consistency checking using the mechanism; all these checks can be turned off by compiling with NDEBUG defined, yielding a version of BGET with minimal size and maximum speed. The basic algorithm underlying BGET has withstood the test of time; more than 25 years have passed since the first implementation of this code. And yet, it is substantially more efficient than the native allocation schemes of many operating systems: the Macintosh and Microsoft Windows to name two, on which programs have obtained substantial speed-ups by layering BGET as an application level memory manager atop the underlying system's. BGET has been implemented on the largest mainframes and the lowest of microprocessors. It has served as the core for multitasking operating systems, multi-thread applications, embedded software in data network switching processors, and a host of C programs. And while it has accreted flexibility and additional options over the years, it remains fast, memory efficient, portable, and easy to integrate into your program. BGET IMPLEMENTATION ASSUMPTIONS =============================== BGET is written in as portable a dialect of C as possible. The only fundamental assumption about the underlying hardware architecture is that memory is allocated is a linear array which can be addressed as a vector of C "char" objects. On segmented address space architectures, this generally means that BGET should be used to allocate storage within a single segment (although some compilers simulate linear address spaces on segmented architectures). On segmented architectures, then, BGET buffer pools may not be larger than a segment, but since BGET allows any number of separate buffer pools, there is no limit on the total storage which can be managed, only on the largest individual object which can be allocated. Machines with a linear address architecture, such as the VAX, 680x0, Sparc, MIPS, or the Intel 80386 and above in native mode, may use BGET without restriction. GETTING STARTED WITH BGET ========================= Although BGET can be configured in a multitude of fashions, there are three basic ways of working with BGET. The functions mentioned below are documented in the following section. Please excuse the forward references which are made in the interest of providing a roadmap to guide you to the BGET functions you're likely to need. Embedded Applications --------------------- Embedded applications typically have a fixed area of memory dedicated to buffer allocation (often in a separate RAM address space distinct from the ROM that contains the executable code). To use BGET in such an environment, simply call bpool() with the start address and length of the buffer pool area in RAM, then allocate buffers with bget() and release them with brel(). Embedded applications with very limited RAM but abundant CPU speed may benefit by configuring BGET for BestFit allocation (which is usually not worth it in other environments). Malloc() Emulation ------------------ If the C library malloc() function is too slow, not present in your development environment (for example, an a native Windows or Macintosh program), or otherwise unsuitable, you can replace it with BGET. Initially define a buffer pool of an appropriate size with bpool()--usually obtained by making a call to the operating system's low-level memory allocator. Then allocate buffers with bget(), bgetz(), and bgetr() (the last two permit the allocation of buffers initialised to zero and [inefficient] re-allocation of existing buffers for compatibility with C library functions). Release buffers by calling brel(). If a buffer allocation request fails, obtain more storage from the underlying operating system, add it to the buffer pool by another call to bpool(), and continue execution. Automatic Storage Management ---------------------------- You can use BGET as your application's native memory manager and implement automatic storage pool expansion, contraction, and optionally application-specific memory compaction by compiling BGET with the BECtl variable defined, then calling bectl() and supplying functions for storage compaction, acquisition, and release, as well as a standard pool expansion increment. All of these functions are optional (although it doesn't make much sense to provide a release function without an acquisition function, does it?). Once the call-back functions have been defined with bectl(), you simply use bget() and brel() to allocate and release storage as before. You can supply an initial buffer pool with bpool() or rely on automatic allocation to acquire the entire pool. When a call on bget() cannot be satisfied, BGET first checks if a compaction function has been supplied. If so, it is called (with the space required to satisfy the allocation request and a sequence number to allow the compaction routine to be called successively without looping). If the compaction function is able to free any storage (it needn't know whether the storage it freed was adequate) it should return a nonzero value, whereupon BGET will retry the allocation request and, if it fails again, call the compaction function again with the next-higher sequence number. If the compaction function returns zero, indicating failure to free space, or no compaction function is defined, BGET next tests whether a non-NULL allocation function was supplied to bectl(). If so, that function is called with an argument indicating how many bytes of additional space are required. This will be the standard pool expansion increment supplied in the call to bectl() unless the original bget() call requested a buffer larger than this; buffers larger than the standard pool block can be managed "off the books" by BGET in this mode. If the allocation function succeeds in obtaining the storage, it returns a pointer to the new block and BGET expands the buffer pool; if it fails, the allocation request fails and returns NULL to the caller. If a non-NULL release function is supplied, expansion blocks which become totally empty are released to the global free pool by passing their addresses to the release function. Equipped with appropriate allocation, release, and compaction functions, BGET can be used as part of very sophisticated memory management strategies, including garbage collection. (Note, however, that BGET is *not* a garbage collector by itself, and that developing such a system requires much additional logic and careful design of the application's memory allocation strategy.) BGET FUNCTION DESCRIPTIONS ========================== Functions implemented in this file (some are enabled by certain of the optional settings below): void bpool(void *buffer, bufsize len); Create a buffer pool of bytes, using the storage starting at . You can call bpool() subsequently to contribute additional storage to the overall buffer pool. void *bget(bufsize size); Allocate a buffer of bytes. The address of the buffer is returned, or NULL if insufficient memory was available to allocate the buffer. void *bgetz(bufsize size); Allocate a buffer of bytes and clear it to all zeroes. The address of the buffer is returned, or NULL if insufficient memory was available to allocate the buffer. void *bgetr(void *buffer, bufsize newsize); Reallocate a buffer previously allocated by bget(), changing its size to and preserving all existing data. NULL is returned if insufficient memory is available to reallocate the buffer, in which case the original buffer remains intact. void brel(void *buf); Return the buffer , previously allocated by bget(), to the free space pool. void bectl(int (*compact)(bufsize sizereq, int sequence), void *(*acquire)(bufsize size), void (*release)(void *buf), bufsize pool_incr); Expansion control: specify functions through which the package may compact storage (or take other appropriate action) when an allocation request fails, and optionally automatically acquire storage for expansion blocks when necessary, and release such blocks when they become empty. If is non-NULL, whenever a buffer allocation request fails, the function will be called with arguments specifying the number of bytes (total buffer size, including header overhead) required to satisfy the allocation request, and a sequence number indicating the number of consecutive calls on attempting to satisfy this allocation request. The sequence number is 1 for the first call on for a given allocation request, and increments on subsequent calls, permitting the function to take increasingly dire measures in an attempt to free up storage. If the function returns a nonzero value, the allocation attempt is re-tried. If returns 0 (as it must if it isn't able to release any space or add storage to the buffer pool), the allocation request fails, which can trigger automatic pool expansion if the argument is non-NULL. At the time the function is called, the state of the buffer allocator is identical to that at the moment the allocation request was made; consequently, the function may call brel(), bpool(), bstats(), and/or directly manipulate the buffer pool in any manner which would be valid were the application in control. This does not, however, relieve the function of the need to ensure that whatever actions it takes do not change things underneath the application that made the allocation request. For example, a function that released a buffer in the process of being reallocated with bgetr() would lead to disaster. Implementing a safe and effective mechanism requires careful design of an application's memory architecture, and cannot generally be easily retrofitted into existing code. If is non-NULL, that function will be called whenever an allocation request fails. If the function succeeds in allocating the requested space and returns a pointer to the new area, allocation will proceed using the expanded buffer pool. If cannot obtain the requested space, it should return NULL and the entire allocation process will fail. specifies the normal expansion block size. Providing an function will cause subsequent bget() requests for buffers too large to be managed in the linked-block scheme (in other words, larger than minus the buffer overhead) to be satisfied directly by calls to the function. Automatic release of empty pool blocks will occur only if all pool blocks in the system are the size given by . void bstats(bufsize *curalloc, bufsize *totfree, bufsize *maxfree, long *nget, long *nrel); The amount of space currently allocated is stored into the variable pointed to by . The total free space (sum of all free blocks in the pool) is stored into the variable pointed to by , and the size of the largest single block in the free space pool is stored into the variable pointed to by . The variables pointed to by and are filled, respectively, with the number of successful (non-NULL return) bget() calls and the number of brel() calls. void bstatse(bufsize *pool_incr, long *npool, long *npget, long *nprel, long *ndget, long *ndrel); Extended statistics: The expansion block size will be stored into the variable pointed to by , or the negative thereof if automatic expansion block releases are disabled. The number of currently active pool blocks will be stored into the variable pointed to by . The variables pointed to by and will be filled with, respectively, the number of expansion block acquisitions and releases which have occurred. The variables pointed to by and will be filled with the number of bget() and brel() calls, respectively, managed through blocks directly allocated by the acquisition and release functions. void bufdump(void *buf); The buffer pointed to by is dumped on standard output. void bpoold(void *pool, int dumpalloc, int dumpfree); All buffers in the buffer pool , previously initialised by a call on bpool(), are listed in ascending memory address order. If is nonzero, the contents of allocated buffers are dumped; if is nonzero, the contents of free blocks are dumped. int bpoolv(void *pool); The named buffer pool, previously initialised by a call on bpool(), is validated for bad pointers, overwritten data, etc. If compiled with NDEBUG not defined, any error generates an assertion failure. Otherwise 1 is returned if the pool is valid, 0 if an error is found. BGET CONFIGURATION ================== */ #if 0 #define TestProg 20000 /* Generate built-in test program if defined. The value specifies how many buffer allocation attempts the test program should make. */ #endif #define SizeQuant 4 /* Buffer allocation size quantum: all buffers allocated are a multiple of this size. This MUST be a power of two. */ #if 0 #define BufDump 1 /* Define this symbol to enable the bpoold() function which dumps the buffers in a buffer pool. */ #define BufValid 1 /* Define this symbol to enable the bpoolv() function for validating a buffer pool. */ #define DumpData 1 /* Define this symbol to enable the bufdump() function which allows dumping the contents of an allocated or free buffer. */ #define BufStats 1 /* Define this symbol to enable the bstats() function which calculates the total free space in the buffer pool, the largest available buffer, and the total space currently allocated. */ #define FreeWipe 1 /* Wipe free buffers to a guaranteed pattern of garbage to trip up miscreants who attempt to use pointers into released buffers. */ #define BestFit 1 /* Use a best fit algorithm when searching for space for an allocation request. This uses memory more efficiently, but allocation will be much slower. */ #endif #define BECtl 1 /* Define this symbol to enable the bectl() function for automatic pool space control. */ #include #ifdef lint #define NDEBUG /* Exits in asserts confuse lint */ /* LINTLIBRARY */ /* Don't complain about def, no ref */ extern char *sprintf(); /* Sun includes don't define sprintf */ #endif #include #include #ifdef BufDump /* BufDump implies DumpData */ #ifndef DumpData #define DumpData 1 #endif #endif #ifdef DumpData #include #endif /* Declare the interface, including the requested buffer size type, bufsize. */ #include "bget.h" #define MemSize int /* Type for size arguments to memxxx() functions such as memcmp(). */ /* Queue links */ struct qlinks { struct bfhead *flink; /* Forward link */ struct bfhead *blink; /* Backward link */ }; /* Header in allocated and free buffers */ struct bhead { bufsize prevfree; /* Relative link back to previous free buffer in memory or 0 if previous buffer is allocated. */ bufsize bsize; /* Buffer size: positive if free, negative if allocated. */ }; #define BH(p) ((struct bhead *) (p)) /* Header in directly allocated buffers (by acqfcn) */ struct bdhead { bufsize tsize; /* Total size, including overhead */ struct bhead bh; /* Common header */ }; #define BDH(p) ((struct bdhead *) (p)) /* Header in free buffers */ struct bfhead { struct bhead bh; /* Common allocated/free header */ struct qlinks ql; /* Links on free list */ }; #define BFH(p) ((struct bfhead *) (p)) static struct bfhead freelist = { /* List of free buffers */ {0, 0}, {&freelist, &freelist} }; #ifdef BufStats static bufsize totalloc = 0; /* Total space currently allocated */ static long numget = 0, numrel = 0; /* Number of bget() and brel() calls */ #ifdef BECtl static long numpblk = 0; /* Number of pool blocks */ static long numpget = 0, numprel = 0; /* Number of block gets and rels */ static long numdget = 0, numdrel = 0; /* Number of direct gets and rels */ #endif /* BECtl */ #endif /* BufStats */ #ifdef BECtl /* Automatic expansion block management functions */ static int (*compfcn) _((bufsize sizereq, int sequence)) = NULL; static void *(*acqfcn) _((bufsize size)) = NULL; static void (*relfcn) _((void *buf)) = NULL; static bufsize exp_incr = 0; /* Expansion block size */ static bufsize pool_len = 0; /* 0: no bpool calls have been made -1: not all pool blocks are the same size >0: (common) block size for all bpool calls made so far */ #endif /* Minimum allocation quantum: */ #define QLSize (sizeof(struct qlinks)) #define SizeQ ((SizeQuant > QLSize) ? SizeQuant : QLSize) #define V (void) /* To denote unwanted returned values */ /* End sentinel: value placed in bsize field of dummy block delimiting end of pool block. The most negative number which will fit in a bufsize, defined in a way that the compiler will accept. */ #define ESent ((bufsize) (-(((1L << (sizeof(bufsize) * 8 - 2)) - 1) * 2) - 2)) /* BGET -- Allocate a buffer. */ void *bget(requested_size) bufsize requested_size; { bufsize size = requested_size; struct bfhead *b; #ifdef BestFit struct bfhead *best; #endif void *buf; #ifdef BECtl int compactseq = 0; #endif assert(size > 0); if (size < SizeQ) { /* Need at least room for the */ size = SizeQ; /* queue links. */ } #ifdef SizeQuant #if SizeQuant > 1 size = (size + (SizeQuant - 1)) & (~(SizeQuant - 1)); #endif #endif size += sizeof(struct bhead); /* Add overhead in allocated buffer to size required. */ #ifdef BECtl /* If a compact function was provided in the call to bectl(), wrap a loop around the allocation process to allow compaction to intervene in case we don't find a suitable buffer in the chain. */ while (1) { #endif b = freelist.ql.flink; #ifdef BestFit best = &freelist; #endif /* Scan the free list searching for the first buffer big enough to hold the requested size buffer. */ #ifdef BestFit while (b != &freelist) { if (b->bh.bsize >= size) { if ((best == &freelist) || (b->bh.bsize < best->bh.bsize)) { best = b; } } b = b->ql.flink; /* Link to next buffer */ } b = best; #endif /* BestFit */ while (b != &freelist) { if ((bufsize) b->bh.bsize >= size) { /* Buffer is big enough to satisfy the request. Allocate it to the caller. We must decide whether the buffer is large enough to split into the part given to the caller and a free buffer that remains on the free list, or whether the entire buffer should be removed from the free list and given to the caller in its entirety. We only split the buffer if enough room remains for a header plus the minimum quantum of allocation. */ if ((b->bh.bsize - size) > (SizeQ + (sizeof(struct bhead)))) { struct bhead *ba, *bn; ba = BH(((char *) b) + (b->bh.bsize - size)); bn = BH(((char *) ba) + size); assert(bn->prevfree == b->bh.bsize); /* Subtract size from length of free block. */ b->bh.bsize -= size; /* Link allocated buffer to the previous free buffer. */ ba->prevfree = b->bh.bsize; /* Plug negative size into user buffer. */ ba->bsize = -(bufsize) size; /* Mark buffer after this one not preceded by free block. */ bn->prevfree = 0; #ifdef BufStats totalloc += size; numget++; /* Increment number of bget() calls */ #endif buf = (void *) ((((char *) ba) + sizeof(struct bhead))); return buf; } else { struct bhead *ba; ba = BH(((char *) b) + b->bh.bsize); assert(ba->prevfree == b->bh.bsize); /* The buffer isn't big enough to split. Give the whole shebang to the caller and remove it from the free list. */ assert(b->ql.blink->ql.flink == b); assert(b->ql.flink->ql.blink == b); b->ql.blink->ql.flink = b->ql.flink; b->ql.flink->ql.blink = b->ql.blink; #ifdef BufStats totalloc += b->bh.bsize; numget++; /* Increment number of bget() calls */ #endif /* Negate size to mark buffer allocated. */ b->bh.bsize = -(b->bh.bsize); /* Zero the back pointer in the next buffer in memory to indicate that this buffer is allocated. */ ba->prevfree = 0; /* Give user buffer starting at queue links. */ buf = (void *) &(b->ql); return buf; } } b = b->ql.flink; /* Link to next buffer */ } #ifdef BECtl /* We failed to find a buffer. If there's a compact function defined, notify it of the size requested. If it returns TRUE, try the allocation again. */ if ((compfcn == NULL) || (!(*compfcn)(size, ++compactseq))) { break; } } /* No buffer available with requested size free. */ /* Don't give up yet -- look in the reserve supply. */ if (acqfcn != NULL) { if (size > exp_incr - sizeof(struct bhead)) { /* Request is too large to fit in a single expansion block. Try to satisy it by a direct buffer acquisition. */ struct bdhead *bdh; size += sizeof(struct bdhead) - sizeof(struct bhead); if ((bdh = BDH((*acqfcn)((bufsize) size))) != NULL) { /* Mark the buffer special by setting the size field of its header to zero. */ bdh->bh.bsize = 0; bdh->bh.prevfree = 0; bdh->tsize = size; #ifdef BufStats totalloc += size; numget++; /* Increment number of bget() calls */ numdget++; /* Direct bget() call count */ #endif buf = (void *) (bdh + 1); return buf; } } else { /* Try to obtain a new expansion block */ void *newpool; if ((newpool = (*acqfcn)((bufsize) exp_incr)) != NULL) { bpool(newpool, exp_incr); buf = bget(requested_size); /* This can't, I say, can't get into a loop. */ return buf; } } } /* Still no buffer available */ #endif /* BECtl */ return NULL; } /* BGETZ -- Allocate a buffer and clear its contents to zero. We clear the entire contents of the buffer to zero, not just the region requested by the caller. */ void *bgetz(size) bufsize size; { char *buf = (char *) bget(size); if (buf != NULL) { struct bhead *b; bufsize rsize; b = BH(buf - sizeof(struct bhead)); rsize = -(b->bsize); if (rsize == 0) { struct bdhead *bd; bd = BDH(buf - sizeof(struct bdhead)); rsize = bd->tsize - sizeof(struct bdhead); } else { rsize -= sizeof(struct bhead); } assert(rsize >= size); V memset(buf, 0, (MemSize) rsize); } return ((void *) buf); } /* BGETR -- Reallocate a buffer. This is a minimal implementation, simply in terms of brel() and bget(). It could be enhanced to allow the buffer to grow into adjacent free blocks and to avoid moving data unnecessarily. */ void *bgetr(buf, size) void *buf; bufsize size; { void *nbuf; bufsize osize; /* Old size of buffer */ struct bhead *b; if ((nbuf = bget(size)) == NULL) { /* Acquire new buffer */ return NULL; } if (buf == NULL) { return nbuf; } b = BH(((char *) buf) - sizeof(struct bhead)); osize = -b->bsize; #ifdef BECtl if (osize == 0) { /* Buffer acquired directly through acqfcn. */ struct bdhead *bd; bd = BDH(((char *) buf) - sizeof(struct bdhead)); osize = bd->tsize - sizeof(struct bdhead); } else #endif osize -= sizeof(struct bhead); assert(osize > 0); V memcpy((char *) nbuf, (char *) buf, /* Copy the data */ (MemSize) ((size < osize) ? size : osize)); brel(buf); return nbuf; } /* BREL -- Release a buffer. */ void brel(buf) void *buf; { struct bfhead *b, *bn; b = BFH(((char *) buf) - sizeof(struct bhead)); #ifdef BufStats numrel++; /* Increment number of brel() calls */ #endif assert(buf != NULL); #ifdef BECtl if (b->bh.bsize == 0) { /* Directly-acquired buffer? */ struct bdhead *bdh; bdh = BDH(((char *) buf) - sizeof(struct bdhead)); assert(b->bh.prevfree == 0); #ifdef BufStats totalloc -= bdh->tsize; assert(totalloc >= 0); numdrel++; /* Number of direct releases */ #endif /* BufStats */ #ifdef FreeWipe V memset((char *) buf, 0x55, (MemSize) (bdh->tsize - sizeof(struct bdhead))); #endif /* FreeWipe */ assert(relfcn != NULL); (*relfcn)((void *) bdh); /* Release it directly. */ return; } #endif /* BECtl */ /* Buffer size must be negative, indicating that the buffer is allocated. */ if (b->bh.bsize >= 0) { bn = NULL; } assert(b->bh.bsize < 0); /* Back pointer in next buffer must be zero, indicating the same thing: */ assert(BH((char *) b - b->bh.bsize)->prevfree == 0); #ifdef BufStats totalloc += b->bh.bsize; assert(totalloc >= 0); #endif /* If the back link is nonzero, the previous buffer is free. */ if (b->bh.prevfree != 0) { /* The previous buffer is free. Consolidate this buffer with it by adding the length of this buffer to the previous free buffer. Note that we subtract the size in the buffer being released, since it's negative to indicate that the buffer is allocated. */ register bufsize size = b->bh.bsize; /* Make the previous buffer the one we're working on. */ assert(BH((char *) b - b->bh.prevfree)->bsize == b->bh.prevfree); b = BFH(((char *) b) - b->bh.prevfree); b->bh.bsize -= size; } else { /* The previous buffer isn't allocated. Insert this buffer on the free list as an isolated free block. */ assert(freelist.ql.blink->ql.flink == &freelist); assert(freelist.ql.flink->ql.blink == &freelist); b->ql.flink = &freelist; b->ql.blink = freelist.ql.blink; freelist.ql.blink = b; b->ql.blink->ql.flink = b; b->bh.bsize = -b->bh.bsize; } /* Now we look at the next buffer in memory, located by advancing from the start of this buffer by its size, to see if that buffer is free. If it is, we combine this buffer with the next one in memory, dechaining the second buffer from the free list. */ bn = BFH(((char *) b) + b->bh.bsize); if (bn->bh.bsize > 0) { /* The buffer is free. Remove it from the free list and add its size to that of our buffer. */ assert(BH((char *) bn + bn->bh.bsize)->prevfree == bn->bh.bsize); assert(bn->ql.blink->ql.flink == bn); assert(bn->ql.flink->ql.blink == bn); bn->ql.blink->ql.flink = bn->ql.flink; bn->ql.flink->ql.blink = bn->ql.blink; b->bh.bsize += bn->bh.bsize; /* Finally, advance to the buffer that follows the newly consolidated free block. We must set its backpointer to the head of the consolidated free block. We know the next block must be an allocated block because the process of recombination guarantees that two free blocks will never be contiguous in memory. */ bn = BFH(((char *) b) + b->bh.bsize); } #ifdef FreeWipe V memset(((char *) b) + sizeof(struct bfhead), 0x55, (MemSize) (b->bh.bsize - sizeof(struct bfhead))); #endif assert(bn->bh.bsize < 0); /* The next buffer is allocated. Set the backpointer in it to point to this buffer; the previous free buffer in memory. */ bn->bh.prevfree = b->bh.bsize; #ifdef BECtl /* If a block-release function is defined, and this free buffer constitutes the entire block, release it. Note that pool_len is defined in such a way that the test will fail unless all pool blocks are the same size. */ if (relfcn != NULL && ((bufsize) b->bh.bsize) == (pool_len - sizeof(struct bhead))) { assert(b->bh.prevfree == 0); assert(BH((char *) b + b->bh.bsize)->bsize == ESent); assert(BH((char *) b + b->bh.bsize)->prevfree == b->bh.bsize); /* Unlink the buffer from the free list */ b->ql.blink->ql.flink = b->ql.flink; b->ql.flink->ql.blink = b->ql.blink; (*relfcn)(b); #ifdef BufStats numprel++; /* Nr of expansion block releases */ numpblk--; /* Total number of blocks */ assert(numpblk == numpget - numprel); #endif /* BufStats */ } #endif /* BECtl */ } #ifdef BECtl /* BECTL -- Establish automatic pool expansion control */ void bectl(compact, acquire, release, pool_incr) int (*compact) _((bufsize sizereq, int sequence)); void *(*acquire) _((bufsize size)); void (*release) _((void *buf)); bufsize pool_incr; { compfcn = compact; acqfcn = acquire; relfcn = release; exp_incr = pool_incr; } #endif /* BPOOL -- Add a region of memory to the buffer pool. */ void bpool(buf, len) void *buf; bufsize len; { struct bfhead *b = BFH(buf); struct bhead *bn; #ifdef SizeQuant len &= ~(SizeQuant - 1); #endif #ifdef BECtl if (pool_len == 0) { pool_len = len; } else if (len != pool_len) { pool_len = -1; } #ifdef BufStats numpget++; /* Number of block acquisitions */ numpblk++; /* Number of blocks total */ assert(numpblk == numpget - numprel); #endif /* BufStats */ #endif /* BECtl */ /* Since the block is initially occupied by a single free buffer, it had better not be (much) larger than the largest buffer whose size we can store in bhead.bsize. */ assert(len - sizeof(struct bhead) <= -((bufsize) ESent + 1)); /* Clear the backpointer at the start of the block to indicate that there is no free block prior to this one. That blocks recombination when the first block in memory is released. */ b->bh.prevfree = 0; /* Chain the new block to the free list. */ assert(freelist.ql.blink->ql.flink == &freelist); assert(freelist.ql.flink->ql.blink == &freelist); b->ql.flink = &freelist; b->ql.blink = freelist.ql.blink; freelist.ql.blink = b; b->ql.blink->ql.flink = b; /* Create a dummy allocated buffer at the end of the pool. This dummy buffer is seen when a buffer at the end of the pool is released and blocks recombination of the last buffer with the dummy buffer at the end. The length in the dummy buffer is set to the largest negative number to denote the end of the pool for diagnostic routines (this specific value is not counted on by the actual allocation and release functions). */ len -= sizeof(struct bhead); b->bh.bsize = (bufsize) len; #ifdef FreeWipe V memset(((char *) b) + sizeof(struct bfhead), 0x55, (MemSize) (len - sizeof(struct bfhead))); #endif bn = BH(((char *) b) + len); bn->prevfree = (bufsize) len; /* Definition of ESent assumes two's complement! */ assert((~0) == -1); bn->bsize = ESent; } #ifdef BufStats /* BSTATS -- Return buffer allocation free space statistics. */ void bstats(curalloc, totfree, maxfree, nget, nrel) bufsize *curalloc, *totfree, *maxfree; long *nget, *nrel; { struct bfhead *b = freelist.ql.flink; *nget = numget; *nrel = numrel; *curalloc = totalloc; *totfree = 0; *maxfree = -1; while (b != &freelist) { assert(b->bh.bsize > 0); *totfree += b->bh.bsize; if (b->bh.bsize > *maxfree) { *maxfree = b->bh.bsize; } b = b->ql.flink; /* Link to next buffer */ } } #ifdef BECtl /* BSTATSE -- Return extended statistics */ void bstatse(pool_incr, npool, npget, nprel, ndget, ndrel) bufsize *pool_incr; long *npool, *npget, *nprel, *ndget, *ndrel; { *pool_incr = (pool_len < 0) ? -exp_incr : exp_incr; *npool = numpblk; *npget = numpget; *nprel = numprel; *ndget = numdget; *ndrel = numdrel; } #endif /* BECtl */ #endif /* BufStats */ #ifdef DumpData /* BUFDUMP -- Dump the data in a buffer. This is called with the user data pointer, and backs up to the buffer header. It will dump either a free block or an allocated one. */ void bufdump(buf) void *buf; { struct bfhead *b; unsigned char *bdump; bufsize bdlen; b = BFH(((char *) buf) - sizeof(struct bhead)); assert(b->bh.bsize != 0); if (b->bh.bsize < 0) { bdump = (unsigned char *) buf; bdlen = (-b->bh.bsize) - sizeof(struct bhead); } else { bdump = (unsigned char *) (((char *) b) + sizeof(struct bfhead)); bdlen = b->bh.bsize - sizeof(struct bfhead); } while (bdlen > 0) { int i, dupes = 0; bufsize l = bdlen; char bhex[50], bascii[20]; if (l > 16) { l = 16; } for (i = 0; i < l; i++) { V sprintf(bhex + i * 3, "%02X ", bdump[i]); bascii[i] = isprint(bdump[i]) ? bdump[i] : ' '; } bascii[i] = 0; V printf("%-48s %s\n", bhex, bascii); bdump += l; bdlen -= l; while ((bdlen > 16) && (memcmp((char *) (bdump - 16), (char *) bdump, 16) == 0)) { dupes++; bdump += 16; bdlen -= 16; } if (dupes > 1) { V printf( " (%d lines [%d bytes] identical to above line skipped)\n", dupes, dupes * 16); } else if (dupes == 1) { bdump -= 16; bdlen += 16; } } } #endif #ifdef BufDump /* BPOOLD -- Dump a buffer pool. The buffer headers are always listed. If DUMPALLOC is nonzero, the contents of allocated buffers are dumped. If DUMPFREE is nonzero, free blocks are dumped as well. If FreeWipe checking is enabled, free blocks which have been clobbered will always be dumped. */ void bpoold(buf, dumpalloc, dumpfree) void *buf; int dumpalloc, dumpfree; { struct bfhead *b = BFH(buf); while (b->bh.bsize != ESent) { bufsize bs = b->bh.bsize; if (bs < 0) { bs = -bs; V printf("Allocated buffer: size %6ld bytes.\n", (long) bs); if (dumpalloc) { bufdump((void *) (((char *) b) + sizeof(struct bhead))); } } else { char *lerr = ""; assert(bs > 0); if ((b->ql.blink->ql.flink != b) || (b->ql.flink->ql.blink != b)) { lerr = " (Bad free list links)"; } V printf("Free block: size %6ld bytes.%s\n", (long) bs, lerr); #ifdef FreeWipe lerr = ((char *) b) + sizeof(struct bfhead); if ((bs > sizeof(struct bfhead)) && ((*lerr != 0x55) || (memcmp(lerr, lerr + 1, (MemSize) (bs - (sizeof(struct bfhead) + 1))) != 0))) { V printf( "(Contents of above free block have been overstored.)\n"); bufdump((void *) (((char *) b) + sizeof(struct bhead))); } else #endif if (dumpfree) { bufdump((void *) (((char *) b) + sizeof(struct bhead))); } } b = BFH(((char *) b) + bs); } } #endif /* BufDump */ #ifdef BufValid /* BPOOLV -- Validate a buffer pool. If NDEBUG isn't defined, any error generates an assertion failure. */ int bpoolv(buf) void *buf; { struct bfhead *b = BFH(buf); while (b->bh.bsize != ESent) { bufsize bs = b->bh.bsize; if (bs < 0) { bs = -bs; } else { char *lerr = ""; assert(bs > 0); if (bs <= 0) { return 0; } if ((b->ql.blink->ql.flink != b) || (b->ql.flink->ql.blink != b)) { V printf("Free block: size %6ld bytes. (Bad free list links)\n", (long) bs); assert(0); return 0; } #ifdef FreeWipe lerr = ((char *) b) + sizeof(struct bfhead); if ((bs > sizeof(struct bfhead)) && ((*lerr != 0x55) || (memcmp(lerr, lerr + 1, (MemSize) (bs - (sizeof(struct bfhead) + 1))) != 0))) { V printf( "(Contents of above free block have been overstored.)\n"); bufdump((void *) (((char *) b) + sizeof(struct bhead))); assert(0); return 0; } #endif } b = BFH(((char *) b) + bs); } return 1; } #endif /* BufValid */ /***********************\ * * * Built-in test program * * * \***********************/ #ifdef TestProg #define Repeatable 1 /* Repeatable pseudorandom sequence */ /* If Repeatable is not defined, a time-seeded pseudorandom sequence is generated, exercising BGET with a different pattern of calls on each run. */ #define OUR_RAND /* Use our own built-in version of rand() to guarantee the test is 100% repeatable. */ #ifdef BECtl #define PoolSize 300000 /* Test buffer pool size */ #else #define PoolSize 50000 /* Test buffer pool size */ #endif #define ExpIncr 32768 /* Test expansion block size */ #define CompactTries 10 /* Maximum tries at compacting */ #define dumpAlloc 0 /* Dump allocated buffers ? */ #define dumpFree 0 /* Dump free buffers ? */ #ifndef Repeatable extern long time(); #endif extern char *malloc(); extern int free _((char *)); static char *bchain = NULL; /* Our private buffer chain */ static char *bp = NULL; /* Our initial buffer pool */ #include #ifdef OUR_RAND static unsigned long int next = 1; /* Return next random integer */ int rand() { next = next * 1103515245L + 12345; return (unsigned int) (next / 65536L) % 32768L; } /* Set seed for random generator */ void srand(seed) unsigned int seed; { next = seed; } #endif /* STATS -- Edit statistics returned by bstats() or bstatse(). */ static void stats(when) char *when; { bufsize cural, totfree, maxfree; long nget, nfree; #ifdef BECtl bufsize pincr; long totblocks, npget, nprel, ndget, ndrel; #endif bstats(&cural, &totfree, &maxfree, &nget, &nfree); V printf( "%s: %ld gets, %ld releases. %ld in use, %ld free, largest = %ld\n", when, nget, nfree, (long) cural, (long) totfree, (long) maxfree); #ifdef BECtl bstatse(&pincr, &totblocks, &npget, &nprel, &ndget, &ndrel); V printf( " Blocks: size = %ld, %ld (%ld bytes) in use, %ld gets, %ld frees\n", (long)pincr, totblocks, pincr * totblocks, npget, nprel); V printf(" %ld direct gets, %ld direct frees\n", ndget, ndrel); #endif /* BECtl */ } #ifdef BECtl static int protect = 0; /* Disable compaction during bgetr() */ /* BCOMPACT -- Compaction call-back function. */ static int bcompact(bsize, seq) bufsize bsize; int seq; { #ifdef CompactTries char *bc = bchain; int i = rand() & 0x3; #ifdef COMPACTRACE V printf("Compaction requested. %ld bytes needed, sequence %d.\n", (long) bsize, seq); #endif if (protect || (seq > CompactTries)) { #ifdef COMPACTRACE V printf("Compaction gave up.\n"); #endif return 0; } /* Based on a random cast, release a random buffer in the list of allocated buffers. */ while (i > 0 && bc != NULL) { bc = *((char **) bc); i--; } if (bc != NULL) { char *fb; fb = *((char **) bc); if (fb != NULL) { *((char **) bc) = *((char **) fb); brel((void *) fb); return 1; } } #ifdef COMPACTRACE V printf("Compaction bailed out.\n"); #endif #endif /* CompactTries */ return 0; } /* BEXPAND -- Expand pool call-back function. */ static void *bexpand(size) bufsize size; { void *np = NULL; bufsize cural, totfree, maxfree; long nget, nfree; /* Don't expand beyond the total allocated size given by PoolSize. */ bstats(&cural, &totfree, &maxfree, &nget, &nfree); if (cural < PoolSize) { np = (void *) malloc((unsigned) size); } #ifdef EXPTRACE V printf("Expand pool by %ld -- %s.\n", (long) size, np == NULL ? "failed" : "succeeded"); #endif return np; } /* BSHRINK -- Shrink buffer pool call-back function. */ static void bshrink(buf) void *buf; { if (((char *) buf) == bp) { #ifdef EXPTRACE V printf("Initial pool released.\n"); #endif bp = NULL; } #ifdef EXPTRACE V printf("Shrink pool.\n"); #endif free((char *) buf); } #endif /* BECtl */ /* Restrict buffer requests to those large enough to contain our pointer and small enough for the CPU architecture. */ static bufsize blimit(bs) bufsize bs; { if (bs < sizeof(char *)) { bs = sizeof(char *); } /* This is written out in this ugly fashion because the cool expression in sizeof(int) that auto-configured to any length int befuddled some compilers. */ if (sizeof(int) == 2) { if (bs > 32767) { bs = 32767; } } else { if (bs > 200000) { bs = 200000; } } return bs; } int main() { int i; double x; /* Seed the random number generator. If Repeatable is defined, we always use the same seed. Otherwise, we seed from the clock to shake things up from run to run. */ #ifdef Repeatable V srand(1234); #else V srand((int) time((long *) NULL)); #endif /* Compute x such that pow(x, p) ranges between 1 and 4*ExpIncr as p ranges from 0 to ExpIncr-1, with a concentration in the lower numbers. */ x = 4.0 * ExpIncr; x = log(x); x = exp(log(4.0 * ExpIncr) / (ExpIncr - 1.0)); #ifdef BECtl bectl(bcompact, bexpand, bshrink, (bufsize) ExpIncr); bp = malloc(ExpIncr); assert(bp != NULL); bpool((void *) bp, (bufsize) ExpIncr); #else bp = malloc(PoolSize); assert(bp != NULL); bpool((void *) bp, (bufsize) PoolSize); #endif stats("Create pool"); V bpoolv((void *) bp); bpoold((void *) bp, dumpAlloc, dumpFree); for (i = 0; i < TestProg; i++) { char *cb; bufsize bs = pow(x, (double) (rand() & (ExpIncr - 1))); assert(bs <= (((bufsize) 4) * ExpIncr)); bs = blimit(bs); if (rand() & 0x400) { cb = (char *) bgetz(bs); } else { cb = (char *) bget(bs); } if (cb == NULL) { #ifdef EasyOut break; #else char *bc = bchain; if (bc != NULL) { char *fb; fb = *((char **) bc); if (fb != NULL) { *((char **) bc) = *((char **) fb); brel((void *) fb); } continue; } #endif } *((char **) cb) = (char *) bchain; bchain = cb; /* Based on a random cast, release a random buffer in the list of allocated buffers. */ if ((rand() & 0x10) == 0) { char *bc = bchain; int i = rand() & 0x3; while (i > 0 && bc != NULL) { bc = *((char **) bc); i--; } if (bc != NULL) { char *fb; fb = *((char **) bc); if (fb != NULL) { *((char **) bc) = *((char **) fb); brel((void *) fb); } } } /* Based on a random cast, reallocate a random buffer in the list to a random size */ if ((rand() & 0x20) == 0) { char *bc = bchain; int i = rand() & 0x3; while (i > 0 && bc != NULL) { bc = *((char **) bc); i--; } if (bc != NULL) { char *fb; fb = *((char **) bc); if (fb != NULL) { char *newb; bs = pow(x, (double) (rand() & (ExpIncr - 1))); bs = blimit(bs); #ifdef BECtl protect = 1; /* Protect against compaction */ #endif newb = (char *) bgetr((void *) fb, bs); #ifdef BECtl protect = 0; #endif if (newb != NULL) { *((char **) bc) = newb; } } } } } stats("\nAfter allocation"); if (bp != NULL) { V bpoolv((void *) bp); bpoold((void *) bp, dumpAlloc, dumpFree); } while (bchain != NULL) { char *buf = bchain; bchain = *((char **) buf); brel((void *) buf); } stats("\nAfter release"); #ifndef BECtl if (bp != NULL) { V bpoolv((void *) bp); bpoold((void *) bp, dumpAlloc, dumpFree); } #endif return 0; } #endif labrea-2.5-stable-1.orig/src/pkt.c0100644000550600055060000001616707730434533016012 0ustar tonontonon/* * pkt.c * * Copyright (c) 2001, 2002 Dug Song * All rights reserved, all wrongs reversed. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The names of the authors and copyright holders may not be used to * endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * * $Id: pkt.c,v 1.2 2003/09/12 21:23:39 lorgor Exp $ */ #include "config.h" #include #include #include #include "bget.h" #include "pkt.h" void pkt_init(int size) { bectl(NULL, malloc, free, sizeof(struct pkt) * size); } /* * Allocates new IP/ARP packet. * */ struct pkt * pkt_new(void) { struct pkt *pkt; if ((pkt = bget(sizeof(*pkt))) == NULL) return (NULL); pkt->pkt_data = pkt->pkt_buf + PKT_BUF_ALIGN; pkt->pkt_eth = (struct eth_hdr *)pkt->pkt_data; pkt->pkt_eth_data = pkt->pkt_data + ETH_HDR_LEN; pkt->pkt_ip_data = pkt->pkt_data + ETH_HDR_LEN + IP_HDR_LEN; pkt->pkt_tcp_data = NULL; pkt->pkt_end = pkt->pkt_ip_data; return (pkt); } struct pkt * pkt_dup(struct pkt *pkt) { struct pkt *new; off_t off; if ((new = bget(sizeof(*new))) == NULL) return (NULL); off = new->pkt_buf - pkt->pkt_buf; new->pkt_data = pkt->pkt_data + off; new->pkt_eth = (pkt->pkt_eth != NULL) ? (struct eth_hdr *)new->pkt_data : NULL; new->pkt_eth_data = (pkt->pkt_eth_data != NULL) ? pkt->pkt_eth_data + off : NULL; new->pkt_ip_data = (pkt->pkt_ip_data != NULL) ? pkt->pkt_ip_data + off : NULL; new->pkt_tcp_data = (pkt->pkt_tcp_data != NULL) ? pkt->pkt_tcp_data + off : NULL; memcpy(new->pkt_data, pkt->pkt_data, pkt->pkt_end - pkt->pkt_data); new->pkt_end = pkt->pkt_end + off; return (new); } /* * Validates the contents and length fields of a packet. * Progressively sets up ptrs to the various sub-structures. * * On return, some or all of the following ptrs will be initialized * depending type of pkt and which parts of the pkt are valid: * * pkt->pkt_data Beginning of packet * pkt->pkt_eth Ethernet hdr * pkt->pkt_ip IP (or ARP) hdr * pkt->pkt_ip_data ICMP or Tcp or Udp hdr * pkt->pkt_tcp_data ICMP msg or Tcp data * pkt->pkt_end End of packet * * See pkt.h for the details. */ void pkt_decorate(struct pkt *pkt) { u_char *p; int hl, len, off; pkt->pkt_data = pkt->pkt_buf + PKT_BUF_ALIGN; pkt->pkt_eth = NULL; pkt->pkt_ip = NULL; pkt->pkt_ip_data = NULL; pkt->pkt_tcp_data = NULL; p = pkt->pkt_data; if (p + ETH_HDR_LEN > pkt->pkt_end) return; /* Ignore pkt if not at least a complete ethernet hdr */ pkt->pkt_eth = (struct eth_hdr *)p; p += ETH_HDR_LEN; pkt->pkt_eth_data = p; switch (ntohs(pkt->pkt_eth->eth_type)){ case ETH_TYPE_IP: if (p + IP_HDR_LEN > pkt->pkt_end) /* Check if IP hdr too short */ return; break; case ETH_TYPE_ARP: if (p + ARP_HDR_LEN > pkt->pkt_end) /* Check if arp hdr too short */ return; pkt->pkt_arp = (struct arp_hdr *)p; p += ARP_HDR_LEN; /* Ensure arp is for Ethernet / IP */ if ((ntohs(pkt->pkt_arp->ar_hrd) != ARP_HRD_ETH) || (ntohs(pkt->pkt_arp->ar_pro) != ARP_PRO_IP) || (pkt->pkt_arp->ar_hln != ETH_ADDR_LEN) || (pkt->pkt_arp->ar_pln != IP_ADDR_LEN)) { pkt->pkt_arp = NULL; return; } pkt->pkt_arp_data = (struct arp_ethip *)p; if (p + ARP_ETHIP_LEN < pkt->pkt_end) pkt->pkt_end = p + ARP_ETHIP_LEN; return; /* break; */ default: return; } /* If IP header length is longer than packet length, stop. */ hl = pkt->pkt_ip->ip_hl << 2; if (p + hl > pkt->pkt_end) { pkt->pkt_ip = NULL; return; } /* If IP length is longer than packet length, stop. */ len = ntohs(pkt->pkt_ip->ip_len); if (p + len > pkt->pkt_end) return; /* If IP fragment, stop. */ off = ntohs(pkt->pkt_ip->ip_off); if ((off & IP_OFFMASK) != 0 || (off & IP_MF) != 0) return; pkt->pkt_end = p + len; p += hl; /* If transport layer header is longer than packet length, stop. */ switch (pkt->pkt_ip->ip_p) { case IP_PROTO_ICMP: hl = ICMP_HDR_LEN; break; case IP_PROTO_TCP: if (p + TCP_HDR_LEN > pkt->pkt_end) return; hl = ((struct tcp_hdr *)p)->th_off << 2; break; case IP_PROTO_UDP: hl = UDP_HDR_LEN; break; default: return; } if (p + hl > pkt->pkt_end) return; pkt->pkt_ip_data = p; p += hl; /* Check for transport layer data. */ switch (pkt->pkt_ip->ip_p) { case IP_PROTO_ICMP: pkt->pkt_icmp_msg = (union icmp_msg *)p; switch (pkt->pkt_icmp->icmp_type) { case ICMP_ECHO: case ICMP_ECHOREPLY: hl = sizeof(pkt->pkt_icmp_msg->echo); break; case ICMP_UNREACH: if (pkt->pkt_icmp->icmp_code == ICMP_UNREACH_NEEDFRAG) hl = sizeof(pkt->pkt_icmp_msg->needfrag); else hl = sizeof(pkt->pkt_icmp_msg->unreach); break; case ICMP_SRCQUENCH: case ICMP_REDIRECT: case ICMP_TIMEXCEED: case ICMP_PARAMPROB: hl = sizeof(pkt->pkt_icmp_msg->srcquench); break; case ICMP_RTRADVERT: hl = sizeof(pkt->pkt_icmp_msg->rtradvert); break; case ICMP_RTRSOLICIT: hl = sizeof(pkt->pkt_icmp_msg->rtrsolicit); break; case ICMP_TSTAMP: case ICMP_TSTAMPREPLY: hl = sizeof(pkt->pkt_icmp_msg->tstamp); break; case ICMP_INFO: case ICMP_INFOREPLY: case ICMP_DNS: hl = sizeof(pkt->pkt_icmp_msg->info); break; case ICMP_MASK: case ICMP_MASKREPLY: hl = sizeof(pkt->pkt_icmp_msg->mask); break; case ICMP_DNSREPLY: hl = sizeof(pkt->pkt_icmp_msg->dnsreply); break; default: hl = pkt->pkt_end - p + 1; break; } if (p + hl > pkt->pkt_end) pkt->pkt_icmp_msg = NULL; break; case IP_PROTO_TCP: if (p < pkt->pkt_end) pkt->pkt_tcp_data = p; break; case IP_PROTO_UDP: if (pkt->pkt_ip_data + ntohs(pkt->pkt_udp->uh_ulen) <= pkt->pkt_end) pkt->pkt_udp_data = p; break; } } void pkt_free(struct pkt *pkt) { brel(pkt); }