--- README-DNH.TXT.orig Sat Dec 10 11:06:38 2005 +++ README-DNH.TXT Sun Jan 15 00:11:23 2006 @@ -1,12 +1,13 @@ Enhanced CTorrent - [ [1]Info | [2]Notes | [3]Changes | [4]Download | [5]Resources | - [6]Contact ] + [ [1]Overview | [2]News | [3]Changes | [4]CTCS | [5]Download | + [6]Resources | [7]Contact ] + _________________________________________________________________ -Information + Overview - [7]CTorrent is a [8]BitTorrent client implemented in C++ to be + [8]CTorrent is a [9]BitTorrent client implemented in C++ to be lightweight and quick. It has fallen a little behind in updates and bug fixes though. @@ -16,10 +17,56 @@ contributing. I am not the original author, current maintainer, or any other official representative of CTorrent. The files on this page are not the original or official CTorrent distribution. I encourage you to - visit the [9]CTorrent project page on SourceForge for further + visit the [10]CTorrent project page on SourceForge for further information. -Notes + Features + + The purpose of the Enhanced CTorrent effort is to fix problems that + remain in the code, modernize existing features and algorithms, and + implement new features while maintaining low overhead requirements and + a high standard of performance (both part of the original CTorrent + design philosophy). Highlights of the enhanced client include: + * Support for large files (>2GB) and large torrents (>255 files) + * Strategic selection of pieces to request for download + * Continuous queueing of download requests, tuned based on latency + and throughput for each peer + * Improved download performance, including parallel requests in + initial and endgame modes + * Improved bandwidth regulation + * Improved compatibility with other peers + * Performance optimization and bug fixes + * An interface for monitoring and managing multiple clients + + Status Line + + The status line that is output by the client has changed since the + original and deserves some explanation. + + / 0/33/110 [672/672/672] 0MB,1130MB | 0,20K/s | 0,0K E:0,31 + - - -- --- --- --- --- --- ------ - -- - - - -- + A B C D E F G H I J K L M N O + + A: Ticker; this character changes to indicate that the client is + running. + B: Number of seeders (complete peers) to which you are connected. + C: Number of leechers (incomplete peers) to which you are connected. + D: Total number of peers in the swarm, as last reported by the + tracker. + E: Number of pieces of the torrent that you have completed. + F: Number of pieces currently available from you and your connected + peers. + G: Total number of pieces in the torrent. + H: Total amount of data you have downloaded. + I: Total amount of data you have uploaded. + J: Your current total download rate. + K: Your current total upload rate. + L: Amount of data downloaded since the last status line update. + M: Amount of data uploaded since the last status line update. + N: Number of tracker connection errors. + O: Number of successful tracker connections. + + Peer ID Beginning with dnh1.1 the default peer ID has been changed for convenience, as some other clients and trackers assume that Ctorrent @@ -28,238 +75,89 @@ to use a different peer ID, but it is no longer necessary to do so in order to avoid this "ban". -Changes for "dnh1.2" Release + The new default peer ID prefix is "-CDversion-", where version is an + indication of the version number (0101 for dnh1.1). + + CTCS + + [11]CTorrent Control Server (CTCS) is an interface for monitoring and + managing Enhanced CTorrent clients. It can manage allocation of + bandwidth, provide status information, and allow changes to the + running configuration of each client. Support for this interface was + added in the dnh2 release. + _________________________________________________________________ + + News + + 2006-01-15 + Version dnh2 is released! This version includes a number of + significant [12]changes, including large file support, piece + selection, tuned request queue depth, and support for + [13]CTorrent Control Server. + _________________________________________________________________ + + Changes + + For a list of changes in the current and previous versions, see the + [14]ChangeLog file. + _________________________________________________________________ + + Download + + Release dnh2 + The patch files for this version are significantly larger + than in previous releases. It will be faster and easier to just + download the patched source distribution below. - These are just corrections to the previous release that I felt were - necessary. Much more improvement is coming in the dnh2 release. + [15]dnh1.2 to dnh2 patch file + A patch file of changes to release dnh1.2 to bring it up to dnh2. - Bug/code fixes - * Bitfield::Invert patch [1357832 on sourceforge] described below. - * Fixed "piece length too long" check to reflect the actual queue - length used. - * Accept 128K slice size for peer requests. - * "Return" keyword in Random_init() removed due to potential compile - error. - * Modified longer-wait test in the optimistic unchoke routine to - consider whether the peer is currently choked. - -Bitfield::Invert bug - - There is a bug in the Bitfield::Invert() function that affects the - ctorrent-1.3.4 base code as well as releases dnh1 and dnh1.1. This can - cause the application to fail (segmentation fault) or may affect - downloading of all pieces of the torrent. A patch is available below - in the Download secion. - -Changes for "dnh1.1" Release - - These are just corrections to the previous release that I felt were - necessary. Much more improvement is coming in the next release. - - Bug/code fixes - * Peer count would increase on each tracker update if there were no - seeders. - * RequestQueue::CopyShuffle() changed to use a pointer argument. - * Fixed some incorrectness in PendingQueue::Delete() and - PendingQueue::DeleteSlice() which could cause a memory leak. - * Fixed random-chance inversion bug in PeerList::UnChokeCheck() - affecting choice for optimistic unchoking. - - Improvements - * Move StopDLTimer() call from RequestPiece() to RequestCheck(), - which could occasionally affect peer download rate measurement. - * Most clients do not like a slice size of 128K even though it is - the max allowed by the BT specification. Changed max slice size to - 64K. Note that the maximum piece length is 2MB (2097152); if you - need to download a torrent with a larger piece size you can change - the value of cfg_req_queue_length in btconfig.h from 64 to 128. - * Contact tracker immediately upon becoming (or starting as) a - seeder. - * Changed SendModule() to send only one slice at a time. This will - help with fairly distributing upload bandwidth among the unchoked - peers. - * Changed default peer ID prefix to '-CD0101-', indicating - CTorrent-dnh1.1 release. - -Changes for "dnh1" Release - - This is the first release. "dnh" identifies this patchset, and "1" - indicates release version 1 of the patchset. - - Patches - * Incorporates the following patches. The number is the Request ID - from the [10]SourceForge patches page, which you can reference for - the details of each patch. The name in brackets is the name of the - patch file or a name I chose to refer to the patch. Some of these - names are used below (in brackets) to describe a fix or change to - a particular patch. - 1042808 [getcwd] (incorporated in get1file patch) - 1084776 [passkey] (incorporated in udlimit patch) - 1109266 [align] - 1109287 [tracker/tracker2] - 1114197 [fmt] (incorporated in get1file patch) - 1114364 [resetdl] - 1116448 [get1file] - 1118597 [crash] - 1119467 [stall] - 1119492 [rate] - 1119497 [flush] - 1119519 [opt] - 1119689 [status] - 1124342 [udlimit] - - Download performance - * If a peer socket is ready for reading and writing, perform both. - Previously the cases were exclusive, with preference given to - reading. - * Download requests are now made to peers when they are ready for - writing (in addition to the existing event-driven cases). This - fixes peer stalls when a request couldn't be sent in an - event-triggered case due to bandwidth limiting or other - circumstances. - * Additional tests added so that the above request checking doesn't - create hard loops. - - Bandwidth measurement/management - * [rate] Bandwidth reporting is now not capped. Also, only the time - used for the samples taken is used in the calculation rather than - the maximum interval (this affects rate calculation for individual - peers). - * Additional upload and download bandwidth limit checks added so - that bw management is more accurate. - * Corrected condition inversion bug in Rate::StopTimer(), which - affects peer rate calculations. - - Peer count - * Request our max number of peers from the tracker each time rather - than just taking the tracker's default, so we can try to fill up. - * The tracker will be contacted early if all peers disconnect so - that we can actively try to establish some more peer connections. - To avoid hammering the tracker, we must have at least one peer for - 15 seconds in order for this to be invoked. - * Some clients use nonzero bytes in the "reserved" part of the - handshake. Added code to ignore the reserved bytes if the rest of - the handshake is as expected. This includes Azureus 2300 thru 2304 - (latest) which gives 0x80 as the first reserved byte and BitComet - which gives 0x6578 ("ex") as the first two bytes. - * Update peer's timestamp on any message, not just keepalives. Any - receipt of data from a peer now resets its timeout, preventing - early disconnect. - - Parallel requests - * Initial-piece and endgame cases have been improved so that pieces - will be requested from multiple peers. Cancels are sent as slices - (subpieces) are received. This endgame strategy is described in - the BitTorrent online spec. The startup strategy is also described - in posts and facilitates obtaining a single piece more rapidly in - order to obtain some trade value. In initial mode, the piece of - which we need the least parts is targeted. In endgame mode, the - piece of which we need the most parts is targeted. Slices that are - cancelled are also removed from the "pending" queue, as are pieces - that are completed. - * When duplicating a piece request, the slice request order is also - shuffled in order to minimize duplication of effort. - - Tracker info - * [status] Seems to be missing tracker.cpp diff. Added code to get - tracker's total peers, but not all trackers report these fields in - the normal response. Also added code to count successful updates - from the tracker. - * Added tracker connection state to status line (when - connecting/connected). - - Tracker contact - * When interrupting (ctrl-C), connect to the tracker immediately - rather than waiting 15 seconds. - * Contact tracker "soon" after transitioning to seeder state. - - Peer interaction - * Manage our interested state for each peer dynamically as content - changes. - * Unchoking - + Use the peer's interested state (confirming via the bitfield - that it needs our data) to consider unchoking. Using only the - bitfield could cause us to waste an upload slot on a peer - that doesn't have all content but isn't interested (like a - single-file downloader). - + Choke peers that become uninterested or don't need our data. - + Try unchoking new peers only as slots open or the optimistic - unchoke rotates. Unchoking too many peers can temporarily - reduce per-peer upload rates, which would make uploading to - us unappealing for good peers. - + In a tie for download speed, prefer to unchoke the peer to - whom we've uploaded the least data relative to what we've - downloaded from him. - * Optimistic unchoking - + Fixed condition inversion bug causing opt unchoking to occur - too often. - + A peer who has no pieces is now preferred 75% vs. a peer who - already has at least one piece, in order to help the new peer - become productive. This is documented in the online spec. - + Set peer's last-unchoke-time when choking the peer to get - better rotation of the optimistic unchoke. The value is now - the last time that a peer was in the unchoked state rather - than the time of the last unchoke event. - - Miscellaneous items - * [tracker] Fixed normal program end (stop) process, which was - crashing. - * [get1file] Restore compact tracker response support. - * [get1file] Made display of the status line info dependent on - whether the option is in use. - * [get1file] Apply the filter when checking for what we need from a - peer instead of when recording what the peer has; this prevents - stalls when we move on to the next file. Update interested state - for each peer when we begin a new file. Also move the file-done - check into the piece completion code and check whether the next - file(s) has also been completed. - * Reduced the slice size from 32K to 16K (same as BT & Azureus). - This provides more precise DL rate measurement, and helps insure - that we receive a productive amount of data (i.e. a complete - slice) even if we are unchoked by a peer for only one cycle. See - [11]http://groups.yahoo.com/group/BitTorrent/message/1260 for more - discussion/analysis on this. - * Added -v (verbose) option for additional debugging output. + [16]Patch file + A patch file of changes to the CTorrent 1.3.4 base. -Download + [17]Patched source + A complete source distribution for all platforms. ___________________________________ Release dnh1.2 + Note: If you get a message about needing to install OpenSSL, you might + want to try the FreeBSD patch/version even if you are not using + FreeBSD. - [12]dnh1.1 to dnh1.2 patch file + [18]dnh1.1 to dnh1.2 patch file A patch file of changes to release dnh1.1 to bring it up to dnh1.2. - [13]FreeBSD patch file + [19]FreeBSD patch file A patch file of changes to the CTorrent 1.3.4 base, including the patches from the FreeBSD ports tree. - [14]Patch file + [20]Patch file A patch file of changes to the CTorrent 1.3.4 base. - [15]FreeBSD patched source + [21]FreeBSD patched source This includes the patches from the FreeBSD ports tree. - [16]Linux/Windows/Other patched source - Please [17]let me know if you encounter any portability issues, as I + [22]Linux/Windows/Other patched source + Please [23]let me know if you encounter any portability issues, as I don't have a test environment set up for these platforms. ___________________________________ - !!! Bitfield::Invert patch !!! + Bitfield::Invert patch - [18]Bitfield::Invert patch - See notes above; this is needed if you are using dnh1.1, dnh1, or - ctorrent-1.3.4. + [24]Bitfield::Invert patch + See notes in the change log; this is needed if you are using dnh1.1, + dnh1, or ctorrent-1.3.4. ___________________________________ Release dnh1.1 - [19]dnh1 to dnh1.1 patch file + [25]dnh1 to dnh1.1 patch file A patch file of changes to release dnh1 to bring it up to dnh1.1. ___________________________________ Release dnh1 - [20]FreeBSD patch file + [26]FreeBSD patch file A patch file of changes to the CTorrent 1.3.4 base, including the patches from the FreeBSD ports tree. Note: Thanks to Florent Thoumie, as of 29 Jul 2005 this patchset is @@ -267,68 +165,75 @@ least net/ctorrent) and install from there, you will have these updates without downloading the file and patching manually. - [21]Patch file + [27]Patch file A patch file of changes to the CTorrent 1.3.4 base. - [22]FreeBSD patched source + [28]FreeBSD patched source This includes the patches from the FreeBSD ports tree. - [23]Linux/Windows/Other patched source - Please [24]let me know if you encounter any portability issues, as I + [29]Linux/Windows/Other patched source + Please [30]let me know if you encounter any portability issues, as I don't have a test environment set up for these platforms. + _________________________________________________________________ -Resources + Resources - [25]CTorrent Home Page + [31]CTorrent Home Page Outdated, but you may find some useful info (particularly the FAQ). - [26]CTorrent SourceForge Project + [32]CTorrent SourceForge Project Hosts the CTorrent codebase, bug reports, patches, and forum. - [27]Custom CTorrent + [33]Custom CTorrent A page by the author of the "get1file" patch and other fixes. It contains a custom version and a GUI for CTorrent. - [28]BitTorrent + [34]BitTorrent The official BitTorrent home page. - [29]BitTorrent wiki + [35]BitTorrent wiki Various documentation. - [30]BitTorrent protocol specification (official version) + [36]BitTorrent protocol specification (official version) - [31]BitTorrent protocol specification (wiki version) + [37]BitTorrent protocol specification (wiki version) References - 1. file://localhost/home/dholmes/public_html/ctorrent/index.html#info - 2. file://localhost/home/dholmes/public_html/ctorrent/index.html#notes - 3. file://localhost/home/dholmes/public_html/ctorrent/index.html#changes - 4. file://localhost/home/dholmes/public_html/ctorrent/index.html#download - 5. file://localhost/home/dholmes/public_html/ctorrent/index.html#resources - 6. mailto:dholmes@ct.boxmail.com - 7. http://ctorrent.sourceforge.net/ - 8. http://www.bittorrent.com/ - 9. http://sourceforge.net/projects/ctorrent/ - 10. http://sourceforge.net/tracker/?atid=598034&group_id=91688&func=browse - 11. http://groups.yahoo.com/group/BitTorrent/message/1260 - 12. file://localhost/home/dholmes/public_html/ctorrent/patchset-ctorrent-dnh1.1-dnh1.2.diff - 13. file://localhost/home/dholmes/public_html/ctorrent/patchset-ctorrent-1.3.4-dnh1.2-fbsd.diff - 14. file://localhost/home/dholmes/public_html/ctorrent/patchset-ctorrent-1.3.4-dnh1.2.diff - 15. file://localhost/home/dholmes/public_html/ctorrent/ctorrent-1.3.4-dnh1.2-fbsd.tar.gz - 16. file://localhost/home/dholmes/public_html/ctorrent/ctorrent-1.3.4-dnh1.2.tar.gz - 17. mailto:dholmes@ct.boxmail.com - 18. file://localhost/home/dholmes/public_html/ctorrent/patch-invert.diff - 19. file://localhost/home/dholmes/public_html/ctorrent/patchset-ctorrent-dnh1-dnh1.1.diff - 20. file://localhost/home/dholmes/public_html/ctorrent/patchset-ctorrent-1.3.4-dnh1-fbsd.diff - 21. file://localhost/home/dholmes/public_html/ctorrent/patchset-ctorrent-1.3.4-dnh1.diff - 22. file://localhost/home/dholmes/public_html/ctorrent/ctorrent-1.3.4-dnh1-fbsd.tar.gz - 23. file://localhost/home/dholmes/public_html/ctorrent/ctorrent-1.3.4-dnh1.tar.gz - 24. mailto:dholmes@ct.boxmail.com - 25. http://ctorrent.sourceforge.net/ - 26. http://sourceforge.net/projects/ctorrent/ - 27. http://customctorrent.ifreepages.com/ - 28. http://bittorrent.com/ - 29. http://wiki.theory.org/CategoryBitTorrent - 30. http://www.bittorrent.com/protocol.html - 31. http://wiki.theory.org/BitTorrentSpecification + 1. http://www.rahul.net/dholmes/ctorrent/index.html#info + 2. http://www.rahul.net/dholmes/ctorrent/index.html#news + 3. http://www.rahul.net/dholmes/ctorrent/changelog.html + 4. http://www.rahul.net/dholmes/ctorrent/ctcs.html + 5. http://www.rahul.net/dholmes/ctorrent/index.html#download + 6. http://www.rahul.net/dholmes/ctorrent/index.html#resources + 7. mailto:dholmes@ct.boxmail.com + 8. http://ctorrent.sourceforge.net/ + 9. http://www.bittorrent.com/ + 10. http://sourceforge.net/projects/ctorrent/ + 11. http://www.rahul.net/dholmes/ctorrent/ctcs.html + 12. http://www.rahul.net/dholmes/ctorrent/changelog.html + 13. http://www.rahul.net/dholmes/ctorrent/ctcs.html + 14. http://www.rahul.net/dholmes/ctorrent/changelog.html + 15. http://www.rahul.net/dholmes/ctorrent/patchset-ctorrent-dnh1.2-dnh2.diff + 16. http://www.rahul.net/dholmes/ctorrent/patchset-ctorrent-1.3.4-dnh2.diff + 17. http://www.rahul.net/dholmes/ctorrent/ctorrent-1.3.4-dnh2.tar.gz + 18. http://www.rahul.net/dholmes/ctorrent/patchset-ctorrent-dnh1.1-dnh1.2.diff + 19. http://www.rahul.net/dholmes/ctorrent/patchset-ctorrent-1.3.4-dnh1.2-fbsd.diff + 20. http://www.rahul.net/dholmes/ctorrent/patchset-ctorrent-1.3.4-dnh1.2.diff + 21. http://www.rahul.net/dholmes/ctorrent/ctorrent-1.3.4-dnh1.2-fbsd.tar.gz + 22. http://www.rahul.net/dholmes/ctorrent/ctorrent-1.3.4-dnh1.2.tar.gz + 23. mailto:dholmes@ct.boxmail.com + 24. http://www.rahul.net/dholmes/ctorrent/patch-invert.diff + 25. http://www.rahul.net/dholmes/ctorrent/patchset-ctorrent-dnh1-dnh1.1.diff + 26. http://www.rahul.net/dholmes/ctorrent/patchset-ctorrent-1.3.4-dnh1-fbsd.diff + 27. http://www.rahul.net/dholmes/ctorrent/patchset-ctorrent-1.3.4-dnh1.diff + 28. http://www.rahul.net/dholmes/ctorrent/ctorrent-1.3.4-dnh1-fbsd.tar.gz + 29. http://www.rahul.net/dholmes/ctorrent/ctorrent-1.3.4-dnh1.tar.gz + 30. mailto:dholmes@ct.boxmail.com + 31. http://ctorrent.sourceforge.net/ + 32. http://sourceforge.net/projects/ctorrent/ + 33. http://customctorrent.ifreepages.com/ + 34. http://bittorrent.com/ + 35. http://wiki.theory.org/CategoryBitTorrent + 36. http://www.bittorrent.com/protocol.html + 37. http://wiki.theory.org/BitTorrentSpecification --- ChangeLog.orig Wed Sep 8 16:10:51 2004 +++ ChangeLog Sat Jan 14 23:52:22 2006 @@ -1 +1,379 @@ -*EMPTY* + + Enhanced CTorrent Change Log + _________________________________________________________________ + + Changes for "dnh2" Release + + Patches + * The following patches or their functionality are incorporated: + 1380164 [dnh1.2] + 1357832 [invert] (included in dnh1.2) + 1352866 [dnh1.1] + 1266767 [passkey2] + 1239547 [dnh1] + 1170457 [standalone-sha1] Added as a fallback case in configure if + OpenSSL is not found. To force it to be used, define + USE_STANDALONE_SHA1 in config.h (after running configure). + 1164454 [ip] + 1119610 [vfat] This bug appears to be linux-specific; I've tried + to handle it in a more general way that may apply to similar + situations on other platforms and filesystems, but I have limited + capability to test this. + 1067196 [lfs] This is the large-file support that many have asked + for. + + Optimization + * Use fewer call to random() by shifting the previously unused bits. + * Time() calls have been greatly reduced; a global timestamp + variable "now" is set once per main loop interation and referenced + in functions that need a timestamp (except the caching I/O + routines which were left alone). + * Overall current bandwidth rates are now computed only once per + main loop and referenced in any routines that evaluate or control + bandwidth. + * Avoid flushing peer output buffers except in SendModule. This + allows for some consolidation of messages to reduce network + overhead. + + Code Fixes + * Fixed use of cfg_req_queue_length to be the actual queue size + (queue was half of this value). + * Fixed: "peer is" verbose output could fubar the terminal. + * Formatting: Replaced indentation tabs with spaces for consistency. + + Operational Enhancements + * Improved piece selection methods to include rarity as a factor. + This is not strictly "rarest-first", as we do not make a + comprehensive effort to find the "rarest" piece or rank pieces by + rarity. Rather, we use a more efficient compromise and try to find + the set of pieces that have "trade value" (another peer needs + them) and make a random choice from that set. Here is the current + preference order used in each mode: + Trade Value is defined as: + 1. Piece that only this peer has (not considering other + seeders), that a peer in which we're interested needs. + 2. Piece that not every peer in which we're interested has. + 3. Piece that only this peer has (not considering other + seeders). + 4. Piece that not every peer has. + Normal Mode + 1. Piece we tried to get from another peer but stopped due to + choking or lost connection. (We have part of the piece + already.) + 2. Piece most recently acquired by the peer (possibly/probably + rare). + 3. Piece with trade value. + 4. Any piece not yet requested. + Initial-piece Mode + 1. Piece with trade value which is already in progress. + 2. Piece with trade value that more than one peer has. + 3. Piece with trade value. + 4. Any piece not yet requested. + Endgame Mode + 1. Piece with trade value which is already in progress, of which + we have the least amount. + 2. Piece already in progress of which we have the least amount. + * Advanced request queueing system. + + Instead of requesting all of the slices for a piece at one + time, we now measure latency to the peer and send requests + based on how long it takes the data to arrive. This avoids + wasting upload banwidth by having too many outstanding + requests: If we get choked or lose the connection, the extra + requests were wasted; in initial or endgame modes, more + requests would have to be cancelled when we completed the + piece. + + A new piece will be queued for download when there is space + in the queue and we've requested the slices that have been + queued already. We also don't wait for the current piece to + complete before sending requests for a new piece. This helps + to maintain a continuous flow of data in the download + pipeline. + + When duplicating a request in initial or endgame mode, slices + that have already been requested are queued last. + * Don't send HAVE messages to seeders (to save UL bandwidth). + + Since we maintain interested state, and know the peer is a + seeder, we'll do the right thing when we become a seeder. + + Not sending HAVE to all peers (leechers) that already have + the piece is a bad idea IMO. If everyone takes the same + attitude, none of us will know when another becomes a seeder + and connections will remain open/occupied. + + We do send a HAVE to seeders upon completing our first piece + so that we don't continue to appear empty. + * Endgame strategy is used in get1file mode to complete the file. + * Queue management: + + Don't accept requests from choked peers. + + Discard peer's reponse_q when we choke them. + + Don't send cancels when we get choked (according to spec & + discussions). + + Don't put full piece queues in pending. + + Move closing peer's request queue to pending instead of + discarding it. + * Prefer uploading to or downloading from a peer after we skip them + due to bandwidth limiting. This is done via the g_next_up and + g_defer_up global variables in peer.cpp (for UL; s/up/dn for the + DL versions). The peerlist Sort() function and peer "click" + variables have been removed since they are not needed with this + feature. + + Options & Features + * The -c option now reports file completion status. + + As a side effect the metainfo details are printed twice. This + allows you to view the torrent contents while pieces are + being verified. + + Total percentage completion is also added to the output. + * "-E" option to seed to a specified UL:DL ratio. Seeding will stop + when this ratio or the timeout (-e) is reached. If CTorrent starts + as a seeder, the ratio is interpreted as UL:[torrent size]. + * If "-e 0" is specified (explicitly) and -E is used, there will be + no timeout; seeding will continue until the ratio is reached. + * The "-m" option previously didn't do anything, and it isn't clear + what it was originally going to do. Now the default value is 1, + and CTorrent will try to maintain at least this many peers by + contacting the tracker early if the peer count falls below this + value. This feature was present in release dnh1 but the value was + not changeable. + Actually it seems likely that this was to be number of peers that + the client would try to obtain (by initiating connections), as the + "official" client does; this is mentioned as a note in the online + specification. I don't really see the value in that though. That + said, the option as implemented here should rarely be used. It + might be useful only with torrents that have significantly more + than max_peers total peers and use a long tracker update interval + (such that you tend to drop a lot of peers betwen updates). + * "-z" option to set the slice size (the unit of a request, i.e. the + discrete amount of data that will be requested from a peer at one + time). The slice size now defaults to 16K regardless of the piece + length. Request queue size is computed and set based on the slice + size, as it now affects only system resources (though not a lot) + and not the way that requests are sent. + * Add support for "key" and "trackerid" tracker interaction + parameters. + * Support/display tracker warning message + * Now able to handle torrents with more than 255 files. + * Support for [1]CTorrent Control Server, an application and + protocol for monitoring and managing multiple Enhanced CTorrent + clients. The "-S" option is used to connect to CTCS, as in "-S + localhost:2780" if CTCS is listening at port 2780 on the local + system. Appending a colon ("-S localhost:2780:") will prompt for a + password to authenticate with CTCS. + + Peer Handling + * Count immediate choke-unchoke (either order) as an error (two + errors actually, since it's so wasteful). + It may be that some clients do this to stimulate the peer when + they think it hasn't responded to their last unchoke (due to high + latency). It would be better for them to just repeat the unchoke + rather than choke-unchoke, as by choking they will cause the peer + to send the requests again. + * Detect unresponsive peer connections and try to fix them or + disconnect them. Basically, if a peer doesn't respond to our + request in a reasonable time then we first assume that our request + was lost in transmission; if it happens again then we assume the + connection is unreliable. + * Handle peers that suppress HAVE messages so we don't always think + that they're empty (and thus give them preferential treatment for + uploading). If we've sent the peer an amount of data equivalent to + two pieces, assume that they now have at least one complete piece. + _________________________________________________________________ + + Changes for "dnh1.2" Release + + These are just corrections to the previous release that I felt were + necessary. Much more improvement is coming in the dnh2 release. + + Bug/code fixes + * Bitfield::Invert patch [1357832 on sourceforge] described below. + * Fixed "piece length too long" check to reflect the actual queue + length used. + * Accept 128K slice size for peer requests. + * "Return" keyword in Random_init() removed due to potential compile + error. + * Modified longer-wait test in the optimistic unchoke routine to + consider whether the peer is currently choked. + _________________________________________________________________ + + Bitfield::Invert bug + + There is a bug in the Bitfield::Invert() function that affects the + ctorrent-1.3.4 base code as well as releases dnh1 and dnh1.1. This can + cause the application to fail (segmentation fault) or may affect + downloading of all pieces of the torrent. A patch is available in the + Download secion. + _________________________________________________________________ + + Changes for "dnh1.1" Release + + These are just corrections to the previous release that I felt were + necessary. Much more improvement is coming in the next release. + + Bug/code fixes + * Peer count would increase on each tracker update if there were no + seeders. + * RequestQueue::CopyShuffle() changed to use a pointer argument. + * Fixed some incorrectness in PendingQueue::Delete() and + PendingQueue::DeleteSlice() which could cause a memory leak. + * Fixed random-chance inversion bug in PeerList::UnChokeCheck() + affecting choice for optimistic unchoking. + + Improvements + * Move StopDLTimer() call from RequestPiece() to RequestCheck(), + which could occasionally affect peer download rate measurement. + * Most clients do not like a slice size of 128K even though it is + the max allowed by the BT specification. Changed max slice size to + 64K. Note that the maximum piece length is 2MB (2097152); if you + need to download a torrent with a larger piece size you can change + the value of cfg_req_queue_length in btconfig.h from 64 to 128. + * Contact tracker immediately upon becoming (or starting as) a + seeder. + * Changed SendModule() to send only one slice at a time. This will + help with fairly distributing upload bandwidth among the unchoked + peers. + * Changed default peer ID prefix to '-CD0101-', indicating + CTorrent-dnh1.1 release. + _________________________________________________________________ + + Changes for "dnh1" Release + + This is the first release. "dnh" identifies this patchset, and "1" + indicates release version 1 of the patchset. + + Patches + * Incorporates the following patches. The number is the Request ID + from the [2]SourceForge patches page, which you can reference for + the details of each patch. The name in brackets is the name of the + patch file or a name I chose to refer to the patch. Some of these + names are used below (in brackets) to describe a fix or change to + a particular patch. + 1042808 [getcwd] (incorporated in get1file patch) + 1084776 [passkey] (incorporated in udlimit patch) + 1109266 [align] + 1109287 [tracker/tracker2] + 1114197 [fmt] (incorporated in get1file patch) + 1114364 [resetdl] + 1116448 [get1file] + 1118597 [crash] + 1119467 [stall] + 1119492 [rate] + 1119497 [flush] + 1119519 [opt] + 1119689 [status] + 1124342 [udlimit] + + Download performance + * If a peer socket is ready for reading and writing, perform both. + Previously the cases were exclusive, with preference given to + reading. + * Download requests are now made to peers when they are ready for + writing (in addition to the existing event-driven cases). This + fixes peer stalls when a request couldn't be sent in an + event-triggered case due to bandwidth limiting or other + circumstances. + * Additional tests added so that the above request checking doesn't + create hard loops. + + Bandwidth measurement/management + * [rate] Bandwidth reporting is now not capped. Also, only the time + used for the samples taken is used in the calculation rather than + the maximum interval (this affects rate calculation for individual + peers). + * Additional upload and download bandwidth limit checks added so + that bw management is more accurate. + * Corrected condition inversion bug in Rate::StopTimer(), which + affects peer rate calculations. + + Peer count + * Request our max number of peers from the tracker each time rather + than just taking the tracker's default, so we can try to fill up. + * The tracker will be contacted early if all peers disconnect so + that we can actively try to establish some more peer connections. + To avoid hammering the tracker, we must have at least one peer for + 15 seconds in order for this to be invoked. + * Some clients use nonzero bytes in the "reserved" part of the + handshake. Added code to ignore the reserved bytes if the rest of + the handshake is as expected. This includes Azureus 2300 thru 2304 + (latest) which gives 0x80 as the first reserved byte and BitComet + which gives 0x6578 ("ex") as the first two bytes. + * Update peer's timestamp on any message, not just keepalives. Any + receipt of data from a peer now resets its timeout, preventing + early disconnect. + + Parallel requests + * Initial-piece and endgame cases have been improved so that pieces + will be requested from multiple peers. Cancels are sent as slices + (subpieces) are received. This endgame strategy is described in + the BitTorrent online spec. The startup strategy is also described + in posts and facilitates obtaining a single piece more rapidly in + order to obtain some trade value. In initial mode, the piece of + which we need the least parts is targeted. In endgame mode, the + piece of which we need the most parts is targeted. Slices that are + cancelled are also removed from the "pending" queue, as are pieces + that are completed. + * When duplicating a piece request, the slice request order is also + shuffled in order to minimize duplication of effort. + + Tracker info + * [status] Seems to be missing tracker.cpp diff. Added code to get + tracker's total peers, but not all trackers report these fields in + the normal response. Also added code to count successful updates + from the tracker. + * Added tracker connection state to status line (when + connecting/connected). + + Tracker contact + * When interrupting (ctrl-C), connect to the tracker immediately + rather than waiting 15 seconds. + * Contact tracker "soon" after transitioning to seeder state. + + Peer interaction + * Manage our interested state for each peer dynamically as content + changes. + * Unchoking + + Use the peer's interested state (confirming via the bitfield + that it needs our data) to consider unchoking. Using only the + bitfield could cause us to waste an upload slot on a peer + that doesn't have all content but isn't interested (like a + single-file downloader). + + Choke peers that become uninterested or don't need our data. + + Try unchoking new peers only as slots open or the optimistic + unchoke rotates. Unchoking too many peers can temporarily + reduce per-peer upload rates, which would make uploading to + us unappealing for good peers. + + In a tie for download speed, prefer to unchoke the peer to + whom we've uploaded the least data relative to what we've + downloaded from him. + * Optimistic unchoking + + Fixed condition inversion bug causing opt unchoking to occur + too often. + + A peer who has no pieces is now preferred 75% vs. a peer who + already has at least one piece, in order to help the new peer + become productive. This is documented in the online spec. + + Set peer's last-unchoke-time when choking the peer to get + better rotation of the optimistic unchoke. The value is now + the last time that a peer was in the unchoked state rather + than the time of the last unchoke event. + + Miscellaneous items + * [tracker] Fixed normal program end (stop) process, which was + crashing. + * [get1file] Restore compact tracker response support. + * [get1file] Made display of the status line info dependent on + whether the option is in use. + * [get1file] Apply the filter when checking for what we need from a + peer instead of when recording what the peer has; this prevents + stalls when we move on to the next file. Update interested state + for each peer when we begin a new file. Also move the file-done + check into the piece completion code and check whether the next + file(s) has also been completed. + * Reduced the slice size from 32K to 16K (same as BT & Azureus). + This provides more precise DL rate measurement, and helps insure + that we receive a productive amount of data (i.e. a complete + slice) even if we are unchoked by a peer for only one cycle. See + [3]http://groups.yahoo.com/group/BitTorrent/message/1260 for more + discussion/analysis on this. + * Added -v (verbose) option for additional debugging output. + +References + + 1. http://www.rahul.net/dholmes/ctorrent/ctcs.html + 2. http://sourceforge.net/tracker/?atid=598034&group_id=91688&func=browse + 3. http://groups.yahoo.com/group/BitTorrent/message/1260 --- Makefile.am.orig Wed Sep 8 16:10:51 2004 +++ Makefile.am Wed Oct 12 20:08:00 2005 @@ -1,2 +1,2 @@ bin_PROGRAMS = ctorrent -ctorrent_SOURCES = bencode.cpp bitfield.cpp btconfig.cpp btcontent.cpp btfiles.cpp btrequest.cpp btstream.cpp bufio.cpp connect_nonb.cpp ctorrent.cpp downloader.cpp httpencode.cpp iplist.cpp peer.cpp peerlist.cpp rate.cpp setnonblock.cpp sigint.cpp tracker.cpp bencode.h bitfield.h btconfig.h btcontent.h btfiles.h btrequest.h btstream.h bufio.h connect_nonb.h def.h downloader.h httpencode.h iplist.h msgencode.h peer.h peerlist.h rate.h setnonblock.h sigint.h tracker.h +ctorrent_SOURCES = bencode.cpp bitfield.cpp btconfig.cpp btcontent.cpp btfiles.cpp btrequest.cpp btstream.cpp bufio.cpp connect_nonb.cpp ctcs.cpp ctorrent.cpp downloader.cpp httpencode.cpp iplist.cpp peer.cpp peerlist.cpp rate.cpp setnonblock.cpp sigint.cpp tracker.cpp sha1.c bencode.h bitfield.h btconfig.h btcontent.h btfiles.h btrequest.h btstream.h bufio.h connect_nonb.h ctcs.h def.h downloader.h httpencode.h iplist.h msgencode.h peer.h peerlist.h rate.h setnonblock.h sigint.h tracker.h sha1.h --- aclocal.m4.orig Wed Sep 8 16:10:51 2004 +++ aclocal.m4 Thu Nov 10 20:56:00 2005 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.7.6 -*- Autoconf -*- +# generated automatically by aclocal 1.9.1 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -11,132 +11,9 @@ # 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. +# -*- Autoconf -*- +# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Generated from amversion.in; do not edit by hand. # 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 @@ -156,18 +33,18 @@ # ---------------------------- # 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"]) +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # 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.6])]) + [AM_AUTOMAKE_VERSION([1.9.1])]) -# Helper functions for option handling. -*- Autoconf -*- +# AM_AUX_DIR_EXPAND -# Copyright 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 2001, 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 @@ -184,36 +61,54 @@ # 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])]) - +# 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/../..'. # -# Check to make sure that the build environment is sane. +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. # +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) -# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004 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 @@ -230,53 +125,34 @@ # 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 +# serial 6 - test "$[2]" = conftest.file - ) -then - # Ok. - : +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) + $1_TRUE='#' + $1_FALSE= fi -AC_MSG_RESULT(yes)]) - -# -*- Autoconf -*- +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])]) +# serial 7 -*- Autoconf -*- -# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# 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 @@ -293,220 +169,12 @@ # 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... +# 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... @@ -568,7 +236,9 @@ : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - : > sub/conftst$i.h + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf @@ -596,9 +266,14 @@ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings - # (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 + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi @@ -632,8 +307,8 @@ # ------------ 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]) +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' @@ -644,7 +319,8 @@ # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# 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 @@ -680,27 +356,21 @@ 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"` + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n -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" | \ + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue @@ -726,9 +396,13 @@ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Check to see how 'make' treats includes. -*- Autoconf -*- +# Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# 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, 2004 +# 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 @@ -745,43 +419,223 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# serial 2 +# serial 11 -# 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 +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.58])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +# 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_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# 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]) + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. + +# Copyright (C) 2001, 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. + +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)]) + +# -*- 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])]) + +# 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]) @@ -789,9 +643,10 @@ rm -f confinc confmf ]) -# AM_CONDITIONAL -*- Autoconf -*- +# -*- Autoconf -*- + -# Copyright 1997, 2000, 2001 Free Software Foundation, Inc. +# Copyright (C) 1997, 1999, 2000, 2001, 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 @@ -808,28 +663,358 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# serial 5 +# serial 3 -AC_PREREQ(2.52) +# 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_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='#' + +# 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 - $1_TRUE='#' - $1_FALSE= + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) 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])]) +]) + +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. + +# Copyright (C) 2003, 2004 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. + +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p])]) + +# Helper functions for option handling. -*- 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_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 (C) 1996, 1997, 2000, 2001, 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 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)]) + +# AM_PROG_INSTALL_STRIP + +# Copyright (C) 2001, 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. + +# 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])]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004 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 + + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR --- configure.ac.orig Wed Sep 8 16:10:51 2004 +++ configure.ac Thu Nov 10 20:56:00 2005 @@ -1,6 +1,6 @@ # Process this file with autoconf to produce a configure script. -AC_INIT([CTorrent], [devel], [bsdi@sina.com]) -AM_INIT_AUTOMAKE(ctorrent,devel) +AC_INIT([CTorrent], [dnh2], [dholmes@ct.boxmail.com]) +AM_INIT_AUTOMAKE(ctorrent,dnh2) AC_CONFIG_HEADER([config.h]) AC_CONFIG_SRCDIR([ctorrent.cpp]) @@ -14,7 +14,7 @@ [AC_CHECK_LIB([crypt],[SHA1_Init],, [AC_CHECK_LIB([crypto],[SHA1_Init],, [AC_CHECK_LIB([md],[SHA1_Init],, - [AC_MSG_ERROR([error, Please install OpenSSL first!])])])])]) + [AC_DEFINE([USE_STANDALONE_SHA1],,[Define to 1 to use the Steve Reid's public-domain SHA-1 code.])])])])]) # Checks for header files. AC_HEADER_DIRENT @@ -32,6 +32,10 @@ AC_FUNC_MEMCMP AC_TYPE_SIGNAL AC_FUNC_STAT -AC_CHECK_FUNCS([ftruncate gethostbyname gettimeofday getwd inet_ntoa memchr memmove memset mkdir select socket strchr strerror strncasecmp strstr strtol strnstr]) +AC_CHECK_FUNCS([ftruncate gethostbyname gettimeofday getwd inet_ntoa memchr memmove memset mkdir select socket strchr strerror strncasecmp strstr strtol strtoll strnstr]) + +# Enable/check large file support +AC_SYS_LARGEFILE +AC_FUNC_FSEEKO AC_OUTPUT(Makefile) --- Makefile.in.orig Wed Sep 8 16:10:51 2004 +++ Makefile.in Thu Nov 10 20:57:00 2005 @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.6 from Makefile.am. +# Makefile.in generated by automake 1.9.1 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 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. @@ -14,6 +14,8 @@ @SET_MAKE@ +SOURCES = $(ctorrent_SOURCES) + srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -21,7 +23,6 @@ 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 @@ -35,6 +36,61 @@ NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +bin_PROGRAMS = ctorrent$(EXEEXT) +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ + depcomp install-sh missing mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_ctorrent_OBJECTS = bencode.$(OBJEXT) bitfield.$(OBJEXT) \ + btconfig.$(OBJEXT) btcontent.$(OBJEXT) btfiles.$(OBJEXT) \ + btrequest.$(OBJEXT) btstream.$(OBJEXT) bufio.$(OBJEXT) \ + connect_nonb.$(OBJEXT) ctcs.$(OBJEXT) ctorrent.$(OBJEXT) \ + downloader.$(OBJEXT) httpencode.$(OBJEXT) iplist.$(OBJEXT) \ + peer.$(OBJEXT) peerlist.$(OBJEXT) rate.$(OBJEXT) \ + setnonblock.$(OBJEXT) sigint.$(OBJEXT) tracker.$(OBJEXT) \ + sha1.$(OBJEXT) +ctorrent_OBJECTS = $(am_ctorrent_OBJECTS) +ctorrent_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I. +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +SOURCES = $(ctorrent_SOURCES) +DIST_SOURCES = $(ctorrent_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ @@ -90,6 +146,8 @@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ datadir = @datadir@ @@ -102,6 +160,7 @@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ @@ -109,76 +168,44 @@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -bin_PROGRAMS = ctorrent -ctorrent_SOURCES = bencode.cpp bitfield.cpp btconfig.cpp btcontent.cpp btfiles.cpp btrequest.cpp btstream.cpp bufio.cpp connect_nonb.cpp ctorrent.cpp downloader.cpp httpencode.cpp iplist.cpp peer.cpp peerlist.cpp rate.cpp setnonblock.cpp sigint.cpp tracker.cpp bencode.h bitfield.h btconfig.h btcontent.h btfiles.h btrequest.h btstream.h bufio.h connect_nonb.h def.h downloader.h httpencode.h iplist.h msgencode.h peer.h peerlist.h rate.h setnonblock.h sigint.h tracker.h -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = -bin_PROGRAMS = ctorrent$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) - -am_ctorrent_OBJECTS = bencode.$(OBJEXT) bitfield.$(OBJEXT) \ - btconfig.$(OBJEXT) btcontent.$(OBJEXT) btfiles.$(OBJEXT) \ - btrequest.$(OBJEXT) btstream.$(OBJEXT) bufio.$(OBJEXT) \ - connect_nonb.$(OBJEXT) ctorrent.$(OBJEXT) downloader.$(OBJEXT) \ - httpencode.$(OBJEXT) iplist.$(OBJEXT) peer.$(OBJEXT) \ - peerlist.$(OBJEXT) rate.$(OBJEXT) setnonblock.$(OBJEXT) \ - sigint.$(OBJEXT) tracker.$(OBJEXT) -ctorrent_OBJECTS = $(am_ctorrent_OBJECTS) -ctorrent_LDADD = $(LDADD) -ctorrent_DEPENDENCIES = -ctorrent_LDFLAGS = - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I. -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/bencode.Po ./$(DEPDIR)/bitfield.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/btconfig.Po ./$(DEPDIR)/btcontent.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/btfiles.Po ./$(DEPDIR)/btrequest.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/btstream.Po ./$(DEPDIR)/bufio.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/connect_nonb.Po ./$(DEPDIR)/ctorrent.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/downloader.Po ./$(DEPDIR)/httpencode.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/iplist.Po ./$(DEPDIR)/peer.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/peerlist.Po ./$(DEPDIR)/rate.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/setnonblock.Po ./$(DEPDIR)/sigint.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/tracker.Po -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ - -o $@ -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 = $(ctorrent_SOURCES) -DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ - Makefile.in NEWS aclocal.m4 config.h.in configure configure.ac \ - depcomp install-sh missing mkinstalldirs -SOURCES = $(ctorrent_SOURCES) - +ctorrent_SOURCES = bencode.cpp bitfield.cpp btconfig.cpp btcontent.cpp btfiles.cpp btrequest.cpp btstream.cpp bufio.cpp connect_nonb.cpp ctcs.cpp ctorrent.cpp downloader.cpp httpencode.cpp iplist.cpp peer.cpp peerlist.cpp rate.cpp setnonblock.cpp sigint.cpp tracker.cpp sha1.c bencode.h bitfield.h btconfig.h btcontent.h btfiles.h btrequest.h btstream.h bufio.h connect_nonb.h ctcs.h def.h downloader.h httpencode.h iplist.h msgencode.h peer.h peerlist.h rate.h setnonblock.h sigint.h tracker.h sha1.h all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: -.SUFFIXES: .cpp .o .obj - -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) +.SUFFIXES: .c .cpp .o .obj +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; -$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck -$(srcdir)/configure: $(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) - cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): configure.ac +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @@ -190,24 +217,23 @@ 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.ac $(ACLOCAL_M4) +$(srcdir)/config.h.in: $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) - touch $(srcdir)/config.h.in + rm -f stamp-h1 + touch $@ distclean-hdr: -rm -f config.h stamp-h1 -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_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) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done @@ -215,8 +241,8 @@ @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ - rm -f $(DESTDIR)$(bindir)/$$f; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: @@ -226,7 +252,7 @@ $(CXXLINK) $(ctorrent_LDFLAGS) $(ctorrent_OBJECTS) $(ctorrent_LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @@ -240,6 +266,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btstream.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bufio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/connect_nonb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctcs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctorrent.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/downloader.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/httpencode.Po@am__quote@ @@ -248,43 +275,39 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/peerlist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setnonblock.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigint.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tracker.Po@am__quote@ -distclean-depend: - -rm -rf ./$(DEPDIR) +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .cpp.o: -@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCXX_TRUE@ fi +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: -@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCXX_TRUE@ fi +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` 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 \ @@ -293,6 +316,7 @@ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique +tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -304,10 +328,11 @@ 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 - + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -330,19 +355,6 @@ 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) $(am__remove_distdir) @@ -358,7 +370,7 @@ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ @@ -379,19 +391,46 @@ ! -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 + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist - $(am__remove_distdir) - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst @@ -411,19 +450,20 @@ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ - (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ - && rm -f $(distdir).tar.gz \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) - @echo "$(distdir).tar.gz is ready for distribution" | \ - sed 'h;s/./=/g;p;x;p;x' + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ @@ -445,9 +485,10 @@ check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) config.h - installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done install: install-am install-exec: install-exec-am install-data: install-data-am @@ -459,7 +500,7 @@ installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -467,7 +508,7 @@ clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -478,13 +519,17 @@ distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-hdr distclean-tags + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-tags dvi: dvi-am dvi-am: +html: html-am + info: info-am info-am: @@ -502,6 +547,8 @@ maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache + -rm -rf ./$(DEPDIR) + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am @@ -518,11 +565,12 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic ctags dist dist-all dist-gzip distcheck distclean \ - distclean-compile distclean-depend distclean-generic \ - distclean-hdr distclean-tags distcleancheck distdir \ - distuninstallcheck dvi dvi-am info info-am install install-am \ +.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ + clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \ + dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ --- bencode.cpp.orig Wed Sep 8 16:10:51 2004 +++ bencode.cpp Sun Jan 1 18:38:01 2006 @@ -1,6 +1,6 @@ +#include "./def.h" #include -#include "./def.h" #include "bencode.h" #ifndef WINDOWS @@ -29,7 +29,7 @@ return keylen; } -size_t buf_int(const char *b,size_t len,char beginchar,char endchar,size_t *pi) +size_t buf_long(const char *b,size_t len,char beginchar,char endchar,int64_t *pi) { const char *p = b; const char *psave; @@ -46,12 +46,26 @@ if(!len || MAX_INT_SIZ < (p - psave) || *p != endchar) return 0; if( pi ){ - if( beginchar ) *pi = (size_t)strtol(b + 1,(char**) 0,10); - else *pi=(size_t)strtol(b,(char**) 0,10); + if( beginchar ) *pi = strtoll(b + 1,(char**) 0,10); + else *pi=strtoll(b,(char**) 0,10); } return (size_t)( p - b + 1 ); } +size_t buf_int(const char *b,size_t len,char beginchar,char endchar,size_t *pi) +{ + size_t r; + + if( pi ){ + int64_t pl; + r = buf_long(b,len,beginchar,endchar,&pl); + *pi = (size_t) pl; + }else{ + r = buf_long(b,len,beginchar,endchar,(int64_t*) 0); + } + return r; +} + size_t buf_str(const char *b,size_t len,const char **pstr,size_t* slen) { size_t rl,sl; @@ -69,7 +83,7 @@ size_t decode_int(const char *b,size_t len) { - return(buf_int(b,len,'i','e',(size_t*) 0)); + return(buf_long(b,len,'i','e',(int64_t*) 0)); } size_t decode_str(const char *b,size_t len) @@ -136,7 +150,7 @@ } } -size_t decode_query(const char *b,size_t len,const char *keylist,const char **ps,size_t *pi,int method) +size_t decode_query(const char *b,size_t len,const char *keylist,const char **ps,size_t *pi,int64_t *pl,int method) { size_t pos; char kl[KEYNAME_LISTSIZ]; @@ -147,8 +161,9 @@ case QUERY_STR: return(buf_str(b + pos,len - pos, ps, pi)); case QUERY_INT: return(buf_int(b + pos,len - pos, 'i', 'e', pi)); case QUERY_POS: - if(pi) *pi = decode_rev(b + pos, len - pos, (const char*) 0); - return pos; + if(pi) *pi = decode_rev(b + pos, len - pos, (const char*) 0); + return pos; + case QUERY_LONG: return(buf_long(b + pos,len - pos, 'i', 'e', pl)); default: return 0; } } --- bencode.h.orig Wed Sep 8 16:10:51 2004 +++ bencode.h Fri Aug 26 20:43:00 2005 @@ -13,7 +13,9 @@ #define QUERY_STR 0 #define QUERY_INT 1 #define QUERY_POS 2 +#define QUERY_LONG 3 +size_t buf_long(const char *b,size_t len,char beginchar,char endchar,int64_t *pi); size_t buf_int(const char *b,size_t len,char beginchar,char endchar,size_t *pi); size_t buf_str(const char *b,size_t len,const char **pstr,size_t* slen); size_t decode_int(const char *b,size_t len); @@ -21,7 +23,7 @@ size_t decode_dict(const char *b,size_t len,const char *keylist); size_t decode_list(const char *b,size_t len,const char *keylist); size_t decode_rev(const char *b,size_t len,const char *keylist); -size_t decode_query(const char *b,size_t len,const char *keylist,const char **ps,size_t *pi,int method); +size_t decode_query(const char *b,size_t len,const char *keylist,const char **ps,size_t *pi,int64_t *pl,int method); size_t decode_list2path(const char *b, size_t n, char *pathname); size_t bencode_buf(const char *str,size_t len,FILE *fp); size_t bencode_str(const char *str, FILE *fp); --- bitfield.cpp.orig Sat Dec 10 11:13:49 2005 +++ bitfield.cpp Mon Nov 21 16:26:52 2005 @@ -143,8 +143,6 @@ size_t s = nset; for( ; i < nbytes - 1; i++ ) b[i] = ~b[i]; -//dnh if( nbits % nbytes ){ -//consider nbits=10 (nbytes=2).... if( nbits % 8 ){ for( i = 8 * (nbytes - 1); i < nbits; i++ ) if( _isset(i) ) UnSet(i); else _set(i); }else @@ -179,7 +177,10 @@ { size_t i; char c; - if( bf.nset != 0 ){ + if( _isfull_sp(bf) ){ + SetAll(); + Invert(); + }else if( bf.nset != 0 ){ if( nset >= nbits ){ b = new unsigned char[nbytes]; #ifndef WINDOWS @@ -196,6 +197,26 @@ } } +void BitField::And(const BitField &bf) +{ + size_t i; + + if( bf.nset == 0 ){ + SetAll(); + Invert(); + }else if( !_isfull_sp(bf) ){ + if( nset >= nbits ){ + b = new unsigned char[nbytes]; +#ifndef WINDOWS + if( !b ) throw 9; +#endif + _setall(b); + } + for(i = 0; i < nbytes; i++) b[i] &= bf.b[i]; + _recalc(); + } +} + size_t BitField::Random() const { size_t idx; @@ -312,3 +333,4 @@ fclose(fp); return -1; } + --- bitfield.h.orig Sat Dec 10 11:13:49 2005 +++ bitfield.h Sat Nov 12 12:58:02 2005 @@ -41,6 +41,7 @@ void Comb(const BitField &bf); void Except(const BitField &bf); void Invert(); + void And(const BitField &bf); int WriteToFile(const char *fname); int SetReferFile(const char *fname); --- btconfig.cpp.orig Sat Dec 10 11:13:49 2005 +++ btconfig.cpp Sun Jan 1 18:39:06 2006 @@ -1,13 +1,14 @@ #include -//size_t cfg_req_slice_size = 32768; size_t cfg_req_slice_size = 16384; +size_t cfg_req_queue_length = 74; size_t cfg_cache_size = 16; size_t cfg_max_peers = 100; -size_t cfg_min_peers = 40; +size_t cfg_min_peers = 1; +unsigned long cfg_listen_ip = 0; int cfg_listen_port = 0; int cfg_max_listen_port = 2706; int cfg_min_listen_port = 2106; @@ -16,6 +17,7 @@ int cfg_max_bandwidth_up = -1; time_t cfg_seed_hours = 72; +double cfg_seed_ratio = 0; // arguments global value char *arg_metainfo_file = (char*) 0; @@ -27,8 +29,12 @@ unsigned char arg_flg_check_only = 0; unsigned char arg_flg_exam_only = 0; unsigned char arg_flg_make_torrent = 0; -unsigned char arg_file_to_download = 0; +size_t arg_file_to_download = 0; unsigned char arg_verbose = 0; size_t arg_piece_length = 262144; char *arg_announce = (char*) 0; + +char *arg_ctcs = (char*) 0; +int cfg_exit_zero_peers = 0; + --- btconfig.h.orig Sat Dec 10 11:13:49 2005 +++ btconfig.h Sat Jan 14 12:20:10 2006 @@ -9,21 +9,23 @@ // comparison in RequestQueue::IsValidRequest() (see btrequest.cpp) that // doubles the value so that we will accept a request for 128K. #define cfg_max_slice_size 65536 -#define cfg_req_queue_length 64 +extern size_t cfg_req_queue_length; #define MAX_PF_LEN 8 #define PEER_ID_LEN 20 -#define PEER_PFX "-CD0102-" +#define PEER_PFX "-CD0200-" extern size_t cfg_cache_size; extern size_t cfg_max_peers; extern size_t cfg_min_peers; +extern unsigned long cfg_listen_ip; extern int cfg_listen_port; extern int cfg_max_listen_port; extern int cfg_min_listen_port; extern time_t cfg_seed_hours; +extern double cfg_seed_ratio; extern int cfg_max_bandwidth; extern int cfg_max_bandwidth_down; @@ -39,9 +41,12 @@ extern unsigned char arg_flg_check_only; extern unsigned char arg_flg_exam_only; extern unsigned char arg_flg_make_torrent; -extern unsigned char arg_file_to_download; +extern size_t arg_file_to_download; extern unsigned char arg_verbose; extern size_t arg_piece_length; extern char *arg_announce; + +extern char *arg_ctcs; +extern int cfg_exit_zero_peers; #endif --- btcontent.cpp.orig Sat Dec 10 11:13:49 2005 +++ btcontent.cpp Sun Jan 1 18:40:49 2006 @@ -9,8 +9,12 @@ #else #include #include +#if defined(HAVE_LIBCRYPT) || defined(HAVE_LIBMD) || defined(HAVE_LIBCRYPTO) +#include +#elif defined(HAVE_LIBSSL) #include #endif +#endif #include #include @@ -25,9 +29,13 @@ #include "httpencode.h" #include "tracker.h" -#define meta_str(keylist,pstr,pint) decode_query(b,flen,(keylist),(pstr),(pint),QUERY_STR) -#define meta_int(keylist,pint) decode_query(b,flen,(keylist),(const char**) 0,(pint),QUERY_INT) -#define meta_pos(keylist) decode_query(b,flen,(keylist),(const char**) 0,(size_t*) 0,QUERY_POS) +#if defined(USE_STANDALONE_SHA1) +#include "sha1.h" +#endif + +#define meta_str(keylist,pstr,pint) decode_query(b,flen,(keylist),(pstr),(pint),(int64_t*) 0,QUERY_STR) +#define meta_int(keylist,pint) decode_query(b,flen,(keylist),(const char**) 0,(pint),(int64_t*) 0,QUERY_INT) +#define meta_pos(keylist) decode_query(b,flen,(keylist),(const char**) 0,(size_t*) 0,(int64_t*) 0,QUERY_POS) #define CACHE_FIT(ca,roff,rlen) \ (max_u_int64_t((ca)->bc_off,(roff)) <= \ @@ -39,6 +47,12 @@ static void Sha1(char *ptr,size_t len,unsigned char *dm) { +#if defined(USE_STANDALONE_SHA1) + SHA1_CTX context; + SHA1Init(&context); + SHA1Update(&context,(unsigned char*)ptr,len); + SHA1Final(dm,&context); +#else #ifdef WINDOWS ; #else @@ -47,6 +61,7 @@ SHA1_Update(&context,(unsigned char*)ptr,len); SHA1_Final(dm,&context); #endif +#endif } btContent::btContent() @@ -123,7 +138,8 @@ m_piece_length *= 65536; } - if( !m_piece_length || m_piece_length > cfg_req_queue_length * cfg_req_slice_size ) + // This is really just a sanity check on the piece length to create. + if( !m_piece_length || m_piece_length > 4096*1024 ) m_piece_length = 262144; m_announce = ann_url; @@ -211,27 +227,24 @@ if(!meta_int("info|piece length",&m_piece_length)) ERR_RETURN(); m_npieces = m_hashtable_length / 20; - if( m_piece_length > cfg_max_slice_size * (cfg_req_queue_length/2) ){ - fprintf(stderr,"error, piece length too long[%u]. please recompile CTorrent with a larger cfg_req_queue_length or cfg_max_slice_size in .\n", m_piece_length); - ERR_RETURN(); - } + cfg_req_queue_length = (m_piece_length / cfg_req_slice_size) * 2 - 1; if( m_piece_length < cfg_req_slice_size ) cfg_req_slice_size = m_piece_length; - else{ - for( ;(m_piece_length / cfg_req_slice_size) >= cfg_req_queue_length; ){ - cfg_req_slice_size *= 2; - if( cfg_req_slice_size > cfg_max_slice_size ) ERR_RETURN(); - } - } if( m_btfiles.BuildFromMI(b, flen, saveas) < 0) ERR_RETURN(); delete []b; b = (char *)0; - PrintOut(); - if( arg_flg_exam_only ) return 0; + if( arg_flg_exam_only ){ + PrintOut(); + return 0; + }else{ + arg_flg_exam_only = 1; + PrintOut(); + arg_flg_exam_only = 0; + } if( ( r = m_btfiles.CreateFiles() ) < 0) ERR_RETURN(); @@ -266,13 +279,13 @@ if( !arg_flg_check_only ){ if( pBF->SetReferFile(arg_bitfield_file) >= 0){ - size_t idx; - r = 0; - for( idx = 0; idx < m_npieces; idx++ ) - if( pBF->IsSet(idx) ) m_left_bytes -= GetPieceLength(idx); + size_t idx; + r = 0; + for( idx = 0; idx < m_npieces; idx++ ) + if( pBF->IsSet(idx) ) m_left_bytes -= GetPieceLength(idx); } else{ - fprintf(stderr,"warn, couldn't set bit field refer file %s.\n",arg_bitfield_file); + fprintf(stderr,"warn, couldn't set bit field refer file %s.\n",arg_bitfield_file); } } @@ -285,7 +298,9 @@ CheckExist(); } - printf("Already/Total: %u/%u\n",pBF->Count(),m_npieces); + PrintOut(); + printf("Already/Total: %u/%u (%d%%)\n",pBF->Count(),m_npieces, + 100 * pBF->Count() / m_npieces); if( arg_flg_check_only ){ if( arg_bitfield_file ) pBF->WriteToFile(arg_bitfield_file); @@ -299,11 +314,11 @@ memset(ptr,0,8); // reserved set zero. { // peer id - char *sptr = arg_user_agent; - char *dptr = (char *)m_shake_buffer + 48; - char *eptr = dptr + PEER_ID_LEN; - while (*sptr) *dptr++ = *sptr++; - while (dptr < eptr) *dptr++ = (unsigned char)random(); + char *sptr = arg_user_agent; + char *dptr = (char *)m_shake_buffer + 48; + char *eptr = dptr + PEER_ID_LEN; + while (*sptr) *dptr++ = *sptr++; + while (dptr < eptr) *dptr++ = (unsigned char)random(); } return 0; } @@ -337,16 +352,16 @@ for( ; len && p && CACHE_FIT(p, offset, len);){ flg_rescan = 0; if( offset < p->bc_off ){ - len2 = p->bc_off - offset; - if( CacheIO(buf, offset, len2, 0) < 0) return -1; - flg_rescan = 1; + len2 = p->bc_off - offset; + if( CacheIO(buf, offset, len2, 0) < 0) return -1; + flg_rescan = 1; }else if( offset > p->bc_off ){ - len2 = p->bc_off + p->bc_len - offset; - if( len2 > len ) len2 = len; - memcpy(buf, p->bc_buf + offset - p->bc_off, len2); + len2 = p->bc_off + p->bc_len - offset; + if( len2 > len ) len2 = len; + memcpy(buf, p->bc_buf + offset - p->bc_off, len2); }else{ - len2 = (len > p->bc_len) ? p->bc_len : len; - memcpy(buf, p->bc_buf, len2); + len2 = (len > p->bc_len) ? p->bc_len : len; + memcpy(buf, p->bc_buf, len2); } buf += len2; @@ -354,14 +369,14 @@ len -= len2; if( len ){ - if( flg_rescan ){ - for( p = m_cache; - p && (offset + len) > p->bc_off && !CACHE_FIT(p,offset,len); - p = p->bc_next) ; - }else{ - time(&p->bc_last_timestamp); - p = p->bc_next; - } + if( flg_rescan ){ + for( p = m_cache; + p && (offset + len) > p->bc_off && !CACHE_FIT(p,offset,len); + p = p->bc_next) ; + }else{ + time(&p->bc_last_timestamp); + p = p->bc_next; + } } }// end for; @@ -414,7 +429,7 @@ if( p->bc_f_flush ){ p->bc_f_flush = 0; if(m_btfiles.IO(p->bc_buf, p->bc_off, p->bc_len, 1) < 0) - fprintf(stderr,"warn, write file failed while flush cache.\n"); + fprintf(stderr,"warn, write file failed while flush cache.\n"); } } @@ -437,18 +452,18 @@ for( ; len && p && CACHE_FIT(p, offset, len);){ flg_rescan = 0; if( offset < p->bc_off ){ - len2 = p->bc_off