darkice-1.0/0000777000175000001440000000000011371634115007757 500000000000000darkice-1.0/COPYING0000644000175000001440000010470111371627760010741 00000000000000All source code in the src directory is covered under the GNU General Public License version 3 or any later version. GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . darkice-1.0/doc/0000777000175000001440000000000011371625272010530 500000000000000darkice-1.0/INSTALL.lame0000644000175000001440000000331311217323507011640 00000000000000Installing Lame --------------- To install DarkIce, you need the Lame 3.89 or later libraries and related header files already installed on your system. It is recommended that use install Lame to the usual system locations, /usr/lib, /usr/include, so that DarkIce will find the header files and libraries. Thus when configuring, add --prefix=/usr to the configure options. Grab the latest lame source tarball from a download site found at http://www.mp3dev.org/mp3/download/download.html or from the DarkIce SourceForge project download area http://sourceforge.net/project/showfiles.php?group_id=14111 I took lame lame-3.91.tar.gz. Go to the directory where you saved it, and issue the following commands: tar xfz lame-3.91.tar.gz cd lame-3.91 ./configure --with-fileio=lame --without-vorbis --disable-gtktest --enable-expopt=full --prefix=/usr make make install For the last step, you need to be root or have write permissions in the target directories. You might consider using nasm if you're on a i386 system, with the configure option --enable-nasmm, for maximum performance. On RedHat Linux --------------- Compiling Lame on RedHat Linux is a tricky issue, because of gcc 2.96 packaged with the distributions 7.0 and 7.1. You either have to use the comaptibility compiler package (compat-egcs and related packages, providing gcc 2.91), or even better, gcc 3.0. It is recommended that you compile lame with gcc 3. For maximum performance, use the nasm assembler to compile assembly optimizations into lame. Try the following commands: tar xfz lame-3.91.tar.gz cd lame-3.91 export CC=gcc3 ./configure --with-fileio=lame --without-vorbis --disable-gtktest --enable-nasm --enable-expopt=full --prefix=/usr make make install darkice-1.0/Makefile.am0000644000175000001440000000051411371624133011726 00000000000000DOC_DIR = doc DOXYGEN_DIR = doc/doxygen DOXYGEN_CONFIG = etc/doxygen.config SUBDIRS = src man sysconf_DATA = darkice.cfg EXTRA_DIST = $(DOC_DIR) darkice.cfg INSTALL.lame INSTALL.vorbis FAQ rc.darkice .PHONY: doc doc: src # mkdir -p $(DOXYGEN_DIR) # doxygen etc/doxygen.config doxygen_clean: rm -rf $(DOXYGEN_DIR) darkice-1.0/config.sub0000755000175000001440000010115311371632436011663 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2008-01-16' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tile*) basic_machine=tile-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: darkice-1.0/configure0000755000175000001440000101462211371632435011613 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.63 for darkice 1.0. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell bug-autoconf@gnu.org about your system, echo including any error possibly output before this message. echo This can help us improve future autoconf versions. echo Configuration will now proceed without shell functions. } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='darkice' PACKAGE_TARNAME='darkice' PACKAGE_VERSION='1.0' PACKAGE_STRING='darkice 1.0' PACKAGE_BUGREPORT='' ac_unique_file="src/DarkIce.cpp" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS DEBUG_CXXFLAGS HAVE_SRC_LIB_FALSE HAVE_SRC_LIB_TRUE SRC_INCFLAGS SRC_LDFLAGS SRC_CFLAGS JACK_INCFLAGS JACK_LDFLAGS JACK_CFLAGS ALSA_LDFLAGS ALSA_INCFLAGS TWOLAME_LDFLAGS TWOLAME_INCFLAGS AACPLUS_LDFLAGS AACPLUS_INCFLAGS FAAC_LDFLAGS FAAC_INCFLAGS VORBIS_LDFLAGS VORBIS_INCFLAGS LAME_LDFLAGS LAME_INCFLAGS PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CC acx_pthread_config host_os host_vendor host_cpu host build_os build_vendor build_cpu build EGREP GREP CPP am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dependency_tracking with_lame with_lame_prefix with_vorbis with_vorbis_prefix with_faac with_faac_prefix with_aacplus with_aacplus_prefix with_twolame with_twolame_prefix with_alsa with_alsa_prefix with_jack with_jack_prefix with_samplerate with_samplerate_prefix with_debug ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CXX CXXFLAGS CCC CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { $as_echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { $as_echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 { (exit 1); exit 1; }; } ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { $as_echo "$as_me: error: working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures darkice 1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/darkice] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of darkice 1.0:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-lame use lame for encoding mp3 streams yes --with-lame-prefix=DIR alternate location for lame /usr look for libraries in LAME-PREFIX/lib, for headers in LAME-PREFIX/include --with-vorbis use Ogg Vorbis for encoding vorbis streams yes --with-vorbis-prefix=DIR alternate location for vorbis /usr look for libraries in VORBIS-PREFIX/lib, for headers in VORBIS-PREFIX/include --with-faac use faac for encoding AAC streams yes --with-faac-prefix=DIR alternate location for faac /usr look for libraries in FAAC-PREFIX/lib, for headers in FAAC-PREFIX/include --with-aacplus use aacplus for encoding AAC HEv2 streams yes --with-aacplus-prefix=DIR alternate location for aacplus /usr look for libraries in AACPLUS-PREFIX/lib, for headers in AACPLUS-PREFIX/include --with-twolame use twolame for encoding MP2 streams yes --with-twolame-prefix=DIR alternate location for twolame /usr look for libraries in TWOLAME-PREFIX/lib, for headers in TWOLAME-PREFIX/include --with-alsa use ALSA sound system yes --with-alsa-prefix=DIR alternate location for ALSA /usr look for libraries in ALSA-PREFIX/lib, for headers in ALSA-PREFIX/include --with-jack use JACK sound system yes --with-jack-prefix=DIR alternate location for JACK /usr look for libraries in JACK-PREFIX/lib, for headers in JACK-PREFIX/include --with-samplerate use Secret Rabbit Code (aka libsamplerate) for samplerate conversion yes --with-samplerate-prefix=DIR alternate location for samplerate /usr look for libraries in SRC-PREFIX/lib, for headers in SRC-PREFIX/include --with-debug enable debug mode no Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF darkice configure 1.0 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by darkice $as_me 1.0, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then ac_site_file1=$CONFIG_SITE elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test -r "$ac_site_file"; then { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 $as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers src/config.h" am__api_version='1.10' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 $as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 $as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 $as_echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` 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= { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi { $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:$LINENO: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 $as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='darkice' VERSION='1.0' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 $as_echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } # Provide some information about the compiler. $as_echo "$as_me:$LINENO: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { $as_echo "$as_me:$LINENO: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } if test -z "$ac_file"; then $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 $as_echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi fi fi { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } { $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } { $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi rm -f conftest$ac_cv_exeext { $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 $as_echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:$LINENO: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # 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 { $as_echo "$as_me:$LINENO: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep 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 # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:$LINENO: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:$LINENO: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { $as_echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if test "${ac_cv_prog_cxx_g+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep 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 # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:$LINENO: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 $as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if test "${ac_cv_path_GREP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 $as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:$LINENO: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; then $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 $as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in errno.h fcntl.h stdio.h stdlib.h string.h unistd.h limits.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in signal.h time.h sys/time.h sys/types.h sys/wait.h math.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in netdb.h netinet/in.h sys/ioctl.h sys/socket.h sys/stat.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sched.h pthread.h termios.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/soundcard.h sys/audio.h sys/audioio.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 $as_echo_n "checking $ac_header usability... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 $as_echo_n "checking $ac_header presence... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 $as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 $as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 $as_echo_n "checking for $ac_header... " >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi as_val=`eval 'as_val=${'$as_ac_Header'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } if test "${ac_cv_header_sys_wait_h+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_sys_wait_h=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 $as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_WAIT_H 1 _ACEOF fi { $as_echo "$as_me:$LINENO: checking for pid_t" >&5 $as_echo_n "checking for pid_t... " >&6; } if test "${ac_cv_type_pid_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_pid_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (pid_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((pid_t))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_pid_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 $as_echo "$ac_cv_type_pid_t" >&6; } if test "x$ac_cv_type_pid_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi { $as_echo "$as_me:$LINENO: checking for size_t" >&5 $as_echo_n "checking for size_t... " >&6; } if test "${ac_cv_type_size_t+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_type_size_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof (size_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if (sizeof ((size_t))) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 $as_echo "$ac_cv_type_size_t" >&6; } if test "x$ac_cv_type_size_t" = x""yes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi { $as_echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if test "${ac_cv_c_bigendian+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # Check for potential -arch flags. It is not universal unless # there are some -arch flags. Note that *ppc* also matches # ppc64. This check is also rather less than ideal. case "${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" in #( *-arch*ppc*|*-arch*i386*|*-arch*x86_64*) ac_cv_c_bigendian=universal;; esac else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # It does; now see whether it defined to _BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then # Try to guess by grepping values from an object file. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=no else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_bigendian=yes fi rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) cat >>confdefs.h <<\_ACEOF #define WORDS_BIGENDIAN 1 _ACEOF ;; #( no) ;; #( universal) cat >>confdefs.h <<\_ACEOF #define AC_APPLE_UNIVERSAL_BUILD 1 _ACEOF ;; #( *) { { $as_echo "$as_me:$LINENO: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&5 $as_echo "$as_me: error: unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; esac { $as_echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } if test "${ac_cv_lib_socket_socket+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_socket_socket=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_socket=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } if test "x$ac_cv_lib_socket_socket" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBSOCKET 1 _ACEOF LIBS="-lsocket $LIBS" fi { $as_echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; } if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_nsl_gethostbyname=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_gethostbyname=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } if test "x$ac_cv_lib_nsl_gethostbyname" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBNSL 1 _ACEOF LIBS="-lnsl $LIBS" fi { $as_echo "$as_me:$LINENO: checking for sched_getscheduler in -lrt" >&5 $as_echo_n "checking for sched_getscheduler in -lrt... " >&6; } if test "${ac_cv_lib_rt_sched_getscheduler+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lrt $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char sched_getscheduler (); int main () { return sched_getscheduler (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_lib_rt_sched_getscheduler=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_rt_sched_getscheduler=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:$LINENO: result: $ac_cv_lib_rt_sched_getscheduler" >&5 $as_echo "$ac_cv_lib_rt_sched_getscheduler" >&6; } if test "x$ac_cv_lib_rt_sched_getscheduler" = x""yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBRT 1 _ACEOF LIBS="-lrt $LIBS" fi { $as_echo "$as_me:$LINENO: checking for getaddrinfo" >&5 $as_echo_n "checking for getaddrinfo... " >&6; } if test "${ac_cv_func_getaddrinfo+set}" = set; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define getaddrinfo to an innocuous variant, in case declares getaddrinfo. For example, HP-UX 11i declares gettimeofday. */ #define getaddrinfo innocuous_getaddrinfo /* System header to define __stub macros and hopefully few prototypes, which can conflict with char getaddrinfo (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef getaddrinfo /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char getaddrinfo (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_getaddrinfo || defined __stub___getaddrinfo choke me #endif int main () { return getaddrinfo (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ac_cv_func_getaddrinfo=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_getaddrinfo=no fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:$LINENO: result: $ac_cv_func_getaddrinfo" >&5 $as_echo "$ac_cv_func_getaddrinfo" >&6; } if test "x$ac_cv_func_getaddrinfo" = x""yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_GETADDRINFO 1 _ACEOF fi # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 $as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} { (exit 1); exit 1; }; } { $as_echo "$as_me:$LINENO: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if test "${ac_cv_build+set}" = set; then $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 $as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 $as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi { $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 $as_echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:$LINENO: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if test "${ac_cv_host+set}" = set; then $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 $as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 $as_echo "$as_me: error: invalid value of canonical host" >&2;} { (exit 1); exit 1; }; };; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" { $as_echo "$as_me:$LINENO: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 $as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_join (); int main () { return pthread_join (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then acx_pthread_ok=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext { $as_echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5 $as_echo "$acx_pthread_ok" >&6; } if test x"$acx_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all. acx_pthread_flags="pthread-config pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthread-config: use pthread-config program (on NetBSD) # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # pthread: Linux, etcetera # --thread-safe: KAI C++ case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthread or # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" ;; esac if test x"$acx_pthread_ok" = xno; then for flag in $acx_pthread_flags; do case $flag in none) { $as_echo "$as_me:$LINENO: checking whether pthreads work without any flags" >&5 $as_echo_n "checking whether pthreads work without any flags... " >&6; } ;; -*) { $as_echo "$as_me:$LINENO: checking whether pthreads work with $flag" >&5 $as_echo_n "checking whether pthreads work with $flag... " >&6; } PTHREAD_CFLAGS="$flag" ;; pthread-config) # Extract the first word of "pthread-config", so it can be a program name with args. set dummy pthread-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_acx_pthread_config+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$acx_pthread_config"; then ac_cv_prog_acx_pthread_config="$acx_pthread_config" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_acx_pthread_config="yes" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no" fi fi acx_pthread_config=$ac_cv_prog_acx_pthread_config if test -n "$acx_pthread_config"; then { $as_echo "$as_me:$LINENO: result: $acx_pthread_config" >&5 $as_echo "$acx_pthread_config" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test x"$acx_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) { $as_echo "$as_me:$LINENO: checking for the pthreads library -l$flag" >&5 $as_echo_n "checking for the pthreads library -l$flag... " >&6; } PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_create(0,0,0,0); pthread_cleanup_pop(0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then acx_pthread_ok=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" { $as_echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5 $as_echo "$acx_pthread_ok" >&6; } if test "x$acx_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$acx_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: threads are created detached by default # and the JOINABLE attribute has a nonstandard name (UNDETACHED). { $as_echo "$as_me:$LINENO: checking for joinable pthread attribute" >&5 $as_echo_n "checking for joinable pthread attribute... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { int attr=PTHREAD_CREATE_JOINABLE; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ok=PTHREAD_CREATE_JOINABLE else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ok=unknown fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test x"$ok" = xunknown; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { int attr=PTHREAD_CREATE_UNDETACHED; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then ok=PTHREAD_CREATE_UNDETACHED else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ok=unknown fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then cat >>confdefs.h <<\_ACEOF #define PTHREAD_CREATE_JOINABLE $ok _ACEOF fi { $as_echo "$as_me:$LINENO: result: ${ok}" >&5 $as_echo "${ok}" >&6; } if test x"$ok" = xunknown; then { $as_echo "$as_me:$LINENO: WARNING: we do not know how to create joinable pthreads" >&5 $as_echo "$as_me: WARNING: we do not know how to create joinable pthreads" >&2;} fi { $as_echo "$as_me:$LINENO: checking if more special flags are required for pthreads" >&5 $as_echo_n "checking if more special flags are required for pthreads... " >&6; } flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac { $as_echo "$as_me:$LINENO: result: ${flag}" >&5 $as_echo "${flag}" >&6; } if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with cc_r # Extract the first word of "cc_r", so it can be a program name with args. set dummy cc_r; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_PTHREAD_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$PTHREAD_CC"; then ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_PTHREAD_CC="cc_r" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_PTHREAD_CC" && ac_cv_prog_PTHREAD_CC="${CC}" fi fi PTHREAD_CC=$ac_cv_prog_PTHREAD_CC if test -n "$PTHREAD_CC"; then { $as_echo "$as_me:$LINENO: result: $PTHREAD_CC" >&5 $as_echo "$PTHREAD_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi else PTHREAD_CC="$CC" fi # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then cat >>confdefs.h <<\_ACEOF #define HAVE_PTHREAD 1 _ACEOF : else acx_pthread_ok=no { { $as_echo "$as_me:$LINENO: error: pthread library not found " >&5 $as_echo "$as_me: error: pthread library not found " >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu SYSTEM_INCLUDE=/usr/include # Check whether --with-lame was given. if test "${with_lame+set}" = set; then withval=$with_lame; USE_LAME=${withval} else USE_LAME="yes" fi # Check whether --with-lame-prefix was given. if test "${with_lame_prefix+set}" = set; then withval=$with_lame_prefix; CONFIG_LAME_PREFIX="${withval}" else CONFIG_LAME_PREFIX="/usr" fi if test "x${USE_LAME}" = "xyes" ; then { $as_echo "$as_me:$LINENO: checking for lame library at ${CONFIG_LAME_PREFIX} " >&5 $as_echo_n "checking for lame library at ${CONFIG_LAME_PREFIX} ... " >&6; } LAME_LIB_LOC= for FILE in libmp3lame.a libmp3lame.so; do for DIR in ${CONFIG_LAME_PREFIX} ${CONFIG_LAME_PREFIX}/lib64 ${CONFIG_LAME_PREFIX}/lib ; do if test ".LAME_LIB_LOC"="." && test -f "$DIR/$FILE"; then LAME_LIB_LOC=$DIR fi done done LAME_INC_LOC= for FILE in lame/lame.h; do for DIR in ${CONFIG_LAME_PREFIX} ${CONFIG_LAME_PREFIX}/include ; do if test ".LAME_INC_LOC"="." && test -f "$DIR/$FILE"; then LAME_INC_LOC=$DIR fi done done if test ".LAME_LIB_LOC" = "." || test ".LAME_INC_LOC" = "."; then LAME_LIB_LOC= LAME_INC_LOC= fi if test "x${LAME_LIB_LOC}" != "x" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_LAME_LIB 1 _ACEOF if test "x${LAME_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then LAME_INCFLAGS="-I${LAME_INC_LOC}" fi LAME_LDFLAGS="-L${LAME_LIB_LOC} -lmp3lame" { $as_echo "$as_me:$LINENO: result: found at ${CONFIG_LAME_PREFIX} " >&5 $as_echo "found at ${CONFIG_LAME_PREFIX} " >&6; } else { $as_echo "$as_me:$LINENO: WARNING: not found, building without lame" >&5 $as_echo "$as_me: WARNING: not found, building without lame" >&2;} fi else { $as_echo "$as_me:$LINENO: result: building without lame " >&5 $as_echo "building without lame " >&6; } fi # Check whether --with-vorbis was given. if test "${with_vorbis+set}" = set; then withval=$with_vorbis; USE_VORBIS=${withval} else USE_VORBIS="yes" fi # Check whether --with-vorbis-prefix was given. if test "${with_vorbis_prefix+set}" = set; then withval=$with_vorbis_prefix; CONFIG_VORBIS_PREFIX="${withval}" else CONFIG_VORBIS_PREFIX="/usr" fi if test "x${USE_VORBIS}" = "xyes" ; then { $as_echo "$as_me:$LINENO: checking for vorbis libraries at ${CONFIG_VORBIS_PREFIX} " >&5 $as_echo_n "checking for vorbis libraries at ${CONFIG_VORBIS_PREFIX} ... " >&6; } OGG_LIB_LOC= for FILE in libogg.a libogg.so; do for DIR in ${CONFIG_VORBIS_PREFIX} ${CONFIG_VORBIS_PREFIX}/lib64 ${CONFIG_VORBIS_PREFIX}/lib ; do if test ".OGG_LIB_LOC"="." && test -f "$DIR/$FILE"; then OGG_LIB_LOC=$DIR fi done done OGG_INC_LOC= for FILE in ogg/ogg.h; do for DIR in ${CONFIG_VORBIS_PREFIX} ${CONFIG_VORBIS_PREFIX}/include ; do if test ".OGG_INC_LOC"="." && test -f "$DIR/$FILE"; then OGG_INC_LOC=$DIR fi done done if test ".OGG_LIB_LOC" = "." || test ".OGG_INC_LOC" = "."; then OGG_LIB_LOC= OGG_INC_LOC= fi VORBIS_LIB_LOC= for FILE in libvorbis.a libvorbis.so; do for DIR in ${CONFIG_VORBIS_PREFIX} ${CONFIG_VORBIS_PREFIX}/lib64 ${CONFIG_VORBIS_PREFIX}/lib ; do if test ".VORBIS_LIB_LOC"="." && test -f "$DIR/$FILE"; then VORBIS_LIB_LOC=$DIR fi done done VORBIS_INC_LOC= for FILE in vorbis/codec.h; do for DIR in ${CONFIG_VORBIS_PREFIX} ${CONFIG_VORBIS_PREFIX}/include ; do if test ".VORBIS_INC_LOC"="." && test -f "$DIR/$FILE"; then VORBIS_INC_LOC=$DIR fi done done if test ".VORBIS_LIB_LOC" = "." || test ".VORBIS_INC_LOC" = "."; then VORBIS_LIB_LOC= VORBIS_INC_LOC= fi VORBISENC_LIB_LOC= for FILE in libvorbisenc.a libvorbisenc.so; do for DIR in ${CONFIG_VORBIS_PREFIX} ${CONFIG_VORBIS_PREFIX}/lib64 ${CONFIG_VORBIS_PREFIX}/lib ; do if test ".VORBISENC_LIB_LOC"="." && test -f "$DIR/$FILE"; then VORBISENC_LIB_LOC=$DIR fi done done VORBISENC_INC_LOC= for FILE in vorbis/vorbisenc.h; do for DIR in ${CONFIG_VORBIS_PREFIX} ${CONFIG_VORBIS_PREFIX}/include ; do if test ".VORBISENC_INC_LOC"="." && test -f "$DIR/$FILE"; then VORBISENC_INC_LOC=$DIR fi done done if test ".VORBISENC_LIB_LOC" = "." || test ".VORBISENC_INC_LOC" = "."; then VORBISENC_LIB_LOC= VORBISENC_INC_LOC= fi if test "x${OGG_LIB_LOC}" != "x" -a \ "x${VORBIS_LIB_LOC}" != "x" -a \ "x${VORBISENC_LIB_LOC}" != "x" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_VORBIS_LIB 1 _ACEOF if test "x${OGG_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then VORBIS_INCFLAGS="-I${OGG_INC_LOC}" fi VORBIS_LDFLAGS="-L${OGG_LIB_LOC} -logg -lvorbis -lvorbisenc" { $as_echo "$as_me:$LINENO: result: found at ${CONFIG_VORBIS_PREFIX} " >&5 $as_echo "found at ${CONFIG_VORBIS_PREFIX} " >&6; } else { $as_echo "$as_me:$LINENO: WARNING: not found, building without Ogg Vorbis" >&5 $as_echo "$as_me: WARNING: not found, building without Ogg Vorbis" >&2;} fi else { $as_echo "$as_me:$LINENO: result: building without Ogg Vorbis " >&5 $as_echo "building without Ogg Vorbis " >&6; } fi # Check whether --with-faac was given. if test "${with_faac+set}" = set; then withval=$with_faac; USE_FAAC=${withval} else USE_FAAC="yes" fi # Check whether --with-faac-prefix was given. if test "${with_faac_prefix+set}" = set; then withval=$with_faac_prefix; CONFIG_FAAC_PREFIX="${withval}" else CONFIG_FAAC_PREFIX="/usr" fi if test "x${USE_FAAC}" = "xyes" ; then { $as_echo "$as_me:$LINENO: checking for faac library at ${CONFIG_FAAC_PREFIX} " >&5 $as_echo_n "checking for faac library at ${CONFIG_FAAC_PREFIX} ... " >&6; } FAAC_LIB_LOC= for FILE in libfaac.a libfaac.so; do for DIR in ${CONFIG_FAAC_PREFIX} ${CONFIG_FAAC_PREFIX}/lib64 ${CONFIG_FAAC_PREFIX}/lib ; do if test ".FAAC_LIB_LOC"="." && test -f "$DIR/$FILE"; then FAAC_LIB_LOC=$DIR fi done done FAAC_INC_LOC= for FILE in faac.h; do for DIR in ${CONFIG_FAAC_PREFIX} ${CONFIG_FAAC_PREFIX}/include ; do if test ".FAAC_INC_LOC"="." && test -f "$DIR/$FILE"; then FAAC_INC_LOC=$DIR fi done done if test ".FAAC_LIB_LOC" = "." || test ".FAAC_INC_LOC" = "."; then FAAC_LIB_LOC= FAAC_INC_LOC= fi if test "x${FAAC_LIB_LOC}" != "x" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_FAAC_LIB 1 _ACEOF if test "x${FAAC_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then FAAC_INCFLAGS="-I${FAAC_INC_LOC}" fi FAAC_LDFLAGS="-L${FAAC_LIB_LOC} -lfaac" { $as_echo "$as_me:$LINENO: result: found at ${CONFIG_FAAC_PREFIX} " >&5 $as_echo "found at ${CONFIG_FAAC_PREFIX} " >&6; } else { $as_echo "$as_me:$LINENO: WARNING: not found, building without faac" >&5 $as_echo "$as_me: WARNING: not found, building without faac" >&2;} fi else { $as_echo "$as_me:$LINENO: result: building without faac " >&5 $as_echo "building without faac " >&6; } fi # Check whether --with-aacplus was given. if test "${with_aacplus+set}" = set; then withval=$with_aacplus; USE_AACPLUS=${withval} else USE_AACPLUS="yes" fi # Check whether --with-aacplus-prefix was given. if test "${with_aacplus_prefix+set}" = set; then withval=$with_aacplus_prefix; CONFIG_AACPLUS_PREFIX="${withval}" else CONFIG_AACPLUS_PREFIX="/usr" fi if test "x${USE_AACPLUS}" = "xyes" ; then { $as_echo "$as_me:$LINENO: checking for aacplus library at ${CONFIG_AACPLUS_PREFIX} " >&5 $as_echo_n "checking for aacplus library at ${CONFIG_AACPLUS_PREFIX} ... " >&6; } AACPLUS_LIB_LOC= for FILE in libaacplus.a libaacplus.so; do for DIR in ${CONFIG_AACPLUS_PREFIX} ${CONFIG_AACPLUS_PREFIX}/lib64 ${CONFIG_AACPLUS_PREFIX}/lib ; do if test ".AACPLUS_LIB_LOC"="." && test -f "$DIR/$FILE"; then AACPLUS_LIB_LOC=$DIR fi done done AACPLUS_INC_LOC= for FILE in sbr_main.h; do for DIR in ${CONFIG_AACPLUS_PREFIX} ${CONFIG_AACPLUS_PREFIX}/include ; do if test ".AACPLUS_INC_LOC"="." && test -f "$DIR/$FILE"; then AACPLUS_INC_LOC=$DIR fi done done if test ".AACPLUS_LIB_LOC" = "." || test ".AACPLUS_INC_LOC" = "."; then AACPLUS_LIB_LOC= AACPLUS_INC_LOC= fi if test "x${AACPLUS_LIB_LOC}" != "x" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_AACPLUS_LIB 1 _ACEOF if test "x${AACPLUS_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then AACPLUS_INCFLAGS="-I${AACPLUS_INC_LOC}" fi AACPLUS_LDFLAGS="-L${AACPLUS_LIB_LOC} -laacplus" { $as_echo "$as_me:$LINENO: result: found at ${CONFIG_AACPLUS_PREFIX} " >&5 $as_echo "found at ${CONFIG_AACPLUS_PREFIX} " >&6; } else { $as_echo "$as_me:$LINENO: WARNING: not found, building without aacplus" >&5 $as_echo "$as_me: WARNING: not found, building without aacplus" >&2;} fi else { $as_echo "$as_me:$LINENO: result: building without aacplus " >&5 $as_echo "building without aacplus " >&6; } fi # Check whether --with-twolame was given. if test "${with_twolame+set}" = set; then withval=$with_twolame; USE_TWOLAME=${withval} else USE_TWOLAME="yes" fi # Check whether --with-twolame-prefix was given. if test "${with_twolame_prefix+set}" = set; then withval=$with_twolame_prefix; CONFIG_TWOLAME_PREFIX="${withval}" else CONFIG_TWOLAME_PREFIX="/usr" fi if test "x${USE_TWOLAME}" = "xyes" ; then { $as_echo "$as_me:$LINENO: checking for twolame library at ${CONFIG_TWOLAME_PREFIX} " >&5 $as_echo_n "checking for twolame library at ${CONFIG_TWOLAME_PREFIX} ... " >&6; } TWOLAME_LIB_LOC= for FILE in libtwolame.a libtwolame.so; do for DIR in ${CONFIG_TWOLAME_PREFIX} ${CONFIG_TWOLAME_PREFIX}/lib64 ${CONFIG_TWOLAME_PREFIX}/lib ; do if test ".TWOLAME_LIB_LOC"="." && test -f "$DIR/$FILE"; then TWOLAME_LIB_LOC=$DIR fi done done TWOLAME_INC_LOC= for FILE in twolame.h; do for DIR in ${CONFIG_TWOLAME_PREFIX} ${CONFIG_TWOLAME_PREFIX}/include ; do if test ".TWOLAME_INC_LOC"="." && test -f "$DIR/$FILE"; then TWOLAME_INC_LOC=$DIR fi done done if test ".TWOLAME_LIB_LOC" = "." || test ".TWOLAME_INC_LOC" = "."; then TWOLAME_LIB_LOC= TWOLAME_INC_LOC= fi if test "x${TWOLAME_LIB_LOC}" != "x" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_TWOLAME_LIB 1 _ACEOF if test "x${TWOLAME_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then TWOLAME_INCFLAGS="-I${TWOLAME_INC_LOC}" fi TWOLAME_LDFLAGS="-L${TWOLAME_LIB_LOC} -ltwolame" { $as_echo "$as_me:$LINENO: result: found at ${CONFIG_TWOLAME_PREFIX} " >&5 $as_echo "found at ${CONFIG_TWOLAME_PREFIX} " >&6; } else { $as_echo "$as_me:$LINENO: WARNING: not found, building without twolame" >&5 $as_echo "$as_me: WARNING: not found, building without twolame" >&2;} fi else { $as_echo "$as_me:$LINENO: result: building without twolame " >&5 $as_echo "building without twolame " >&6; } fi if test "x${LAME_LDFLAGS}" = "x" \ -a "x${VORBIS_LDFLAGS}" = "x" \ -a "x${FAAC_LDFLAGS}" = "x" \ -a "x${AACPLUS_LDFLAGS}" = "x" \ -a "x${TWOLAME_LDFLAGS}" = "x"; then { { $as_echo "$as_me:$LINENO: error: neither lame, Ogg Vorbis, faac, aac+ nor twolame configured" >&5 $as_echo "$as_me: error: neither lame, Ogg Vorbis, faac, aac+ nor twolame configured" >&2;} { (exit 1); exit 1; }; } fi # Check whether --with-alsa was given. if test "${with_alsa+set}" = set; then withval=$with_alsa; USE_ALSA=${withval} else USE_ALSA="yes" fi # Check whether --with-alsa-prefix was given. if test "${with_alsa_prefix+set}" = set; then withval=$with_alsa_prefix; CONFIG_ALSA_PREFIX="${withval}" else CONFIG_ALSA_PREFIX="/usr" fi if test "x${USE_ALSA}" = "xyes" ; then { $as_echo "$as_me:$LINENO: checking for alsa libraries at ${CONFIG_ALSA_PREFIX} " >&5 $as_echo_n "checking for alsa libraries at ${CONFIG_ALSA_PREFIX} ... " >&6; } ALSA_LIB_LOC= for FILE in libasound.so; do for DIR in ${CONFIG_ALSA_PREFIX} ${CONFIG_ALSA_PREFIX}/lib64 ${CONFIG_ALSA_PREFIX}/lib ; do if test ".ALSA_LIB_LOC"="." && test -f "$DIR/$FILE"; then ALSA_LIB_LOC=$DIR fi done done ALSA_INC_LOC= for FILE in alsa/asoundlib.h; do for DIR in ${CONFIG_ALSA_PREFIX} ${CONFIG_ALSA_PREFIX}/include ; do if test ".ALSA_INC_LOC"="." && test -f "$DIR/$FILE"; then ALSA_INC_LOC=$DIR fi done done if test ".ALSA_LIB_LOC" = "." || test ".ALSA_INC_LOC" = "."; then ALSA_LIB_LOC= ALSA_INC_LOC= fi if test "x${ALSA_LIB_LOC}" != "x" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_ALSA_LIB 1 _ACEOF if test "x${ALSA_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then ALSA_INCFLAGS="-I${ALSA_INC_LOC}" fi ALSA_LDFLAGS="-L${ALSA_LIB_LOC} -lasound" { $as_echo "$as_me:$LINENO: result: found at ${CONFIG_ALSA_PREFIX} " >&5 $as_echo "found at ${CONFIG_ALSA_PREFIX} " >&6; } else { $as_echo "$as_me:$LINENO: WARNING: not found, building without ALSA support" >&5 $as_echo "$as_me: WARNING: not found, building without ALSA support" >&2;} fi else { $as_echo "$as_me:$LINENO: result: building without ALSA support " >&5 $as_echo "building without ALSA support " >&6; } fi # Check whether --with-jack was given. if test "${with_jack+set}" = set; then withval=$with_jack; USE_JACK=${withval} else USE_JACK="yes" fi # Check whether --with-jack-prefix was given. if test "${with_jack_prefix+set}" = set; then withval=$with_jack_prefix; CONFIG_JACK_PREFIX="${withval}" else CONFIG_JACK_PREFIX="/usr" fi if test "x${USE_JACK}" = "xyes" ; then { $as_echo "$as_me:$LINENO: checking for jack libraries at ${CONFIG_JACK_PREFIX} " >&5 $as_echo_n "checking for jack libraries at ${CONFIG_JACK_PREFIX} ... " >&6; } JACK_LIB_LOC= for FILE in libjack.la libjack.so libjack.dylib; do for DIR in ${CONFIG_JACK_PREFIX} ${CONFIG_JACK_PREFIX}/lib64 ${CONFIG_JACK_PREFIX}/lib ; do if test ".JACK_LIB_LOC"="." && test -f "$DIR/$FILE"; then JACK_LIB_LOC=$DIR fi done done JACK_INC_LOC= for FILE in jack/jack.h; do for DIR in ${CONFIG_JACK_PREFIX} ${CONFIG_JACK_PREFIX}/include ; do if test ".JACK_INC_LOC"="." && test -f "$DIR/$FILE"; then JACK_INC_LOC=$DIR fi done done if test ".JACK_LIB_LOC" = "." || test ".JACK_INC_LOC" = "."; then JACK_LIB_LOC= JACK_INC_LOC= fi if test "x${JACK_LIB_LOC}" != "x" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_JACK_LIB 1 _ACEOF if test "x${JACK_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then JACK_INCFLAGS="-I${JACK_INC_LOC}" fi JACK_LDFLAGS="-L${JACK_LIB_LOC} -ljack" { $as_echo "$as_me:$LINENO: result: found at ${CONFIG_JACK_PREFIX} " >&5 $as_echo "found at ${CONFIG_JACK_PREFIX} " >&6; } else { $as_echo "$as_me:$LINENO: WARNING: not found, building without JACK support" >&5 $as_echo "$as_me: WARNING: not found, building without JACK support" >&2;} fi else { $as_echo "$as_me:$LINENO: result: building without JACK support " >&5 $as_echo "building without JACK support " >&6; } fi # Check whether --with-samplerate was given. if test "${with_samplerate+set}" = set; then withval=$with_samplerate; USE_SRC=${withval} else USE_SRC="yes" fi # Check whether --with-samplerate-prefix was given. if test "${with_samplerate_prefix+set}" = set; then withval=$with_samplerate_prefix; CONFIG_SRC_PREFIX="${withval}" else CONFIG_SRC_PREFIX="/usr" fi if test "x${USE_SRC}" = "xyes" ; then { $as_echo "$as_me:$LINENO: checking for samplerate libraries at ${CONFIG_SRC_PREFIX} " >&5 $as_echo_n "checking for samplerate libraries at ${CONFIG_SRC_PREFIX} ... " >&6; } SRC_LIB_LOC= for FILE in libsamplerate.la libsamplerate.so libsamplerate.dylib; do for DIR in ${CONFIG_SRC_PREFIX} ${CONFIG_SRC_PREFIX}/lib64 ${CONFIG_SRC_PREFIX}/lib ; do if test ".SRC_LIB_LOC"="." && test -f "$DIR/$FILE"; then SRC_LIB_LOC=$DIR fi done done SRC_INC_LOC= for FILE in samplerate.h; do for DIR in ${CONFIG_SRC_PREFIX} ${CONFIG_SRC_PREFIX}/include ; do if test ".SRC_INC_LOC"="." && test -f "$DIR/$FILE"; then SRC_INC_LOC=$DIR fi done done if test ".SRC_LIB_LOC" = "." || test ".SRC_INC_LOC" = "."; then SRC_LIB_LOC= SRC_INC_LOC= fi if test "x${SRC_LIB_LOC}" != "x" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_SRC_LIB 1 _ACEOF if test "x${SRC_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then SRC_INCFLAGS="-I${SRC_INC_LOC}" fi SRC_LDFLAGS="-L${SRC_LIB_LOC} -lsamplerate" { $as_echo "$as_me:$LINENO: result: found at ${CONFIG_SRC_PREFIX} " >&5 $as_echo "found at ${CONFIG_SRC_PREFIX} " >&6; } else { $as_echo "$as_me:$LINENO: WARNING: not found, building libsamplerate support" >&5 $as_echo "$as_me: WARNING: not found, building libsamplerate support" >&2;} fi else { $as_echo "$as_me:$LINENO: result: building without libsamplerate support " >&5 $as_echo "building without libsamplerate support " >&6; } fi if test "x${SRC_LIB_LOC}" != "x"; then HAVE_SRC_LIB_TRUE= HAVE_SRC_LIB_FALSE='#' else HAVE_SRC_LIB_TRUE='#' HAVE_SRC_LIB_FALSE= fi { $as_echo "$as_me:$LINENO: checking for MSG_NOSIGNAL" >&5 $as_echo_n "checking for MSG_NOSIGNAL... " >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { int f = MSG_NOSIGNAL; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then # Yes, we have it... { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_MSG_NOSIGNAL 1 _ACEOF else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # We'll have to use signals { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext for ac_func in sched_getscheduler sched_getparam do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 $as_echo_n "checking for $ac_func... " >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then eval "$as_ac_var=yes" else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } as_val=`eval 'as_val=${'$as_ac_var'} $as_echo "$as_val"'` if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # Check whether --with-debug was given. if test "${with_debug+set}" = set; then withval=$with_debug; USE_DEBUG=${withval} else USE_DEBUG="no" fi if test "x${USE_DEBUG}" == "xyes" ; then DEBUG_CXXFLAGS="-g" { $as_echo "$as_me:$LINENO: result: compiling in debug mode" >&5 $as_echo "compiling in debug mode" >&6; } else { $as_echo "$as_me:$LINENO: result: not compiling in debug mode" >&5 $as_echo "not compiling in debug mode" >&6; } fi ac_config_files="$ac_config_files Makefile src/Makefile man/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${HAVE_SRC_LIB_TRUE}" && test -z "${HAVE_SRC_LIB_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_SRC_LIB\" was never defined. Usually this means the macro was only invoked conditionally." >&5 $as_echo "$as_me: error: conditional \"HAVE_SRC_LIB\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by darkice $as_me 1.0, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTION]... [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ darkice config.status 1.0 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2008 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { $as_echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { $as_echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 $as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { $as_echo "$as_me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=' ' ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\).*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\).*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 $as_echo "$as_me: error: could not setup config files machinery" >&2;} { (exit 1); exit 1; }; } _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 $as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 $as_echo "$as_me: error: could not setup config headers machinery" >&2;} { (exit 1); exit 1; }; } fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 $as_echo "$as_me: error: invalid tag $ac_tag" >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac ac_file_inputs="$ac_file_inputs '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 $as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 $as_echo "$as_me: error: could not create -" >&2;} { (exit 1); exit 1; }; } fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir=$dirpart/$fdir case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 $as_echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 $as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi darkice-1.0/README0000644000175000001440000000307511371615153010561 00000000000000DarkIce live audio streamer, http://code.google.com/p/darkice/ Copyright (c) 2000-2007, Tyrell Hungary, http://tyrell.hu/ Copyright (c) 2008, Ákos Maróy, akos@maroy.hu Copyright (c) 2009, Rafael Diniz, rafael@riseup.net Contents -------- 1. What is DarkIce? 2. Compiling and installing 3. Reporting crashes 1. What is DarkIce? ------------------- DarkIce is an IceCast, IceCast2 and ShoutCast live audio streamer. It takes audio input from a sound card, encodes it into mp3 and/or Ogg Vorbis, and sends the mp3 stream to one or more IceCast and/or ShoutCast servers, the Ogg Vorbis stream to one or more IceCast2 servers. DarkIce website: http://code.google.com/p/darkice/ 2. Compiling and installing --------------------------- On how to compile and install, please read the file INSTALL. If you're impatient, try: ./configure make The executable built is src/darkice. To install, try as root: make install For documentation, try: man darkice 3. Reporting crashes -------------------- When DarkIce core dumps, please send the backtrace along with your error report to the darkice mailing list: http://www.freelists.org/list/darkice Alternatively you could file a bug report at http://code.google.com/p/darkice/issues/list To get the backtrace information, you need gdb, the GNU debugger: 1. configure and compile using the --with-debug option: ./configure --with-debug=yes make clean all 2. run darkice from within gdb: gdb src/darkice 3. set parameters within gdb: (gdb) set args -c darkice.cfg 4. run: (gdb) run 5. after coredump, print the backtrace: (gdb) bt darkice-1.0/configure.in0000644000175000001440000003535111371625561012220 00000000000000dnl Process this file with autoconf to produce a configure script. AC_INIT(darkice, 1.0) AC_CONFIG_SRCDIR(src/DarkIce.cpp) AM_CONFIG_HEADER(src/config.h) AM_INIT_AUTOMAKE AC_PROG_CC AC_PROG_CXX AC_PROG_INSTALL dnl AC_STDC_HEADERS AC_HAVE_HEADERS(errno.h fcntl.h stdio.h stdlib.h string.h unistd.h limits.h) AC_HAVE_HEADERS(signal.h time.h sys/time.h sys/types.h sys/wait.h math.h) AC_HAVE_HEADERS(netdb.h netinet/in.h sys/ioctl.h sys/socket.h sys/stat.h) AC_HAVE_HEADERS(sched.h pthread.h termios.h) AC_HAVE_HEADERS(sys/soundcard.h sys/audio.h sys/audioio.h) AC_HEADER_SYS_WAIT() AC_TYPE_PID_T() AC_TYPE_SIZE_T() AC_C_BIGENDIAN() AC_CHECK_LIB(socket, socket) AC_CHECK_LIB(nsl, gethostbyname) AC_CHECK_LIB(rt, sched_getscheduler) AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO, 1, [Does function getaddrinfo exist?] )) dnl----------------------------------------------------------------------------- dnl funky posix threads checking, thanks to dnl Steven G. Johnson dnl and Alejandro Forero Cuervo dnl see http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html dnl----------------------------------------------------------------------------- ACX_PTHREAD(, AC_MSG_ERROR( [pthread library not found] )) SYSTEM_INCLUDE=/usr/include dnl----------------------------------------------------------------------------- dnl link the lame library if requested dnl----------------------------------------------------------------------------- AC_SUBST(LAME_INCFLAGS) AC_SUBST(LAME_LDFLAGS) AC_ARG_WITH(lame, [ --with-lame use lame for encoding mp3 streams [yes] ], USE_LAME=${withval}, USE_LAME="yes" ) AC_ARG_WITH(lame-prefix, [ --with-lame-prefix=DIR alternate location for lame [/usr] look for libraries in LAME-PREFIX/lib, for headers in LAME-PREFIX/include], CONFIG_LAME_PREFIX="${withval}", CONFIG_LAME_PREFIX="/usr") if test "x${USE_LAME}" = "xyes" ; then AC_MSG_CHECKING( [for lame library at ${CONFIG_LAME_PREFIX}] ) LA_SEARCH_LIB( LAME_LIB_LOC, LAME_INC_LOC, libmp3lame.a libmp3lame.so, lame/lame.h, ${CONFIG_LAME_PREFIX}) if test "x${LAME_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_LAME_LIB, 1, [build with lame library] ) if test "x${LAME_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then LAME_INCFLAGS="-I${LAME_INC_LOC}" fi LAME_LDFLAGS="-L${LAME_LIB_LOC} -lmp3lame" AC_MSG_RESULT( [found at ${CONFIG_LAME_PREFIX}] ) else AC_MSG_WARN( [not found, building without lame]) fi else AC_MSG_RESULT( [building without lame] ) fi dnl----------------------------------------------------------------------------- dnl link the ogg vorbis libraries if requested dnl----------------------------------------------------------------------------- AC_SUBST(VORBIS_INCFLAGS) AC_SUBST(VORBIS_LDFLAGS) AC_ARG_WITH(vorbis, [ --with-vorbis use Ogg Vorbis for encoding vorbis streams [yes] ], USE_VORBIS=${withval}, USE_VORBIS="yes" ) AC_ARG_WITH(vorbis-prefix, [ --with-vorbis-prefix=DIR alternate location for vorbis [/usr] look for libraries in VORBIS-PREFIX/lib, for headers in VORBIS-PREFIX/include], CONFIG_VORBIS_PREFIX="${withval}", CONFIG_VORBIS_PREFIX="/usr") if test "x${USE_VORBIS}" = "xyes" ; then AC_MSG_CHECKING( [for vorbis libraries at ${CONFIG_VORBIS_PREFIX}] ) LA_SEARCH_LIB( OGG_LIB_LOC, OGG_INC_LOC, libogg.a libogg.so, ogg/ogg.h, ${CONFIG_VORBIS_PREFIX}) LA_SEARCH_LIB( VORBIS_LIB_LOC, VORBIS_INC_LOC, libvorbis.a libvorbis.so, vorbis/codec.h, ${CONFIG_VORBIS_PREFIX}) LA_SEARCH_LIB( VORBISENC_LIB_LOC, VORBISENC_INC_LOC, libvorbisenc.a libvorbisenc.so, vorbis/vorbisenc.h, ${CONFIG_VORBIS_PREFIX}) if test "x${OGG_LIB_LOC}" != "x" -a \ "x${VORBIS_LIB_LOC}" != "x" -a \ "x${VORBISENC_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_VORBIS_LIB, 1, [build with Ogg Vorbis library] ) if test "x${OGG_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then VORBIS_INCFLAGS="-I${OGG_INC_LOC}" fi VORBIS_LDFLAGS="-L${OGG_LIB_LOC} -logg -lvorbis -lvorbisenc" AC_MSG_RESULT( [found at ${CONFIG_VORBIS_PREFIX}] ) else AC_MSG_WARN( [not found, building without Ogg Vorbis]) fi else AC_MSG_RESULT( [building without Ogg Vorbis] ) fi dnl----------------------------------------------------------------------------- dnl link the faac library if requested dnl----------------------------------------------------------------------------- AC_SUBST(FAAC_INCFLAGS) AC_SUBST(FAAC_LDFLAGS) AC_ARG_WITH(faac, [ --with-faac use faac for encoding AAC streams [yes] ], USE_FAAC=${withval}, USE_FAAC="yes" ) AC_ARG_WITH(faac-prefix, [ --with-faac-prefix=DIR alternate location for faac [/usr] look for libraries in FAAC-PREFIX/lib, for headers in FAAC-PREFIX/include], CONFIG_FAAC_PREFIX="${withval}", CONFIG_FAAC_PREFIX="/usr") if test "x${USE_FAAC}" = "xyes" ; then AC_MSG_CHECKING( [for faac library at ${CONFIG_FAAC_PREFIX}] ) LA_SEARCH_LIB( FAAC_LIB_LOC, FAAC_INC_LOC, libfaac.a libfaac.so, faac.h, ${CONFIG_FAAC_PREFIX}) if test "x${FAAC_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_FAAC_LIB, 1, [build with faac library] ) if test "x${FAAC_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then FAAC_INCFLAGS="-I${FAAC_INC_LOC}" fi FAAC_LDFLAGS="-L${FAAC_LIB_LOC} -lfaac" AC_MSG_RESULT( [found at ${CONFIG_FAAC_PREFIX}] ) else AC_MSG_WARN( [not found, building without faac]) fi else AC_MSG_RESULT( [building without faac] ) fi dnl----------------------------------------------------------------------------- dnl link the aacplus library if requested dnl----------------------------------------------------------------------------- AC_SUBST(AACPLUS_INCFLAGS) AC_SUBST(AACPLUS_LDFLAGS) AC_ARG_WITH(aacplus, [ --with-aacplus use aacplus for encoding AAC HEv2 streams [yes] ], USE_AACPLUS=${withval}, USE_AACPLUS="yes" ) AC_ARG_WITH(aacplus-prefix, [ --with-aacplus-prefix=DIR alternate location for aacplus [/usr] look for libraries in AACPLUS-PREFIX/lib, for headers in AACPLUS-PREFIX/include], CONFIG_AACPLUS_PREFIX="${withval}", CONFIG_AACPLUS_PREFIX="/usr") if test "x${USE_AACPLUS}" = "xyes" ; then AC_MSG_CHECKING( [for aacplus library at ${CONFIG_AACPLUS_PREFIX}] ) LA_SEARCH_LIB( AACPLUS_LIB_LOC, AACPLUS_INC_LOC, libaacplus.a libaacplus.so, sbr_main.h, ${CONFIG_AACPLUS_PREFIX}) if test "x${AACPLUS_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_AACPLUS_LIB, 1, [build with aacplus library] ) if test "x${AACPLUS_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then AACPLUS_INCFLAGS="-I${AACPLUS_INC_LOC}" fi AACPLUS_LDFLAGS="-L${AACPLUS_LIB_LOC} -laacplus" AC_MSG_RESULT( [found at ${CONFIG_AACPLUS_PREFIX}] ) else AC_MSG_WARN( [not found, building without aacplus]) fi else AC_MSG_RESULT( [building without aacplus] ) fi dnl----------------------------------------------------------------------------- dnl link the twolame library if requested dnl----------------------------------------------------------------------------- AC_SUBST(TWOLAME_INCFLAGS) AC_SUBST(TWOLAME_LDFLAGS) AC_ARG_WITH(twolame, [ --with-twolame use twolame for encoding MP2 streams [yes] ], USE_TWOLAME=${withval}, USE_TWOLAME="yes" ) AC_ARG_WITH(twolame-prefix, [ --with-twolame-prefix=DIR alternate location for twolame [/usr] look for libraries in TWOLAME-PREFIX/lib, for headers in TWOLAME-PREFIX/include], CONFIG_TWOLAME_PREFIX="${withval}", CONFIG_TWOLAME_PREFIX="/usr") if test "x${USE_TWOLAME}" = "xyes" ; then AC_MSG_CHECKING( [for twolame library at ${CONFIG_TWOLAME_PREFIX}] ) LA_SEARCH_LIB( TWOLAME_LIB_LOC, TWOLAME_INC_LOC, libtwolame.a libtwolame.so, twolame.h, ${CONFIG_TWOLAME_PREFIX}) if test "x${TWOLAME_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_TWOLAME_LIB, 1, [build with twolame library] ) if test "x${TWOLAME_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then TWOLAME_INCFLAGS="-I${TWOLAME_INC_LOC}" fi TWOLAME_LDFLAGS="-L${TWOLAME_LIB_LOC} -ltwolame" AC_MSG_RESULT( [found at ${CONFIG_TWOLAME_PREFIX}] ) else AC_MSG_WARN( [not found, building without twolame]) fi else AC_MSG_RESULT( [building without twolame] ) fi dnl----------------------------------------------------------------------------- dnl make sure at least one of lame and vorbis present dnl----------------------------------------------------------------------------- if test "x${LAME_LDFLAGS}" = "x" \ -a "x${VORBIS_LDFLAGS}" = "x" \ -a "x${FAAC_LDFLAGS}" = "x" \ -a "x${AACPLUS_LDFLAGS}" = "x" \ -a "x${TWOLAME_LDFLAGS}" = "x"; then AC_MSG_ERROR([neither lame, Ogg Vorbis, faac, aac+ nor twolame configured]) fi dnl----------------------------------------------------------------------------- dnl link ALSA sound system if requested dnl----------------------------------------------------------------------------- AC_SUBST(ALSA_INCFLAGS) AC_SUBST(ALSA_LDFLAGS) AC_ARG_WITH(alsa, [ --with-alsa use ALSA sound system [yes] ], USE_ALSA=${withval}, USE_ALSA="yes" ) AC_ARG_WITH(alsa-prefix, [ --with-alsa-prefix=DIR alternate location for ALSA [/usr] look for libraries in ALSA-PREFIX/lib, for headers in ALSA-PREFIX/include], CONFIG_ALSA_PREFIX="${withval}", CONFIG_ALSA_PREFIX="/usr") if test "x${USE_ALSA}" = "xyes" ; then AC_MSG_CHECKING( [for alsa libraries at ${CONFIG_ALSA_PREFIX}] ) LA_SEARCH_LIB( ALSA_LIB_LOC, ALSA_INC_LOC, libasound.so, alsa/asoundlib.h, ${CONFIG_ALSA_PREFIX}) if test "x${ALSA_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_ALSA_LIB, 1, [build with ALSA sound system] ) if test "x${ALSA_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then ALSA_INCFLAGS="-I${ALSA_INC_LOC}" fi ALSA_LDFLAGS="-L${ALSA_LIB_LOC} -lasound" AC_MSG_RESULT( [found at ${CONFIG_ALSA_PREFIX}] ) else AC_MSG_WARN( [not found, building without ALSA support]) fi else AC_MSG_RESULT( [building without ALSA support] ) fi dnl----------------------------------------------------------------------------- dnl link JACK sound server if requested dnl----------------------------------------------------------------------------- AC_SUBST(JACK_CFLAGS) AC_SUBST(JACK_LDFLAGS) AC_SUBST(JACK_INCFLAGS) AC_ARG_WITH(jack, [ --with-jack use JACK sound system [yes] ], USE_JACK=${withval}, USE_JACK="yes" ) AC_ARG_WITH(jack-prefix, [ --with-jack-prefix=DIR alternate location for JACK [/usr] look for libraries in JACK-PREFIX/lib, for headers in JACK-PREFIX/include], CONFIG_JACK_PREFIX="${withval}", CONFIG_JACK_PREFIX="/usr") if test "x${USE_JACK}" = "xyes" ; then AC_MSG_CHECKING( [for jack libraries at ${CONFIG_JACK_PREFIX}] ) LA_SEARCH_LIB( JACK_LIB_LOC, JACK_INC_LOC, libjack.la libjack.so libjack.dylib, jack/jack.h, ${CONFIG_JACK_PREFIX}) if test "x${JACK_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_JACK_LIB, 1, [build with JACK audio server support] ) if test "x${JACK_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then JACK_INCFLAGS="-I${JACK_INC_LOC}" fi JACK_LDFLAGS="-L${JACK_LIB_LOC} -ljack" AC_MSG_RESULT( [found at ${CONFIG_JACK_PREFIX}] ) else AC_MSG_WARN( [not found, building without JACK support]) fi else AC_MSG_RESULT( [building without JACK support] ) fi dnl----------------------------------------------------------------------------- dnl link Secret Rabbit Code (aka libsamplerate) if requested dnl----------------------------------------------------------------------------- AC_SUBST(SRC_CFLAGS) AC_SUBST(SRC_LDFLAGS) AC_SUBST(SRC_INCFLAGS) AC_ARG_WITH(samplerate, [ --with-samplerate use Secret Rabbit Code (aka libsamplerate) for samplerate conversion [yes] ], USE_SRC=${withval}, USE_SRC="yes" ) AC_ARG_WITH(samplerate-prefix, [ --with-samplerate-prefix=DIR alternate location for samplerate [/usr] look for libraries in SRC-PREFIX/lib, for headers in SRC-PREFIX/include], CONFIG_SRC_PREFIX="${withval}", CONFIG_SRC_PREFIX="/usr") if test "x${USE_SRC}" = "xyes" ; then AC_MSG_CHECKING( [for samplerate libraries at ${CONFIG_SRC_PREFIX}] ) LA_SEARCH_LIB( SRC_LIB_LOC, SRC_INC_LOC, libsamplerate.la libsamplerate.so libsamplerate.dylib, samplerate.h, ${CONFIG_SRC_PREFIX}) if test "x${SRC_LIB_LOC}" != "x" ; then AC_DEFINE( HAVE_SRC_LIB, 1, [build with samplerate conversion through libsamplerate] ) if test "x${SRC_INC_LOC}" != "x${SYSTEM_INCLUDE}" ; then SRC_INCFLAGS="-I${SRC_INC_LOC}" fi SRC_LDFLAGS="-L${SRC_LIB_LOC} -lsamplerate" AC_MSG_RESULT( [found at ${CONFIG_SRC_PREFIX}] ) else AC_MSG_WARN( [not found, building libsamplerate support]) fi else AC_MSG_RESULT( [building without libsamplerate support] ) fi AM_CONDITIONAL(HAVE_SRC_LIB, test "x${SRC_LIB_LOC}" != "x") dnl----------------------------------------------------------------------------- dnl check for MSG_NOSIGNAL for the send() function in libsocket dnl----------------------------------------------------------------------------- AC_MSG_CHECKING(for MSG_NOSIGNAL) AC_TRY_COMPILE([#include ], [ int f = MSG_NOSIGNAL; ], [ # Yes, we have it... AC_MSG_RESULT(yes) AC_DEFINE(HAVE_MSG_NOSIGNAL, 1, [use MSG_NOSIGNAL for send()]) ], [ # We'll have to use signals AC_MSG_RESULT(no) ]) dnl----------------------------------------------------------------------------- dnl check for POSIX real-time scheduling dnl----------------------------------------------------------------------------- AC_CHECK_FUNCS( sched_getscheduler sched_getparam ) dnl----------------------------------------------------------------------------- dnl enable compilation with debug flags dnl----------------------------------------------------------------------------- AC_SUBST(DEBUG_CXXFLAGS) AC_ARG_WITH(debug, [ --with-debug enable debug mode [no] ], USE_DEBUG=${withval}, USE_DEBUG="no" ) if test "x${USE_DEBUG}" == "xyes" ; then DEBUG_CXXFLAGS="-g" AC_MSG_RESULT([compiling in debug mode]) else AC_MSG_RESULT([not compiling in debug mode]) fi AC_OUTPUT(Makefile src/Makefile man/Makefile) darkice-1.0/src/0000777000175000001440000000000011371634115010546 500000000000000darkice-1.0/src/TcpSocket.cpp0000644000175000001440000002456111371632310013070 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : TcpSocket.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_SYS_TYPES_H #include #else #error need sys/types.h #endif #ifdef HAVE_ERRNO_H #include #else #error need errno.h #endif #ifdef HAVE_SYS_SOCKET_H #include #else #error need sys/socket.h #endif #ifdef HAVE_NETINET_IN_H #include #else #error need netinet/in.h #endif #ifdef HAVE_NETDB_H #include #else #error need netdb.h #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_SYS_TIME_H #include #else #error need sys/time.h #endif #ifdef HAVE_SIGNAL_H #include #else #error need signal.h #endif #include "Util.h" #include "Exception.h" #include "TcpSocket.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: TcpSocket.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void TcpSocket :: init ( const char * host, unsigned short port ) throw ( Exception ) { this->host = Util::strDup( host); this->port = port; this->sockfd = 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void TcpSocket :: strip ( void) throw ( Exception ) { if ( isOpen() ) { close(); } delete[] host; } /*------------------------------------------------------------------------------ * Copy Constructor *----------------------------------------------------------------------------*/ TcpSocket :: TcpSocket ( const TcpSocket & ss ) throw ( Exception ) : Source( ss), Sink( ss ) { int fd; init( ss.host, ss.port); if ( (fd = ss.sockfd ? dup( ss.sockfd) : 0) == -1 ) { strip(); throw Exception( __FILE__, __LINE__, "dup failure"); } sockfd = fd; } /*------------------------------------------------------------------------------ * Assignment operator *----------------------------------------------------------------------------*/ TcpSocket & TcpSocket :: operator= ( const TcpSocket & ss ) throw ( Exception ) { if ( this != &ss ) { int fd; /* first strip */ strip(); /* then build up */ Sink::operator=( ss ); Source::operator=( ss ); init( ss.host, ss.port); if ( (fd = ss.sockfd ? dup( ss.sockfd) : 0) == -1 ) { strip(); throw Exception( __FILE__, __LINE__, "dup failure"); } sockfd = fd; } return *this; } /*------------------------------------------------------------------------------ * Open the file *----------------------------------------------------------------------------*/ bool TcpSocket :: open ( void ) throw ( Exception ) { int optval; socklen_t optlen; #ifdef HAVE_ADDRINFO struct addrinfo hints struct addrinfo * ptr; struct sockaddr_storage addr; char portstr[6]; #else struct sockaddr_in addr; struct hostent * pHostEntry; #endif if ( isOpen() ) { return false; } #ifdef HAVE_ADDRINFO memset(&hints, 0, sizeof(hints)); hints.ai_socktype = SOCK_STREAM; hints.ai_family = AF_ANY; snprintf(portstr, sizeof(portstr), "%d", port); if (getaddrinfo(host , portstr, &hints, &ptr)) { sockfd = 0; throw Exception( __FILE__, __LINE__, "getaddrinfo error", errno); } memcpy ( addr, ptr->ai_addr, ptr->ai_addrlen); freeaddrinfo(ptr); #else if ( !(pHostEntry = gethostbyname( host)) ) { sockfd = 0; throw Exception( __FILE__, __LINE__, "gethostbyname error", errno); } memset( &addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = *((long*) pHostEntry->h_addr_list[0]); #endif if ( (sockfd = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1 ) { sockfd = 0; throw Exception( __FILE__, __LINE__, "socket error", errno); } // set TCP keep-alive optval = 1; optlen = sizeof(optval); if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &optval, optlen) == -1) { reportEvent(5, "can't set TCP socket keep-alive mode", errno); } // connect if ( connect( sockfd, (struct sockaddr*)&addr, sizeof(addr)) == -1 ) { ::close( sockfd); sockfd = 0; throw Exception( __FILE__, __LINE__, "connect error", errno); } return true; } /*------------------------------------------------------------------------------ * Check wether read() would return anything *----------------------------------------------------------------------------*/ bool TcpSocket :: canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ) { fd_set fdset; struct timespec timespec; sigset_t sigset; int ret; if ( !isOpen() ) { return false; } FD_ZERO( &fdset); FD_SET( sockfd, &fdset); timespec.tv_sec = sec; timespec.tv_nsec = usec * 1000L; // mask out SIGUSR1, as we're expecting that signal for other reasons sigemptyset(&sigset); sigaddset(&sigset, SIGUSR1); ret = pselect( sockfd + 1, &fdset, NULL, NULL, ×pec, &sigset); if ( ret == -1 ) { ::close( sockfd); sockfd = 0; throw Exception( __FILE__, __LINE__, "select error"); } return ret > 0; } /*------------------------------------------------------------------------------ * Read from the socket *----------------------------------------------------------------------------*/ unsigned int TcpSocket :: read ( void * buf, unsigned int len ) throw ( Exception ) { int ret; if ( !isOpen() ) { return 0; } ret = recv( sockfd, buf, len, 0); if ( ret == -1 ) { switch (errno) { case ECONNRESET: // re-open the socket if it has been reset by the peer close(); Util::sleep(1L, 0L); open(); break; default: ::close( sockfd); sockfd = 0; throw Exception( __FILE__, __LINE__, "recv error", errno); } } return ret; } /*------------------------------------------------------------------------------ * Check wether read() would return anything *----------------------------------------------------------------------------*/ bool TcpSocket :: canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { fd_set fdset; struct timespec timespec; sigset_t sigset; int ret; if ( !isOpen() ) { return false; } FD_ZERO( &fdset); FD_SET( sockfd, &fdset); timespec.tv_sec = sec; timespec.tv_nsec = usec * 1000L; // mask out SIGUSR1, as we're expecting that signal for other reasons sigemptyset(&sigset); sigaddset(&sigset, SIGUSR1); ret = pselect( sockfd + 1, NULL, &fdset, NULL, ×pec, &sigset); if ( ret == -1 ) { ::close( sockfd); sockfd = 0; throw Exception( __FILE__, __LINE__, "select error"); } return ret > 0; } /*------------------------------------------------------------------------------ * Write to the socket *----------------------------------------------------------------------------*/ unsigned int TcpSocket :: write ( const void * buf, unsigned int len ) throw ( Exception ) { int ret; if ( !isOpen() ) { return 0; } #ifdef HAVE_MSG_NOSIGNAL ret = send( sockfd, buf, len, MSG_NOSIGNAL); #else ret = send( sockfd, buf, len, 0); #endif if ( ret == -1 ) { if ( errno == EAGAIN ) { ret = 0; } else { ::close( sockfd); sockfd = 0; throw Exception( __FILE__, __LINE__, "send error", errno); } } return ret; } /*------------------------------------------------------------------------------ * Close the socket *----------------------------------------------------------------------------*/ void TcpSocket :: close ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } flush(); ::close( sockfd); sockfd = 0; } darkice-1.0/src/aflibConverterLargeFilter.h0000644000175000001440000021372611371632022015727 00000000000000/* * Copyright: (C) 2000 Julius O. Smith * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Julius O. Smith jos@ccrma.stanford.edu * */ /* The default filter requires an oversampling factor of around 20% to avoid aliasing. The expensive filter is five times more computationally expensive and requires only about a 5-10% oversampling factor. Both filters have comparable stop-band attenuations (approximately 80 dB). The expensive filter is not yet documented because its cut-off frequency should be retuned slightly for optimal performance. Also, we plan to compute truly optimized resampling filters sometime in the future. In the meantime, the default filter is fast, well tuned, and works very well for its level of computational expense. */ #ifdef HAVE_CONFIG_H #include #endif #define LARGE_FILTER_NMULT ((short)65) #define LARGE_FILTER_SCALE 14746 /* Unity-gain scale factor */ #define LARGE_FILTER_NWING 8192 /* Filter table length */ short aflibConverter::LARGE_FILTER_IMP[] /* Impulse response */ = { 32767, 32766, 32764, 32761, 32756, 32750, 32743, 32734, 32724, 32713, 32700, 32686, 32671, 32654, 32636, 32617, 32596, 32574, 32551, 32526, 32500, 32473, 32445, 32415, 32383, 32351, 32317, 32282, 32246, 32208, 32169, 32129, 32087, 32044, 32000, 31955, 31908, 31860, 31811, 31760, 31708, 31655, 31601, 31545, 31489, 31431, 31371, 31311, 31249, 31186, 31122, 31056, 30990, 30922, 30853, 30783, 30711, 30639, 30565, 30490, 30414, 30337, 30258, 30179, 30098, 30016, 29933, 29849, 29764, 29677, 29590, 29501, 29411, 29321, 29229, 29136, 29042, 28947, 28851, 28753, 28655, 28556, 28456, 28354, 28252, 28149, 28044, 27939, 27833, 27725, 27617, 27508, 27398, 27287, 27175, 27062, 26948, 26833, 26717, 26601, 26483, 26365, 26246, 26125, 26005, 25883, 25760, 25637, 25512, 25387, 25261, 25135, 25007, 24879, 24750, 24620, 24490, 24358, 24226, 24094, 23960, 23826, 23691, 23556, 23420, 23283, 23146, 23008, 22869, 22730, 22590, 22449, 22308, 22166, 22024, 21881, 21738, 21594, 21449, 21304, 21159, 21013, 20866, 20719, 20572, 20424, 20275, 20127, 19977, 19828, 19678, 19527, 19376, 19225, 19073, 18921, 18769, 18616, 18463, 18310, 18157, 18003, 17849, 17694, 17539, 17384, 17229, 17074, 16918, 16762, 16606, 16450, 16294, 16137, 15980, 15823, 15666, 15509, 15352, 15195, 15037, 14880, 14722, 14564, 14407, 14249, 14091, 13933, 13775, 13618, 13460, 13302, 13144, 12987, 12829, 12671, 12514, 12356, 12199, 12042, 11885, 11728, 11571, 11414, 11257, 11101, 10945, 10789, 10633, 10477, 10322, 10167, 10012, 9857, 9702, 9548, 9394, 9241, 9087, 8934, 8781, 8629, 8477, 8325, 8174, 8023, 7872, 7722, 7572, 7422, 7273, 7124, 6976, 6828, 6681, 6534, 6387, 6241, 6096, 5951, 5806, 5662, 5518, 5375, 5233, 5091, 4949, 4808, 4668, 4528, 4389, 4250, 4112, 3975, 3838, 3702, 3566, 3431, 3297, 3163, 3030, 2898, 2766, 2635, 2505, 2375, 2246, 2118, 1990, 1864, 1738, 1612, 1487, 1364, 1240, 1118, 996, 875, 755, 636, 517, 400, 283, 166, 51, -63, -176, -289, -401, -513, -623, -733, -841, -949, -1056, -1162, -1268, -1372, -1476, -1578, -1680, -1781, -1881, -1980, -2078, -2176, -2272, -2367, -2462, -2556, -2648, -2740, -2831, -2921, -3010, -3098, -3185, -3271, -3356, -3441, -3524, -3606, -3688, -3768, -3848, -3926, -4004, -4080, -4156, -4231, -4304, -4377, -4449, -4519, -4589, -4658, -4726, -4792, -4858, -4923, -4987, -5050, -5111, -5172, -5232, -5291, -5349, -5406, -5462, -5517, -5571, -5624, -5675, -5726, -5776, -5825, -5873, -5920, -5966, -6011, -6055, -6098, -6140, -6181, -6222, -6261, -6299, -6336, -6372, -6407, -6441, -6475, -6507, -6538, -6569, -6598, -6626, -6654, -6680, -6706, -6730, -6754, -6777, -6798, -6819, -6839, -6858, -6876, -6893, -6909, -6924, -6938, -6951, -6964, -6975, -6986, -6995, -7004, -7012, -7019, -7025, -7030, -7035, -7038, -7040, -7042, -7043, -7043, -7042, -7040, -7038, -7034, -7030, -7025, -7019, -7012, -7004, -6996, -6986, -6976, -6965, -6954, -6941, -6928, -6914, -6899, -6884, -6867, -6850, -6832, -6814, -6794, -6774, -6753, -6732, -6709, -6686, -6663, -6638, -6613, -6587, -6561, -6534, -6506, -6478, -6448, -6419, -6388, -6357, -6325, -6293, -6260, -6226, -6192, -6157, -6122, -6086, -6049, -6012, -5975, -5936, -5897, -5858, -5818, -5778, -5737, -5695, -5653, -5611, -5568, -5524, -5480, -5436, -5391, -5345, -5300, -5253, -5207, -5159, -5112, -5064, -5015, -4966, -4917, -4868, -4818, -4767, -4716, -4665, -4614, -4562, -4510, -4457, -4404, -4351, -4298, -4244, -4190, -4136, -4081, -4026, -3971, -3916, -3860, -3804, -3748, -3692, -3635, -3578, -3521, -3464, -3406, -3349, -3291, -3233, -3175, -3117, -3058, -3000, -2941, -2882, -2823, -2764, -2705, -2646, -2587, -2527, -2468, -2408, -2349, -2289, -2229, -2169, -2110, -2050, -1990, -1930, -1870, -1811, -1751, -1691, -1631, -1571, -1512, -1452, -1392, -1333, -1273, -1214, -1154, -1095, -1036, -977, -918, -859, -800, -741, -683, -624, -566, -508, -450, -392, -335, -277, -220, -163, -106, -49, 6, 63, 119, 175, 230, 286, 341, 396, 450, 505, 559, 613, 667, 720, 773, 826, 878, 931, 983, 1034, 1086, 1137, 1187, 1238, 1288, 1337, 1387, 1436, 1484, 1533, 1581, 1628, 1675, 1722, 1769, 1815, 1861, 1906, 1951, 1996, 2040, 2084, 2127, 2170, 2212, 2255, 2296, 2338, 2378, 2419, 2459, 2498, 2538, 2576, 2615, 2652, 2690, 2727, 2763, 2799, 2834, 2870, 2904, 2938, 2972, 3005, 3038, 3070, 3102, 3133, 3164, 3194, 3224, 3253, 3282, 3310, 3338, 3365, 3392, 3418, 3444, 3469, 3494, 3518, 3542, 3566, 3588, 3611, 3632, 3653, 3674, 3694, 3714, 3733, 3752, 3770, 3788, 3805, 3821, 3837, 3853, 3868, 3882, 3896, 3910, 3923, 3935, 3947, 3958, 3969, 3980, 3989, 3999, 4007, 4016, 4023, 4031, 4037, 4044, 4049, 4054, 4059, 4063, 4067, 4070, 4073, 4075, 4076, 4077, 4078, 4078, 4078, 4077, 4076, 4074, 4071, 4068, 4065, 4061, 4057, 4052, 4047, 4041, 4035, 4028, 4021, 4013, 4005, 3997, 3988, 3978, 3968, 3958, 3947, 3936, 3924, 3912, 3899, 3886, 3872, 3858, 3844, 3829, 3814, 3798, 3782, 3766, 3749, 3731, 3714, 3696, 3677, 3658, 3639, 3619, 3599, 3578, 3558, 3536, 3515, 3493, 3470, 3448, 3425, 3401, 3378, 3353, 3329, 3304, 3279, 3254, 3228, 3202, 3175, 3149, 3122, 3094, 3067, 3039, 3011, 2982, 2953, 2924, 2895, 2865, 2835, 2805, 2775, 2744, 2713, 2682, 2651, 2619, 2587, 2555, 2523, 2490, 2457, 2424, 2391, 2358, 2324, 2290, 2256, 2222, 2188, 2153, 2119, 2084, 2049, 2014, 1978, 1943, 1907, 1872, 1836, 1800, 1764, 1727, 1691, 1655, 1618, 1581, 1545, 1508, 1471, 1434, 1397, 1360, 1322, 1285, 1248, 1210, 1173, 1135, 1098, 1060, 1023, 985, 947, 910, 872, 834, 797, 759, 721, 684, 646, 608, 571, 533, 496, 458, 421, 383, 346, 308, 271, 234, 197, 160, 123, 86, 49, 12, -23, -60, -96, -133, -169, -205, -241, -277, -313, -348, -384, -419, -455, -490, -525, -559, -594, -628, -663, -697, -731, -765, -798, -832, -865, -898, -931, -963, -996, -1028, -1060, -1092, -1124, -1155, -1186, -1217, -1248, -1279, -1309, -1339, -1369, -1398, -1428, -1457, -1486, -1514, -1542, -1571, -1598, -1626, -1653, -1680, -1707, -1733, -1760, -1785, -1811, -1836, -1862, -1886, -1911, -1935, -1959, -1982, -2006, -2029, -2051, -2074, -2096, -2118, -2139, -2160, -2181, -2202, -2222, -2242, -2261, -2280, -2299, -2318, -2336, -2354, -2372, -2389, -2406, -2423, -2439, -2455, -2470, -2486, -2500, -2515, -2529, -2543, -2557, -2570, -2583, -2595, -2607, -2619, -2631, -2642, -2652, -2663, -2673, -2683, -2692, -2701, -2710, -2718, -2726, -2734, -2741, -2748, -2754, -2760, -2766, -2772, -2777, -2782, -2786, -2790, -2794, -2797, -2800, -2803, -2805, -2807, -2809, -2810, -2811, -2812, -2812, -2812, -2812, -2811, -2810, -2808, -2807, -2804, -2802, -2799, -2796, -2792, -2789, -2785, -2780, -2775, -2770, -2765, -2759, -2753, -2746, -2740, -2732, -2725, -2717, -2709, -2701, -2692, -2683, -2674, -2664, -2655, -2644, -2634, -2623, -2612, -2601, -2589, -2577, -2565, -2552, -2539, -2526, -2513, -2499, -2485, -2471, -2457, -2442, -2427, -2412, -2396, -2380, -2364, -2348, -2331, -2315, -2297, -2280, -2263, -2245, -2227, -2209, -2190, -2171, -2152, -2133, -2114, -2094, -2075, -2055, -2034, -2014, -1993, -1972, -1951, -1930, -1909, -1887, -1865, -1843, -1821, -1799, -1776, -1754, -1731, -1708, -1685, -1662, -1638, -1614, -1591, -1567, -1543, -1519, -1494, -1470, -1445, -1421, -1396, -1371, -1346, -1321, -1295, -1270, -1244, -1219, -1193, -1167, -1142, -1116, -1090, -1064, -1037, -1011, -985, -958, -932, -905, -879, -852, -826, -799, -772, -745, -719, -692, -665, -638, -611, -584, -557, -530, -503, -476, -449, -422, -395, -368, -341, -314, -287, -260, -234, -207, -180, -153, -126, -100, -73, -46, -20, 6, 32, 59, 85, 111, 138, 164, 190, 216, 242, 268, 294, 319, 345, 370, 396, 421, 446, 471, 496, 521, 546, 571, 595, 619, 644, 668, 692, 716, 739, 763, 787, 810, 833, 856, 879, 902, 924, 947, 969, 991, 1013, 1035, 1056, 1078, 1099, 1120, 1141, 1162, 1182, 1202, 1223, 1243, 1262, 1282, 1301, 1320, 1339, 1358, 1377, 1395, 1413, 1431, 1449, 1467, 1484, 1501, 1518, 1535, 1551, 1567, 1583, 1599, 1615, 1630, 1645, 1660, 1674, 1689, 1703, 1717, 1731, 1744, 1757, 1770, 1783, 1795, 1808, 1820, 1831, 1843, 1854, 1865, 1876, 1886, 1897, 1907, 1916, 1926, 1935, 1944, 1953, 1961, 1970, 1978, 1985, 1993, 2000, 2007, 2014, 2020, 2026, 2032, 2038, 2043, 2048, 2053, 2058, 2062, 2066, 2070, 2073, 2077, 2080, 2083, 2085, 2087, 2089, 2091, 2093, 2094, 2095, 2095, 2096, 2096, 2096, 2096, 2095, 2094, 2093, 2092, 2090, 2088, 2086, 2084, 2081, 2079, 2075, 2072, 2069, 2065, 2061, 2056, 2052, 2047, 2042, 2037, 2031, 2025, 2019, 2013, 2006, 2000, 1993, 1986, 1978, 1971, 1963, 1955, 1946, 1938, 1929, 1920, 1911, 1901, 1892, 1882, 1872, 1862, 1851, 1841, 1830, 1819, 1807, 1796, 1784, 1772, 1760, 1748, 1735, 1723, 1710, 1697, 1684, 1670, 1657, 1643, 1629, 1615, 1601, 1586, 1572, 1557, 1542, 1527, 1512, 1496, 1481, 1465, 1449, 1433, 1417, 1401, 1384, 1368, 1351, 1334, 1317, 1300, 1283, 1265, 1248, 1230, 1212, 1195, 1177, 1159, 1140, 1122, 1104, 1085, 1067, 1048, 1029, 1010, 991, 972, 953, 934, 915, 895, 876, 856, 837, 817, 797, 777, 758, 738, 718, 698, 678, 658, 637, 617, 597, 577, 556, 536, 516, 495, 475, 454, 434, 414, 393, 373, 352, 332, 311, 291, 270, 250, 229, 208, 188, 168, 147, 127, 106, 86, 65, 45, 25, 5, -15, -35, -55, -75, -95, -115, -135, -155, -175, -195, -215, -234, -254, -274, -293, -313, -332, -351, -370, -390, -409, -428, -446, -465, -484, -503, -521, -539, -558, -576, -594, -612, -630, -648, -666, -683, -701, -718, -735, -752, -769, -786, -803, -819, -836, -852, -868, -885, -900, -916, -932, -947, -963, -978, -993, -1008, -1023, -1038, -1052, -1066, -1081, -1095, -1108, -1122, -1136, -1149, -1162, -1175, -1188, -1201, -1214, -1226, -1238, -1250, -1262, -1274, -1285, -1297, -1308, -1319, -1330, -1340, -1351, -1361, -1371, -1381, -1390, -1400, -1409, -1418, -1427, -1436, -1445, -1453, -1461, -1469, -1477, -1485, -1492, -1499, -1506, -1513, -1520, -1526, -1532, -1538, -1544, -1550, -1555, -1560, -1566, -1570, -1575, -1579, -1584, -1588, -1592, -1595, -1599, -1602, -1605, -1608, -1610, -1613, -1615, -1617, -1619, -1620, -1622, -1623, -1624, -1625, -1625, -1626, -1626, -1626, -1626, -1625, -1625, -1624, -1623, -1622, -1621, -1619, -1617, -1615, -1613, -1611, -1608, -1605, -1603, -1599, -1596, -1593, -1589, -1585, -1581, -1577, -1572, -1568, -1563, -1558, -1553, -1547, -1542, -1536, -1530, -1524, -1518, -1511, -1505, -1498, -1491, -1484, -1477, -1469, -1462, -1454, -1446, -1438, -1430, -1421, -1413, -1404, -1395, -1386, -1377, -1367, -1358, -1348, -1338, -1328, -1318, -1308, -1297, -1287, -1276, -1265, -1254, -1243, -1232, -1221, -1209, -1198, -1186, -1174, -1162, -1150, -1138, -1125, -1113, -1100, -1087, -1075, -1062, -1049, -1035, -1022, -1009, -995, -982, -968, -954, -941, -927, -913, -898, -884, -870, -856, -841, -827, -812, -797, -783, -768, -753, -738, -723, -708, -692, -677, -662, -647, -631, -616, -600, -585, -569, -554, -538, -522, -506, -491, -475, -459, -443, -427, -411, -395, -379, -363, -347, -331, -315, -299, -283, -267, -251, -235, -218, -202, -186, -170, -154, -138, -122, -106, -90, -74, -58, -42, -26, -10, 5, 21, 37, 53, 69, 85, 100, 116, 132, 147, 163, 179, 194, 209, 225, 240, 256, 271, 286, 301, 316, 331, 346, 361, 376, 391, 405, 420, 434, 449, 463, 477, 492, 506, 520, 534, 548, 561, 575, 589, 602, 615, 629, 642, 655, 668, 681, 694, 706, 719, 731, 744, 756, 768, 780, 792, 804, 816, 827, 839, 850, 861, 872, 883, 894, 905, 915, 926, 936, 946, 956, 966, 976, 986, 995, 1005, 1014, 1023, 1032, 1041, 1049, 1058, 1066, 1075, 1083, 1091, 1099, 1106, 1114, 1121, 1128, 1135, 1142, 1149, 1156, 1162, 1169, 1175, 1181, 1187, 1192, 1198, 1203, 1208, 1214, 1218, 1223, 1228, 1232, 1237, 1241, 1245, 1249, 1252, 1256, 1259, 1262, 1265, 1268, 1271, 1273, 1276, 1278, 1280, 1282, 1284, 1285, 1287, 1288, 1289, 1290, 1291, 1292, 1292, 1292, 1293, 1293, 1292, 1292, 1292, 1291, 1290, 1289, 1288, 1287, 1285, 1284, 1282, 1280, 1278, 1276, 1274, 1271, 1269, 1266, 1263, 1260, 1257, 1253, 1250, 1246, 1242, 1238, 1234, 1230, 1225, 1221, 1216, 1211, 1206, 1201, 1196, 1190, 1185, 1179, 1173, 1167, 1161, 1155, 1149, 1142, 1136, 1129, 1122, 1115, 1108, 1101, 1094, 1086, 1078, 1071, 1063, 1055, 1047, 1039, 1030, 1022, 1013, 1005, 996, 987, 978, 969, 960, 951, 941, 932, 922, 913, 903, 893, 883, 873, 863, 853, 842, 832, 821, 811, 800, 789, 778, 768, 757, 746, 734, 723, 712, 701, 689, 678, 666, 654, 643, 631, 619, 607, 596, 584, 572, 559, 547, 535, 523, 511, 498, 486, 474, 461, 449, 436, 424, 411, 399, 386, 373, 361, 348, 335, 322, 310, 297, 284, 271, 258, 246, 233, 220, 207, 194, 181, 168, 156, 143, 130, 117, 104, 91, 78, 65, 53, 40, 27, 14, 1, -10, -23, -36, -48, -61, -74, -86, -99, -111, -124, -136, -149, -161, -174, -186, -198, -211, -223, -235, -247, -259, -271, -283, -295, -307, -319, -330, -342, -354, -365, -377, -388, -399, -411, -422, -433, -444, -455, -466, -477, -488, -499, -509, -520, -530, -541, -551, -561, -571, -581, -591, -601, -611, -621, -631, -640, -650, -659, -668, -677, -686, -695, -704, -713, -722, -730, -739, -747, -755, -763, -771, -779, -787, -795, -803, -810, -817, -825, -832, -839, -846, -853, -859, -866, -873, -879, -885, -891, -897, -903, -909, -915, -920, -926, -931, -936, -941, -946, -951, -955, -960, -964, -969, -973, -977, -981, -985, -988, -992, -995, -999, -1002, -1005, -1008, -1011, -1013, -1016, -1018, -1020, -1023, -1025, -1026, -1028, -1030, -1031, -1033, -1034, -1035, -1036, -1037, -1038, -1038, -1039, -1039, -1039, -1039, -1039, -1039, -1039, -1038, -1038, -1037, -1036, -1036, -1034, -1033, -1032, -1031, -1029, -1027, -1026, -1024, -1022, -1019, -1017, -1015, -1012, -1010, -1007, -1004, -1001, -998, -995, -991, -988, -984, -980, -977, -973, -969, -965, -960, -956, -951, -947, -942, -937, -932, -927, -922, -917, -912, -906, -901, -895, -889, -883, -877, -871, -865, -859, -853, -846, -840, -833, -826, -819, -812, -805, -798, -791, -784, -777, -769, -762, -754, -746, -739, -731, -723, -715, -707, -699, -691, -682, -674, -665, -657, -648, -640, -631, -622, -614, -605, -596, -587, -578, -569, -559, -550, -541, -532, -522, -513, -503, -494, -484, -474, -465, -455, -445, -436, -426, -416, -406, -396, -386, -376, -366, -356, -346, -336, -325, -315, -305, -295, -285, -274, -264, -254, -243, -233, -223, -212, -202, -192, -181, -171, -161, -150, -140, -129, -119, -108, -98, -88, -77, -67, -57, -46, -36, -25, -15, -5, 5, 15, 25, 35, 46, 56, 66, 76, 86, 97, 107, 117, 127, 137, 147, 157, 167, 177, 186, 196, 206, 216, 225, 235, 245, 254, 264, 273, 283, 292, 301, 311, 320, 329, 338, 347, 356, 365, 374, 383, 392, 400, 409, 418, 426, 435, 443, 451, 460, 468, 476, 484, 492, 500, 508, 515, 523, 531, 538, 546, 553, 560, 568, 575, 582, 589, 596, 602, 609, 616, 622, 629, 635, 642, 648, 654, 660, 666, 672, 678, 683, 689, 694, 700, 705, 710, 715, 720, 725, 730, 735, 739, 744, 748, 753, 757, 761, 765, 769, 773, 777, 780, 784, 787, 791, 794, 797, 800, 803, 806, 809, 811, 814, 816, 818, 821, 823, 825, 827, 828, 830, 832, 833, 835, 836, 837, 838, 839, 840, 841, 841, 842, 842, 843, 843, 843, 843, 843, 843, 843, 842, 842, 841, 840, 840, 839, 838, 837, 835, 834, 833, 831, 830, 828, 826, 824, 822, 820, 818, 816, 813, 811, 808, 806, 803, 800, 797, 794, 791, 788, 784, 781, 777, 774, 770, 766, 763, 759, 755, 750, 746, 742, 738, 733, 729, 724, 719, 714, 710, 705, 700, 694, 689, 684, 679, 673, 668, 662, 657, 651, 645, 639, 633, 627, 621, 615, 609, 603, 596, 590, 584, 577, 571, 564, 557, 551, 544, 537, 530, 523, 516, 509, 502, 495, 487, 480, 473, 465, 458, 450, 443, 435, 428, 420, 413, 405, 397, 389, 381, 374, 366, 358, 350, 342, 334, 326, 318, 310, 301, 293, 285, 277, 269, 260, 252, 244, 236, 227, 219, 211, 202, 194, 185, 177, 169, 160, 152, 143, 135, 126, 118, 110, 101, 93, 84, 76, 67, 59, 50, 42, 34, 25, 17, 8, 0, -7, -16, -24, -32, -41, -49, -57, -66, -74, -82, -90, -98, -106, -115, -123, -131, -139, -147, -155, -163, -171, -179, -186, -194, -202, -210, -217, -225, -233, -240, -248, -255, -263, -270, -278, -285, -292, -299, -307, -314, -321, -328, -335, -342, -349, -356, -362, -369, -376, -382, -389, -396, -402, -408, -415, -421, -427, -433, -439, -445, -451, -457, -463, -469, -475, -480, -486, -491, -497, -502, -507, -513, -518, -523, -528, -533, -538, -542, -547, -552, -556, -561, -565, -570, -574, -578, -582, -586, -590, -594, -598, -602, -605, -609, -612, -616, -619, -622, -625, -629, -632, -634, -637, -640, -643, -645, -648, -650, -653, -655, -657, -659, -661, -663, -665, -667, -668, -670, -671, -673, -674, -675, -676, -678, -679, -679, -680, -681, -682, -682, -683, -683, -683, -684, -684, -684, -684, -684, -684, -683, -683, -682, -682, -681, -681, -680, -679, -678, -677, -676, -675, -674, -672, -671, -669, -668, -666, -664, -662, -661, -659, -657, -654, -652, -650, -648, -645, -643, -640, -637, -635, -632, -629, -626, -623, -620, -617, -613, -610, -607, -603, -600, -596, -593, -589, -585, -581, -577, -573, -569, -565, -561, -557, -552, -548, -544, -539, -534, -530, -525, -520, -516, -511, -506, -501, -496, -491, -486, -481, -475, -470, -465, -460, -454, -449, -443, -438, -432, -426, -421, -415, -409, -403, -398, -392, -386, -380, -374, -368, -362, -355, -349, -343, -337, -331, -324, -318, -312, -305, -299, -292, -286, -280, -273, -266, -260, -253, -247, -240, -234, -227, -220, -213, -207, -200, -193, -187, -180, -173, -166, -159, -153, -146, -139, -132, -125, -118, -112, -105, -98, -91, -84, -77, -70, -64, -57, -50, -43, -36, -29, -22, -16, -9, -2, 4, 11, 17, 24, 31, 38, 44, 51, 58, 64, 71, 78, 84, 91, 98, 104, 111, 117, 124, 130, 137, 143, 149, 156, 162, 168, 175, 181, 187, 193, 199, 205, 212, 218, 224, 230, 236, 241, 247, 253, 259, 265, 270, 276, 282, 287, 293, 298, 304, 309, 314, 320, 325, 330, 335, 340, 345, 350, 355, 360, 365, 370, 375, 380, 384, 389, 393, 398, 402, 407, 411, 415, 419, 424, 428, 432, 436, 440, 443, 447, 451, 455, 458, 462, 465, 469, 472, 475, 479, 482, 485, 488, 491, 494, 497, 499, 502, 505, 507, 510, 512, 515, 517, 519, 522, 524, 526, 528, 530, 532, 533, 535, 537, 538, 540, 541, 543, 544, 545, 546, 548, 549, 550, 550, 551, 552, 553, 553, 554, 554, 555, 555, 555, 556, 556, 556, 556, 556, 556, 555, 555, 555, 554, 554, 553, 553, 552, 551, 551, 550, 549, 548, 547, 546, 545, 543, 542, 541, 539, 538, 536, 534, 533, 531, 529, 527, 525, 523, 521, 519, 517, 514, 512, 510, 507, 505, 502, 500, 497, 494, 492, 489, 486, 483, 480, 477, 474, 471, 467, 464, 461, 457, 454, 450, 447, 443, 440, 436, 432, 429, 425, 421, 417, 413, 409, 405, 401, 397, 393, 388, 384, 380, 375, 371, 367, 362, 358, 353, 349, 344, 339, 335, 330, 325, 321, 316, 311, 306, 301, 296, 291, 286, 281, 276, 271, 266, 261, 256, 251, 245, 240, 235, 230, 225, 219, 214, 209, 203, 198, 193, 187, 182, 176, 171, 165, 160, 154, 149, 144, 138, 132, 127, 121, 116, 110, 105, 99, 94, 88, 83, 77, 71, 66, 60, 55, 49, 44, 38, 33, 27, 21, 16, 10, 5, 0, -5, -11, -16, -22, -27, -33, -38, -43, -49, -54, -60, -65, -70, -76, -81, -86, -92, -97, -102, -107, -113, -118, -123, -128, -133, -138, -143, -148, -153, -158, -163, -168, -173, -178, -183, -188, -192, -197, -202, -207, -211, -216, -221, -225, -230, -234, -239, -243, -247, -252, -256, -260, -265, -269, -273, -277, -281, -285, -289, -293, -297, -301, -305, -308, -312, -316, -319, -323, -327, -330, -334, -337, -340, -344, -347, -350, -353, -357, -360, -363, -366, -369, -372, -374, -377, -380, -383, -385, -388, -390, -393, -395, -398, -400, -402, -405, -407, -409, -411, -413, -415, -417, -419, -420, -422, -424, -425, -427, -429, -430, -431, -433, -434, -435, -436, -438, -439, -440, -441, -442, -442, -443, -444, -445, -445, -446, -446, -447, -447, -448, -448, -448, -448, -449, -449, -449, -449, -449, -448, -448, -448, -448, -447, -447, -446, -446, -445, -445, -444, -443, -442, -442, -441, -440, -439, -438, -437, -435, -434, -433, -432, -430, -429, -427, -426, -424, -423, -421, -419, -418, -416, -414, -412, -410, -408, -406, -404, -402, -400, -397, -395, -393, -390, -388, -385, -383, -380, -378, -375, -373, -370, -367, -364, -361, -359, -356, -353, -350, -347, -344, -340, -337, -334, -331, -328, -324, -321, -318, -314, -311, -307, -304, -300, -297, -293, -290, -286, -282, -279, -275, -271, -267, -263, -260, -256, -252, -248, -244, -240, -236, -232, -228, -224, -220, -216, -212, -207, -203, -199, -195, -191, -186, -182, -178, -174, -169, -165, -161, -156, -152, -148, -143, -139, -134, -130, -126, -121, -117, -112, -108, -103, -99, -95, -90, -86, -81, -77, -72, -68, -63, -59, -54, -50, -45, -41, -36, -32, -27, -23, -18, -14, -9, -5, 0, 3, 7, 12, 16, 21, 25, 29, 34, 38, 43, 47, 51, 56, 60, 64, 69, 73, 77, 81, 85, 90, 94, 98, 102, 106, 110, 115, 119, 123, 127, 131, 135, 139, 143, 146, 150, 154, 158, 162, 166, 169, 173, 177, 181, 184, 188, 192, 195, 199, 202, 206, 209, 212, 216, 219, 223, 226, 229, 232, 236, 239, 242, 245, 248, 251, 254, 257, 260, 263, 266, 268, 271, 274, 277, 279, 282, 284, 287, 289, 292, 294, 297, 299, 301, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 324, 326, 328, 329, 331, 333, 334, 336, 337, 339, 340, 341, 343, 344, 345, 346, 348, 349, 350, 351, 352, 353, 354, 354, 355, 356, 357, 357, 358, 358, 359, 359, 360, 360, 361, 361, 361, 361, 362, 362, 362, 362, 362, 362, 362, 361, 361, 361, 361, 360, 360, 360, 359, 359, 358, 358, 357, 356, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 341, 340, 339, 337, 336, 334, 333, 331, 330, 328, 326, 324, 323, 321, 319, 317, 315, 313, 311, 309, 307, 305, 303, 301, 299, 297, 294, 292, 290, 288, 285, 283, 280, 278, 275, 273, 270, 268, 265, 263, 260, 257, 254, 252, 249, 246, 243, 240, 238, 235, 232, 229, 226, 223, 220, 217, 214, 211, 208, 204, 201, 198, 195, 192, 188, 185, 182, 179, 175, 172, 169, 165, 162, 159, 155, 152, 149, 145, 142, 138, 135, 131, 128, 124, 121, 117, 114, 110, 107, 103, 100, 96, 93, 89, 85, 82, 78, 75, 71, 67, 64, 60, 57, 53, 49, 46, 42, 39, 35, 31, 28, 24, 21, 17, 14, 10, 6, 3, 0, -3, -7, -10, -14, -18, -21, -25, -28, -32, -35, -39, -42, -45, -49, -52, -56, -59, -63, -66, -69, -73, -76, -79, -83, -86, -89, -93, -96, -99, -102, -105, -109, -112, -115, -118, -121, -124, -127, -130, -133, -136, -139, -142, -145, -148, -151, -154, -157, -160, -162, -165, -168, -171, -173, -176, -179, -181, -184, -186, -189, -191, -194, -196, -199, -201, -204, -206, -208, -211, -213, -215, -217, -219, -221, -224, -226, -228, -230, -232, -234, -236, -237, -239, -241, -243, -245, -246, -248, -250, -251, -253, -254, -256, -257, -259, -260, -262, -263, -264, -266, -267, -268, -269, -270, -271, -273, -274, -275, -275, -276, -277, -278, -279, -280, -281, -281, -282, -283, -283, -284, -284, -285, -285, -286, -286, -286, -287, -287, -287, -287, -288, -288, -288, -288, -288, -288, -288, -288, -288, -288, -287, -287, -287, -287, -286, -286, -286, -285, -285, -284, -284, -283, -283, -282, -281, -281, -280, -279, -278, -277, -277, -276, -275, -274, -273, -272, -271, -270, -269, -267, -266, -265, -264, -262, -261, -260, -258, -257, -256, -254, -253, -251, -250, -248, -247, -245, -243, -242, -240, -238, -236, -235, -233, -231, -229, -227, -225, -223, -221, -219, -217, -215, -213, -211, -209, -207, -205, -203, -201, -198, -196, -194, -192, -189, -187, -185, -182, -180, -178, -175, -173, -170, -168, -165, -163, -160, -158, -155, -153, -150, -148, -145, -142, -140, -137, -135, -132, -129, -127, -124, -121, -118, -116, -113, -110, -108, -105, -102, -99, -96, -94, -91, -88, -85, -82, -80, -77, -74, -71, -68, -65, -63, -60, -57, -54, -51, -48, -45, -42, -40, -37, -34, -31, -28, -25, -22, -20, -17, -14, -11, -8, -5, -2, 0, 2, 5, 8, 11, 13, 16, 19, 22, 25, 27, 30, 33, 36, 38, 41, 44, 47, 49, 52, 55, 57, 60, 63, 65, 68, 71, 73, 76, 78, 81, 83, 86, 88, 91, 93, 96, 98, 101, 103, 106, 108, 110, 113, 115, 117, 120, 122, 124, 127, 129, 131, 133, 135, 137, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 161, 163, 165, 167, 169, 171, 172, 174, 176, 177, 179, 181, 182, 184, 185, 187, 188, 190, 191, 193, 194, 195, 197, 198, 199, 201, 202, 203, 204, 205, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 216, 217, 218, 219, 219, 220, 221, 222, 222, 223, 223, 224, 224, 225, 225, 226, 226, 227, 227, 227, 227, 228, 228, 228, 228, 228, 229, 229, 229, 229, 229, 229, 229, 229, 228, 228, 228, 228, 228, 228, 227, 227, 227, 226, 226, 225, 225, 225, 224, 224, 223, 222, 222, 221, 221, 220, 219, 218, 218, 217, 216, 215, 214, 214, 213, 212, 211, 210, 209, 208, 207, 206, 205, 203, 202, 201, 200, 199, 197, 196, 195, 194, 192, 191, 190, 188, 187, 185, 184, 182, 181, 179, 178, 176, 175, 173, 172, 170, 168, 167, 165, 163, 162, 160, 158, 156, 155, 153, 151, 149, 147, 146, 144, 142, 140, 138, 136, 134, 132, 130, 128, 126, 124, 122, 120, 118, 116, 114, 112, 110, 108, 106, 104, 102, 99, 97, 95, 93, 91, 89, 87, 84, 82, 80, 78, 76, 73, 71, 69, 67, 64, 62, 60, 58, 56, 53, 51, 49, 47, 44, 42, 40, 38, 35, 33, 31, 28, 26, 24, 22, 19, 17, 15, 13, 10, 8, 6, 4, 1, 0, -2, -4, -6, -9, -11, -13, -15, -17, -20, -22, -24, -26, -28, -30, -33, -35, -37, -39, -41, -43, -45, -47, -49, -52, -54, -56, -58, -60, -62, -64, -66, -68, -70, -72, -74, -76, -77, -79, -81, -83, -85, -87, -89, -90, -92, -94, -96, -98, -99, -101, -103, -105, -106, -108, -110, -111, -113, -114, -116, -118, -119, -121, -122, -124, -125, -127, -128, -130, -131, -132, -134, -135, -136, -138, -139, -140, -142, -143, -144, -145, -146, -148, -149, -150, -151, -152, -153, -154, -155, -156, -157, -158, -159, -160, -161, -162, -162, -163, -164, -165, -166, -166, -167, -168, -168, -169, -170, -170, -171, -171, -172, -172, -173, -173, -174, -174, -175, -175, -175, -176, -176, -176, -177, -177, -177, -177, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -178, -177, -177, -177, -177, -177, -176, -176, -176, -175, -175, -175, -174, -174, -173, -173, -172, -172, -171, -171, -170, -170, -169, -168, -168, -167, -166, -166, -165, -164, -163, -163, -162, -161, -160, -159, -158, -158, -157, -156, -155, -154, -153, -152, -151, -150, -149, -148, -147, -145, -144, -143, -142, -141, -140, -139, -137, -136, -135, -134, -132, -131, -130, -128, -127, -126, -124, -123, -122, -120, -119, -118, -116, -115, -113, -112, -110, -109, -107, -106, -104, -103, -101, -100, -98, -97, -95, -94, -92, -90, -89, -87, -86, -84, -82, -81, -79, -77, -76, -74, -72, -71, -69, -67, -66, -64, -62, -60, -59, -57, -55, -54, -52, -50, -48, -47, -45, -43, -41, -40, -38, -36, -34, -33, -31, -29, -27, -25, -24, -22, -20, -18, -17, -15, -13, -11, -10, -8, -6, -4, -3, -1, 0, 2, 3, 5, 7, 8, 10, 12, 14, 15, 17, 19, 20, 22, 24, 25, 27, 29, 30, 32, 34, 35, 37, 39, 40, 42, 43, 45, 47, 48, 50, 51, 53, 54, 56, 57, 59, 60, 62, 63, 65, 66, 68, 69, 70, 72, 73, 75, 76, 77, 79, 80, 81, 83, 84, 85, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 117, 118, 119, 120, 121, 121, 122, 123, 124, 124, 125, 126, 126, 127, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135, 135, 136, 136, 136, 136, 137, 137, 137, 137, 138, 138, 138, 138, 138, 138, 138, 138, 139, 139, 139, 139, 139, 139, 139, 138, 138, 138, 138, 138, 138, 138, 138, 137, 137, 137, 137, 136, 136, 136, 136, 135, 135, 134, 134, 134, 133, 133, 132, 132, 132, 131, 131, 130, 129, 129, 128, 128, 127, 127, 126, 125, 125, 124, 123, 123, 122, 121, 121, 120, 119, 118, 117, 117, 116, 115, 114, 113, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 87, 86, 85, 84, 83, 82, 81, 79, 78, 77, 76, 75, 73, 72, 71, 70, 68, 67, 66, 65, 63, 62, 61, 60, 58, 57, 56, 54, 53, 52, 50, 49, 48, 47, 45, 44, 43, 41, 40, 39, 37, 36, 34, 33, 32, 30, 29, 28, 26, 25, 24, 22, 21, 20, 18, 17, 16, 14, 13, 11, 10, 9, 7, 6, 5, 3, 2, 1, 0, -1, -2, -4, -5, -6, -8, -9, -10, -11, -13, -14, -15, -17, -18, -19, -20, -22, -23, -24, -26, -27, -28, -29, -30, -32, -33, -34, -35, -37, -38, -39, -40, -41, -42, -44, -45, -46, -47, -48, -49, -50, -51, -53, -54, -55, -56, -57, -58, -59, -60, -61, -62, -63, -64, -65, -66, -67, -68, -69, -70, -71, -71, -72, -73, -74, -75, -76, -77, -77, -78, -79, -80, -81, -81, -82, -83, -84, -84, -85, -86, -87, -87, -88, -89, -89, -90, -90, -91, -92, -92, -93, -93, -94, -94, -95, -95, -96, -96, -97, -97, -98, -98, -99, -99, -99, -100, -100, -100, -101, -101, -101, -102, -102, -102, -102, -103, -103, -103, -103, -103, -104, -104, -104, -104, -104, -104, -104, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, -104, -104, -104, -104, -104, -104, -104, -104, -103, -103, -103, -103, -103, -102, -102, -102, -102, -101, -101, -101, -100, -100, -100, -99, -99, -99, -98, -98, -97, -97, -97, -96, -96, -95, -95, -94, -94, -93, -93, -92, -92, -91, -90, -90, -89, -89, -88, -87, -87, -86, -86, -85, -84, -84, -83, -82, -81, -81, -80, -79, -79, -78, -77, -76, -76, -75, -74, -73, -72, -72, -71, -70, -69, -68, -67, -67, -66, -65, -64, -63, -62, -61, -61, -60, -59, -58, -57, -56, -55, -54, -53, -52, -51, -50, -49, -48, -48, -47, -46, -45, -44, -43, -42, -41, -40, -39, -38, -37, -36, -35, -34, -33, -32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42, 42, 43, 44, 45, 46, 46, 47, 48, 49, 49, 50, 51, 52, 52, 53, 54, 54, 55, 56, 56, 57, 58, 58, 59, 59, 60, 61, 61, 62, 62, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 69, 70, 70, 71, 71, 72, 72, 72, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 76, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 78, 78, 78, 78, 78, 78, 77, 77, 77, 77, 77, 76, 76, 76, 76, 75, 75, 75, 74, 74, 74, 74, 73, 73, 72, 72, 72, 71, 71, 71, 70, 70, 69, 69, 69, 68, 68, 67, 67, 66, 66, 65, 65, 64, 64, 63, 63, 62, 62, 61, 61, 60, 60, 59, 59, 58, 57, 57, 56, 56, 55, 55, 54, 53, 53, 52, 51, 51, 50, 50, 49, 48, 48, 47, 46, 46, 45, 44, 44, 43, 42, 41, 41, 40, 39, 39, 38, 37, 37, 36, 35, 34, 34, 33, 32, 31, 31, 30, 29, 28, 28, 27, 26, 25, 25, 24, 23, 22, 22, 21, 20, 19, 19, 18, 17, 16, 16, 15, 14, 13, 12, 12, 11, 10, 9, 9, 8, 7, 6, 6, 5, 4, 3, 3, 2, 1, 0, 0, 0, -1, -2, -2, -3, -4, -5, -5, -6, -7, -8, -8, -9, -10, -10, -11, -12, -13, -13, -14, -15, -15, -16, -17, -17, -18, -19, -19, -20, -21, -21, -22, -23, -23, -24, -25, -25, -26, -27, -27, -28, -28, -29, -30, -30, -31, -31, -32, -33, -33, -34, -34, -35, -35, -36, -36, -37, -37, -38, -38, -39, -39, -40, -40, -41, -41, -42, -42, -43, -43, -44, -44, -45, -45, -45, -46, -46, -47, -47, -47, -48, -48, -49, -49, -49, -50, -50, -50, -51, -51, -51, -51, -52, -52, -52, -53, -53, -53, -53, -54, -54, -54, -54, -54, -55, -55, -55, -55, -55, -56, -56, -56, -56, -56, -56, -56, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, -56, -56, -56, -56, -56, -56, -56, -55, -55, -55, -55, -55, -54, -54, -54, -54, -54, -53, -53, -53, -53, -52, -52, -52, -52, -51, -51, -51, -50, -50, -50, -50, -49, -49, -49, -48, -48, -48, -47, -47, -46, -46, -46, -45, -45, -45, -44, -44, -43, -43, -43, -42, -42, -41, -41, -40, -40, -40, -39, -39, -38, -38, -37, -37, -36, -36, -35, -35, -35, -34, -34, -33, -33, -32, -32, -31, -31, -30, -30, -29, -29, -28, -28, -27, -26, -26, -25, -25, -24, -24, -23, -23, -22, -22, -21, -21, -20, -19, -19, -18, -18, -17, -17, -16, -16, -15, -15, -14, -13, -13, -12, -12, -11, -11, -10, -9, -9, -8, -8, -7, -7, -6, -6, -5, -4, -4, -3, -3, -2, -2, -1, -1, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 37, 37, 37, 37, 37, 36, 36, 36, 36, 35, 35, 35, 35, 34, 34, 34, 34, 33, 33, 33, 33, 32, 32, 32, 31, 31, 31, 30, 30, 30, 30, 29, 29, 29, 28, 28, 28, 27, 27, 27, 26, 26, 26, 25, 25, 25, 24, 24, 23, 23, 23, 22, 22, 22, 21, 21, 21, 20, 20, 19, 19, 19, 18, 18, 18, 17, 17, 16, 16, 16, 15, 15, 14, 14, 14, 13, 13, 12, 12, 12, 11, 11, 10, 10, 10, 9, 9, 8, 8, 8, 7, 7, 6, 6, 6, 5, 5, 4, 4, 4, 3, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, -1, -1, -2, -2, -2, -3, -3, -3, -4, -4, -5, -5, -5, -6, -6, -6, -7, -7, -7, -8, -8, -9, -9, -9, -10, -10, -10, -11, -11, -11, -12, -12, -12, -13, -13, -13, -14, -14, -14, -14, -15, -15, -15, -16, -16, -16, -17, -17, -17, -17, -18, -18, -18, -19, -19, -19, -19, -20, -20, -20, -20, -21, -21, -21, -21, -21, -22, -22, -22, -22, -23, -23, -23, -23, -23, -24, -24, -24, -24, -24, -25, -25, -25, -25, -25, -25, -26, -26, -26, -26, -26, -26, -26, -27, -27, -27, -27, -27, -27, -27, -27, -27, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -29, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -26, -26, -26, -26, -26, -26, -26, -25, -25, -25, -25, -25, -25, -25, -24, -24, -24, -24, -24, -24, -23, -23, -23, -23, -23, -22, -22, -22, -22, -22, -21, -21, -21, -21, -21, -20, -20, -20, -20, -20, -19, -19, -19, -19, -18, -18, -18, -18, -17, -17, -17, -17, -16, -16, -16, -16, -15, -15, -15, -15, -14, -14, -14, -14, -13, -13, -13, -13, -12, -12, -12, -12, -11, -11, -11, -11, -10, -10, -10, -9, -9, -9, -9, -8, -8, -8, -7, -7, -7, -7, -6, -6, -6, -6, -5, -5, -5, -4, -4, -4, -4, -3, -3, -3, -2, -2, -2, -2, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 17, 17, 17, 17, 17, 17, 17, 17, 16, 16, 16, 16, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, -2, -3, -3, -3, -3, -3, -3, -4, -4, -4, -4, -4, -4, -5, -5, -5, -5, -5, -5, -5, -6, -6, -6, -6, -6, -6, -6, -7, -7, -7, -7, -7, -7, -7, -7, -8, -8, -8, -8, -8, -8, -8, -8, -9, -9, -9, -9, -9, -9, -9, -9, -9, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -7, -7, -7, -7, -7, -7, -7, -7, -7, -6, -6, -6, -6, -6, -6, -6, -6, -6, -5, -5, -5, -5, -5, -5, -5, -5, -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static short LARGE_FILTER_IMPD[] /* Impulse response differences */ = { -1, -2, -3, -5, -6, -7, -9, -10, -11, -13, -14, -15, -17, -18, -19, -21, -22, -23, -25, -26, -27, -28, -30, -32, -32, -34, -35, -36, -38, -39, -40, -42, -43, -44, -45, -47, -48, -49, -51, -52, -53, -54, -56, -56, -58, -60, -60, -62, -63, -64, -66, -66, -68, -69, -70, -72, -72, -74, -75, -76, -77, -79, -79, -81, -82, -83, -84, -85, -87, -87, -89, -90, -90, -92, -93, -94, -95, -96, -98, -98, -99, -100, -102, -102, -103, -105, -105, -106, -108, -108, -109, -110, -111, -112, -113, -114, -115, -116, -116, -118, -118, -119, -121, -120, -122, -123, -123, -125, -125, -126, -126, -128, -128, -129, -130, -130, -132, -132, -132, -134, -134, -135, -135, -136, -137, -137, -138, -139, -139, -140, -141, -141, -142, -142, -143, -143, -144, -145, -145, -145, -146, -147, -147, -147, -148, -149, -148, -150, -149, -150, -151, -151, -151, -152, -152, -152, -153, -153, -153, -153, -154, -154, -155, -155, -155, -155, -155, -156, -156, -156, -156, -156, -157, -157, -157, -157, -157, -157, -157, -158, -157, -158, -158, -157, -158, -158, -158, -158, -157, -158, -158, -158, -157, -158, -158, -157, -158, -157, -157, -157, -157, -157, -157, -157, -156, -156, -156, -156, -156, -155, -155, -155, -155, -155, -154, -154, -153, -154, -153, -153, -152, -152, -152, -151, -151, -151, -150, -150, -150, -149, -149, -148, -148, -147, -147, -147, -146, -145, -145, -145, -144, -144, -143, -142, -142, -142, -141, -140, -140, -139, -139, -138, -137, -137, -136, -136, -135, -134, -134, -133, -132, -132, -131, -130, -130, -129, -128, -128, -126, -126, -126, -125, -123, -124, -122, -122, -121, -120, -119, -119, -117, -117, -117, -115, -114, -113, -113, -112, -112, -110, -110, -108, -108, -107, -106, -106, -104, -104, -102, -102, -101, -100, -99, -98, -98, -96, -95, -95, -94, -92, -92, -91, -90, -89, -88, -87, -86, -85, -85, -83, -82, -82, -80, -80, -78, -78, -76, -76, -75, -73, -73, -72, -70, -70, -69, -68, -66, -66, -65, -64, -63, -61, -61, -60, -59, -58, -57, -56, -55, -54, -53, -51, -51, -50, -49, -48, -47, -46, -45, -44, -43, -42, -41, -41, -39, -38, -37, -36, -35, -34, -34, -32, -31, -31, -29, -28, -28, -26, -26, -24, -24, -23, -21, -21, -20, -19, -18, -17, -16, -15, -14, -13, -13, -11, -11, -9, -9, -8, -7, -6, -5, -5, -3, -2, -2, -1, 0, 1, 2, 2, 4, 4, 5, 6, 7, 8, 8, 10, 10, 11, 11, 13, 13, 14, 15, 15, 17, 17, 18, 18, 20, 20, 21, 21, 23, 23, 23, 25, 25, 26, 26, 27, 28, 28, 30, 29, 31, 31, 32, 32, 33, 34, 34, 35, 35, 36, 37, 37, 37, 39, 39, 39, 40, 40, 41, 42, 42, 42, 43, 44, 44, 44, 45, 46, 45, 47, 46, 48, 47, 48, 49, 49, 49, 49, 50, 51, 51, 51, 51, 52, 52, 53, 53, 53, 53, 54, 54, 54, 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, 57, 58, 58, 58, 58, 59, 58, 59, 59, 59, 59, 59, 59, 59, 60, 59, 60, 59, 60, 60, 60, 59, 60, 60, 60, 60, 59, 60, 60, 60, 60, 59, 60, 60, 59, 60, 59, 60, 59, 59, 59, 59, 59, 59, 59, 58, 59, 58, 58, 58, 58, 57, 58, 57, 57, 57, 57, 55, 57, 56, 56, 55, 56, 55, 55, 54, 55, 54, 54, 54, 53, 53, 53, 52, 53, 52, 51, 52, 51, 50, 51, 50, 49, 50, 49, 48, 49, 48, 47, 47, 47, 47, 46, 46, 45, 45, 45, 44, 44, 43, 43, 42, 43, 41, 42, 40, 41, 40, 39, 40, 38, 39, 37, 38, 37, 36, 36, 35, 36, 34, 34, 34, 33, 33, 32, 32, 31, 31, 30, 30, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 24, 22, 23, 21, 21, 21, 20, 20, 19, 19, 18, 18, 17, 16, 16, 16, 15, 14, 14, 14, 13, 12, 12, 11, 11, 11, 9, 10, 8, 9, 7, 8, 6, 7, 5, 5, 5, 4, 4, 3, 3, 2, 1, 1, 1, 0, 0, -1, -1, -2, -3, -3, -3, -4, -4, -5, -5, -6, -6, -7, -7, -8, -8, -8, -9, -10, -10, -10, -11, -11, -12, -12, -13, -13, -14, -14, -14, -15, -15, -16, -16, -16, -17, -18, -17, -18, -19, -19, -19, -20, -20, -21, -20, -22, -21, -22, -23, -22, -23, -24, -23, -25, -24, -25, -25, -25, -26, -26, -27, -26, -27, -28, -27, -28, -28, -29, -29, -29, -29, -30, -30, -30, -30, -31, -31, -31, -31, -32, -32, -32, -32, -33, -33, -33, -33, -33, -34, -34, -34, -34, -34, -35, -34, -35, -35, -35, -36, -35, -36, -35, -36, -36, -36, -37, -36, -36, -37, -37, -36, -37, -37, -37, -37, -37, -38, -37, -37, -38, -37, -38, -37, -38, -37, -38, -38, -37, -38, -38, -37, -38, -38, -37, -38, -38, -37, -38, -37, -38, -37, -38, -37, -38, -37, -37, -37, -37, -37, -37, -37, -37, -35, -37, -36, -37, -36, -36, -36, -36, -36, -35, -36, -35, -36, -35, -35, -34, -35, -34, -35, -34, -34, -34, -33, -34, -33, -33, -33, -32, -33, -32, -32, -32, -32, -31, -31, -31, -31, -31, -30, -30, -30, -29, -30, -29, -29, -28, -28, -29, -27, -28, -27, -27, -27, -26, -27, -25, -26, -25, -26, -24, -25, -24, -24, -23, -24, -23, -22, -23, -22, -22, -21, -21, -21, -21, -20, -20, -19, -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16, -15, -16, -14, -15, -14, -14, -14, -13, -13, -12, -12, -12, -12, -11, -10, -11, -10, -10, -9, -9, -9, -8, -8, -8, -7, -7, -6, -6, -6, -6, -5, -5, -4, -4, -4, -3, -3, -3, -2, -2, -2, -1, -1, -1, 0, 0, 0, 1, 1, 2, 1, 3, 2, 3, 3, 4, 3, 4, 5, 5, 5, 5, 6, 6, 7, 6, 8, 7, 8, 8, 8, 9, 9, 9, 10, 9, 11, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 17, 16, 18, 17, 17, 18, 18, 18, 19, 19, 19, 19, 19, 20, 19, 20, 21, 20, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 23, 22, 23, 23, 23, 23, 24, 24, 23, 24, 24, 24, 25, 24, 25, 24, 25, 25, 25, 25, 26, 25, 26, 25, 26, 26, 25, 26, 26, 26, 27, 26, 26, 27, 26, 27, 26, 27, 26, 27, 27, 27, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 26, 27, 27, 27, 27, 26, 27, 27, 26, 26, 26, 27, 26, 26, 27, 26, 26, 26, 26, 26, 26, 25, 26, 25, 26, 25, 25, 25, 25, 25, 25, 25, 24, 24, 25, 24, 24, 24, 23, 24, 24, 23, 23, 23, 23, 23, 22, 23, 22, 22, 22, 22, 21, 22, 21, 21, 21, 21, 20, 20, 21, 20, 19, 20, 19, 19, 19, 19, 19, 18, 18, 18, 18, 18, 17, 17, 17, 17, 16, 16, 16, 16, 16, 15, 15, 15, 14, 15, 14, 14, 14, 13, 13, 13, 13, 12, 13, 12, 11, 12, 11, 11, 11, 10, 11, 10, 9, 10, 9, 9, 9, 8, 9, 8, 7, 8, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 3, 4, 3, 3, 2, 2, 2, 2, 2, 1, 1, 0, 1, 0, 0, 0, -1, -1, -1, -1, -2, -2, -2, -2, -3, -2, -4, -3, -3, -4, -4, -5, -4, -5, -5, -5, -6, -6, -6, -6, -7, -6, -7, -7, -8, -7, -8, -8, -9, -8, -9, -9, -9, -10, -9, -10, -10, -10, -11, -10, -11, -11, -12, -11, -12, -12, -12, -12, -13, -12, -13, -13, -13, -14, -13, -14, -14, -14, -14, -15, -14, -15, -15, -15, -15, -16, -15, -16, -16, -16, -16, -16, -17, -16, -17, -17, -17, -17, -17, -18, -17, -18, -18, -17, -18, -18, -19, -18, -18, -19, -18, -19, -19, -19, -19, -19, -19, -19, -19, -20, -19, -20, -19, -20, -20, -20, -19, -20, -20, -20, -20, -20, -21, -20, -20, -20, -21, -20, -20, -21, -20, -21, -20, -20, -21, -20, -21, -20, -21, -20, -21, -20, -21, -21, -20, -20, -21, -20, -21, -20, -21, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -19, -20, -20, -19, -20, -19, -19, -19, -20, -19, -19, -18, -19, -19, -19, -18, -18, -19, -18, -18, -18, -18, -18, -18, -17, -18, -17, -17, -17, -17, -17, -17, -16, -17, -16, -16, -17, -15, -16, -16, -15, -16, -15, -15, -15, -15, -15, -14, -14, -15, -14, -13, -14, -14, -13, -13, -13, -13, -13, -13, -12, -12, -12, -12, -12, -11, -12, -11, -11, -11, -10, -11, -10, -10, -10, -9, -10, -9, -9, -9, -9, -9, -8, -8, -8, -8, -8, -7, -7, -7, -7, -7, -6, -6, -6, -6, -6, -5, -5, -6, -4, -5, -4, -5, -4, -4, -3, -4, -3, -3, -3, -2, -3, -2, -2, -2, -1, -2, -1, -1, -1, 0, -1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 2, 4, 3, 3, 4, 4, 4, 4, 5, 4, 5, 5, 5, 6, 5, 6, 6, 6, 6, 7, 6, 7, 7, 7, 7, 8, 7, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 10, 9, 10, 10, 10, 10, 10, 11, 10, 11, 11, 11, 11, 11, 11, 12, 11, 12, 12, 12, 12, 12, 13, 12, 13, 13, 12, 13, 13, 14, 13, 13, 14, 13, 14, 14, 13, 14, 14, 15, 14, 14, 14, 15, 14, 15, 15, 14, 15, 15, 15, 15, 15, 16, 15, 15, 15, 16, 15, 16, 15, 16, 15, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 15, 16, 16, 15, 16, 16, 15, 15, 16, 15, 16, 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 14, 15, 14, 14, 15, 14, 14, 14, 14, 13, 14, 14, 13, 13, 14, 13, 13, 13, 13, 13, 12, 13, 12, 13, 12, 12, 12, 12, 12, 12, 11, 12, 11, 11, 11, 11, 11, 11, 10, 11, 10, 10, 10, 10, 10, 10, 9, 10, 9, 9, 9, 9, 8, 9, 8, 9, 8, 8, 8, 7, 8, 7, 7, 7, 7, 7, 7, 6, 7, 6, 6, 6, 5, 6, 5, 5, 6, 4, 5, 5, 4, 5, 4, 4, 4, 3, 4, 3, 3, 3, 3, 3, 2, 3, 2, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 0, 0, 1, 0, -1, 0, 0, -1, -1, -1, -1, -1, -2, -1, -2, -2, -2, -2, -2, -3, -2, -3, -3, -3, -3, -4, -3, -4, -4, -4, -4, -4, -5, -4, -5, -5, -5, -5, -5, -6, -5, -6, -6, -6, -6, -6, -6, -7, -6, -7, -7, -7, -7, -7, -7, -8, -8, -7, -8, -8, -8, -8, -9, -8, -9, -8, -9, -9, -9, -9, -9, -9, -10, -9, -10, -9, -10, -10, -10, -10, -10, -10, -11, -10, -11, -10, -11, -11, -11, -10, -11, -11, -12, -11, -11, -11, -12, -11, -12, -12, -11, -12, -12, -12, -11, -12, -12, -13, -12, -12, -12, -12, -13, -12, -12, -13, -12, -13, -12, -13, -12, -13, -13, -12, -13, -13, -13, -12, -13, -13, -13, -13, -12, -13, -13, -13, -13, -13, -13, -12, -13, -13, -13, -13, -13, -13, -13, -12, -13, -13, -13, -13, -11, -13, -13, -12, -13, -13, -12, -13, -12, -13, -12, -13, -12, -13, -12, -12, -13, -12, -12, -12, -12, -12, -12, -12, -12, -12, -11, -12, -12, -11, -12, -11, -11, -12, -11, -11, -11, -11, -11, -11, -11, -11, -10, -11, -10, -11, -10, -10, -10, -10, -10, -10, -10, -10, -10, -9, -10, -9, -9, -9, -9, -9, -9, -9, -9, -8, -9, -8, -8, -8, -8, -8, -8, -8, -8, -7, -7, -8, -7, -7, -7, -7, -6, -7, -7, -6, -6, -6, -6, -6, -6, -6, -5, -6, -5, -5, -5, -5, -5, -4, -5, -4, -5, -4, -4, -4, -4, -3, -4, -3, -4, -3, -3, -3, -3, -2, -3, -2, -2, -3, -2, -1, -2, -2, -1, -2, -1, -1, -1, -1, -1, 0, -1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 2, 1, 1, 1, 2, 2, 1, 2, 2, 3, 2, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 4, 3, 4, 4, 4, 5, 4, 5, 4, 5, 5, 5, 5, 5, 5, 5, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 8, 8, 7, 8, 8, 8, 8, 8, 8, 9, 8, 9, 8, 9, 8, 9, 9, 8, 9, 9, 9, 9, 9, 10, 9, 9, 9, 10, 9, 10, 9, 10, 10, 9, 10, 10, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 10, 10, 10, 10, 11, 10, 10, 11, 10, 10, 11, 10, 10, 11, 10, 10, 11, 10, 11, 10, 11, 10, 10, 11, 10, 10, 11, 10, 11, 10, 10, 10, 10, 10, 10, 11, 10, 10, 10, 10, 11, 10, 10, 10, 10, 10, 10, 10, 10, 9, 10, 10, 10, 9, 10, 10, 9, 10, 9, 10, 9, 9, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 9, 8, 9, 8, 8, 9, 8, 8, 8, 8, 8, 8, 7, 8, 8, 7, 8, 7, 7, 8, 7, 7, 7, 7, 6, 7, 7, 6, 7, 6, 7, 6, 6, 6, 6, 6, 6, 5, 6, 5, 6, 5, 5, 5, 5, 5, 5, 5, 4, 5, 4, 5, 4, 4, 4, 4, 4, 4, 3, 4, 3, 4, 3, 3, 3, 3, 3, 3, 2, 3, 2, 2, 3, 2, 2, 2, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, -1, -1, 0, -1, -1, -1, -2, -1, -1, -2, -1, -2, -2, -2, -2, -2, -2, -2, -3, -2, -3, -2, -3, -3, -3, -3, -3, -3, -4, -3, -4, -3, -4, -4, -3, -4, -4, -5, -4, -4, -4, -5, -4, -5, -5, -5, -4, -5, -5, -6, -5, -5, -5, -6, -5, -6, -5, -6, -6, -6, -6, -6, -6, -6, -6, -6, -7, -6, -6, -7, -6, -7, -7, -6, -7, -7, -7, -7, -7, -7, -7, -7, -8, -7, -7, -8, -7, -8, -7, -8, -7, -8, -7, -8, -8, -8, -8, -7, -8, -8, -8, -8, -8, -8, -8, -8, -9, -8, -8, -8, -8, -9, -8, -8, -8, -9, -8, -8, -9, -8, -9, -8, -8, -9, -8, -9, -8, -9, -8, -8, -9, -8, -9, -8, -9, -8, -9, -8, -8, -9, -8, -9, -8, -7, -9, -8, -8, -9, -8, -8, -9, -8, -8, -8, -8, -8, -9, -8, -8, -8, -8, -8, -8, -8, -8, -7, -8, -8, -8, -7, -8, -8, -7, -8, -7, -8, -7, -8, -7, -7, -7, -8, -7, -7, -7, -7, -7, -7, -7, -6, -7, -7, -6, -7, -7, -6, -6, -7, -6, -6, -6, -6, -6, -6, -6, -6, -6, -6, -5, -6, -5, -6, -5, -5, -6, -5, -5, -5, -5, -5, -4, -5, -5, -4, -5, -4, -5, -4, -4, -4, -4, -4, -4, -4, -4, -3, -4, -3, -4, -3, -3, -3, -4, -3, -2, -3, -3, -3, -2, -3, -2, -3, -2, -2, -2, -2, -2, -2, -2, -1, -2, -1, -2, -1, -1, -1, -2, -1, 0, -1, -1, -1, 0, -1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 3, 2, 2, 2, 3, 2, 3, 3, 2, 3, 3, 3, 3, 3, 3, 4, 3, 3, 4, 3, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 5, 5, 4, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 6, 5, 6, 5, 6, 6, 5, 6, 6, 6, 5, 6, 6, 6, 6, 6, 6, 7, 6, 6, 6, 6, 7, 6, 6, 7, 6, 7, 6, 6, 7, 7, 6, 7, 6, 7, 6, 7, 7, 7, 6, 7, 7, 6, 7, 7, 7, 7, 6, 7, 7, 7, 7, 7, 6, 7, 7, 7, 7, 7, 7, 6, 7, 7, 7, 7, 7, 7, 6, 7, 7, 6, 7, 6, 7, 7, 7, 6, 7, 7, 6, 7, 7, 6, 7, 7, 6, 7, 6, 7, 6, 7, 6, 6, 7, 6, 6, 7, 6, 6, 6, 6, 6, 7, 6, 6, 6, 6, 5, 6, 6, 6, 6, 5, 6, 6, 5, 6, 5, 6, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, 4, 5, 4, 5, 4, 4, 4, 5, 4, 4, 4, 4, 3, 4, 4, 4, 3, 4, 3, 4, 3, 3, 4, 3, 3, 3, 3, 3, 3, 2, 3, 3, 2, 3, 2, 3, 2, 2, 3, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -2, -1, -1, -2, -1, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -3, -2, -2, -3, -2, -3, -2, -3, -3, -2, -3, -3, -3, -3, -3, -3, -3, -4, -3, -3, -4, -3, -4, -3, -4, -3, -4, -4, -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -5, -4, -4, -5, -4, -4, -5, -4, -5, -4, -5, -5, -4, -5, -5, -4, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -6, -5, -5, -5, -5, -6, -5, -5, -6, -5, -5, -6, -5, -6, -5, -6, -5, -6, -5, -5, -6, -6, -5, -6, -5, -6, -5, -6, -5, -6, -5, -6, -6, -5, -6, -5, -6, -5, -6, -5, -6, -6, -5, -6, -5, -5, -5, -6, -5, -6, -5, -6, -5, -5, -6, -5, -6, -5, -5, -6, -5, -5, -6, -5, -5, -5, -6, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -4, -5, -5, -5, -4, -5, -5, -4, -5, -4, -5, -4, -4, -5, -4, -4, -5, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -4, -4, -3, -4, -4, -3, -4, -3, -3, -4, -3, -3, -3, -4, -3, -3, -3, -3, -3, -2, -3, -3, -3, -2, -3, -2, -3, -2, -3, -2, -2, -3, -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -1, -2, -2, -1, -1, -2, -1, -1, -1, -2, -1, -1, -1, -1, 0, -1, -1, -1, 0, -1, 0, -1, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 4, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 4, 3, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 5, 4, 4, 5, 4, 4, 5, 4, 5, 4, 4, 5, 4, 5, 4, 5, 4, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 3, 4, 5, 4, 5, 4, 4, 5, 4, 5, 4, 4, 5, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 3, 4, 4, 4, 3, 4, 4, 3, 4, 3, 4, 3, 3, 4, 3, 4, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -2, -1, -2, -1, -2, -1, -2, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -3, -2, -2, -2, -3, -2, -3, -2, -3, -2, -3, -2, -3, -2, -3, -3, -3, -2, -3, -3, -3, -3, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -4, -3, -3, -3, -3, -4, -3, -3, -3, -4, -3, -3, -4, -3, -3, -4, -3, -3, -4, -3, -4, -3, -4, -3, -4, -3, -4, -3, -4, -3, -4, -3, -4, -3, -4, -4, -3, -4, -3, -4, -4, -3, -4, -3, -4, -4, -3, -4, -3, -4, -4, -3, -4, -3, -4, -3, -4, -4, -3, -3, -3, -4, -3, -4, -4, -3, -4, -3, -4, -3, -4, -3, -3, -4, -3, -4, -3, -4, -3, -3, -4, -3, -3, -4, -3, -3, -4, -3, -3, -3, -3, -4, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, -3, -3, -3, -2, -3, -3, -2, -3, -2, -3, -2, -3, -2, -3, -2, -3, -2, -2, -3, -2, -2, -2, -2, -2, -3, -2, -2, -2, -2, -2, -2, -1, -2, -2, -2, -2, -1, -2, -2, -1, -2, -1, -2, -1, -2, -1, -2, -1, -1, -2, -1, -1, -1, -1, -1, -2, -1, -1, 0, -1, -1, -1, -1, -1, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 2, 3, 2, 3, 3, 2, 3, 3, 3, 2, 3, 3, 2, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 3, 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -2, -1, -1, -1, -2, -1, -1, -2, -1, -2, -1, -2, -1, -2, -1, -2, -1, -2, -1, -2, -2, -1, -2, -2, -1, -2, -2, -2, -1, -2, -2, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -3, -2, -2, -2, -2, -2, -2, -3, -2, -2, -2, -2, -3, -2, -2, -2, -3, -2, -2, -2, -2, -3, -2, -2, -2, -3, -2, -2, -2, -3, -2, -2, -3, -2, -2, -2, -3, -2, -2, -2, -3, -2, -2, -2, -3, -1, -2, -2, -2, -3, -2, -2, -2, -2, -3, -2, -2, -2, -2, -2, -3, -2, -2, -2, -2, -2, -2, -2, -2, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -2, -2, -2, -2, -1, -2, -2, -2, -2, -1, -2, -2, -2, -1, -2, -2, -1, -2, -1, -2, -2, -1, -2, -1, -2, -1, -2, -1, -2, -1, -1, -2, -1, -1, -2, -1, -1, -2, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -2, -1, -1, -1, -2, -1, -1, -1, -2, -1, -1, -1, -2, -1, -1, -2, -1, -1, -2, -1, -1, -1, -2, -1, -1, -2, -1, -1, -2, -1, -2, -1, -1, -2, -1, -1, -2, -1, -1, -2, -1, -1, -2, -1, -1, -2, -1, -2, -1, -1, -2, -1, -1, -2, -1, -1, -1, -1, -1, -2, -1, -1, -2, -1, -1, -1, -2, -1, -1, -2, -1, -1, -1, -2, -1, -1, -2, -1, -1, -1, -1, -2, -1, -1, -1, -2, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, 0, -1, -1, 0, -1, -1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -1, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; darkice-1.0/src/LameLibEncoder.h0000644000175000001440000003555211371632310013445 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : LameLibEncoder.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef LAME_LIB_ENCODER_H #define LAME_LIB_ENCODER_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_LAME_LIB #include #else #error configure with lame #endif #include "Ref.h" #include "Exception.h" #include "Reporter.h" #include "AudioEncoder.h" #include "Sink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A class representing the lame encoder linked as a shared object or as * a static library. * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class LameLibEncoder : public AudioEncoder, public virtual Reporter { private: /** * Lame library global flags */ lame_global_flags * lameGlobalFlags; /** * Lowpass filter. Sound frequency in Hz, from where up the * input is cut. */ int lowpass; /** * Highpass filter. Sound frequency in Hz, from where down the * input is cut. */ int highpass; /** * Initialize the object. * * @param lowpass frequency threshold for the lowpass filter. * Input above this frequency is cut. * If 0, lame's default values are used, * which depends on the out sample rate. * @param highpass frequency threshold for the highpass filter. * Input below this frequency is cut. * If 0, lame's default values are used, * which depends on the out sample rate. * @exception Exception */ inline void init ( int lowpass, int highpass ) throw ( Exception ) { this->lameGlobalFlags = NULL; this->lowpass = lowpass; this->highpass = highpass; if ( getInBitsPerSample() != 16 && getInBitsPerSample() != 8 ) { throw Exception( __FILE__, __LINE__, "specified bits per sample not supported", getInBitsPerSample() ); } if ( getInChannel() != 1 && getInChannel() != 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of input channels for the encoder", getInChannel() ); } if ( getOutChannel() != 1 && getOutChannel() != 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of output channels for the encoder", getOutChannel() ); } if ( getInChannel() < getOutChannel() ) { throw Exception( __FILE__, __LINE__, "output channels greater then input channels", getOutChannel() ); } } /** * De-initialize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { } protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline LameLibEncoder ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor. * * @param sink the sink to send mp3 output to * @param inSampleRate sample rate of the input. * @param inBitsPerSample number of bits per sample of the input. * @param inChannel number of channels of the input. * @param inBigEndian shows if the input is big or little endian * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, inSampleRate is used. * @param outChannel number of channels of the output. * If 0, inChannel is used. * @param lowpass frequency threshold for the lowpass filter. * Input above this frequency is cut. * If 0, lame's default values are used, * which depends on the out sample rate. * @param highpass frequency threshold for the highpass filter. * Input below this frequency is cut. * If 0, lame's default values are used, * which depends on the out sample rate. * @exception Exception */ inline LameLibEncoder ( Sink * sink, unsigned int inSampleRate, unsigned int inBitsPerSample, unsigned int inChannel, bool inBigEndian, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, int lowpass = 0, int highpass = 0 ) throw ( Exception ) : AudioEncoder ( sink, inSampleRate, inBitsPerSample, inChannel, inBigEndian, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( lowpass, highpass); } /** * Constructor. * * @param sink the sink to send mp3 output to * @param as get input sample rate, bits per sample and channels * from this AudioSource. * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, input sample rate is used. * @param outChannel number of channels of the output. * If 0, input channel is used. * @param lowpass frequency threshold for the lowpass filter. * Input above this frequency is cut. * If 0, lame's default values are used, * which depends on the out sample rate. * @param highpass frequency threshold for the highpass filter. * Input below this frequency is cut. * If 0, lame's default values are used, * which depends on the out sample rate. * @exception Exception */ inline LameLibEncoder ( Sink * sink, const AudioSource * as, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, int lowpass = 0, int highpass = 0 ) throw ( Exception ) : AudioEncoder ( sink, as, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( lowpass, highpass); } /** * Copy constructor. * * @param encoder the LameLibEncoder to copy. */ inline LameLibEncoder ( const LameLibEncoder & encoder ) throw ( Exception ) : AudioEncoder( encoder ) { init( encoder.lowpass, encoder.highpass ); } /** * Destructor. * * @exception Exception */ inline virtual ~LameLibEncoder ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } strip(); } /** * Assignment operator. * * @param encoder the LameLibEncoder to assign this to. * @return a reference to this LameLibEncoder. * @exception Exception */ inline virtual LameLibEncoder & operator= ( const LameLibEncoder & encoder ) throw ( Exception ) { if ( this != &encoder ) { strip(); AudioEncoder::operator=( encoder); init( encoder.lowpass, encoder.highpass ); } return *this; } /** * Get the version string of the underlying lame library. * * @return the version string of the underlying lame library. */ inline const char * getLameVersion( void ) { return get_lame_version(); } /** * Check wether encoding is in progress. * * @return true if encoding is in progress, false otherwise. */ inline virtual bool isRunning ( void ) const throw () { return isOpen(); } /** * Start encoding. This function returns as soon as possible, * with encoding started in the background. * * @return true if encoding has started, false otherwise. * @exception Exception */ inline virtual bool start ( void ) throw ( Exception ) { return open(); } /** * Stop encoding. Stops the encoding running in the background. * * @exception Exception */ inline virtual void stop ( void ) throw ( Exception ) { return close(); } /** * Open an encoding session. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the encoding session is open. * * @return true if the encoding session is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return lameGlobalFlags != 0; } /** * Check if the encoder is ready to accept data. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the encoder is ready to accept data, * false otherwise. * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { if ( !isOpen() ) { return false; } return true; } /** * Write data to the encoder. * Buf is expected to be a sequence of big-endian 16 bit values, * with left and right channels interleaved. Len is the number of * bytes, must be a multiple of 4. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * Flush all data that was written to the encoder to the underlying * connection. * * @exception Exception */ virtual void flush ( void ) throw ( Exception ); /** * Close the encoding session. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* LAME_LIB_ENCODER_H */ darkice-1.0/src/IceCast.h0000644000175000001440000001721511371632310012147 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : IceCast.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef ICE_CAST_H #define ICE_CAST_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Sink.h" #include "TcpSocket.h" #include "CastSink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Class representing output to an IceCast server with * x-audiocast login * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class IceCast : public CastSink { private: /** * Mount point of the stream on the server. */ char * mountPoint; /** * Remote dump file if any. */ char * remoteDumpFile; /** * Description of the stream. */ char * description; /** * Initalize the object. * * @param mountPoint mount point of the stream on the server. * @param remoteDumpFile remote dump file (may be NULL). * @param description description of the stream. * @exception Exception */ void init ( const char * mountPoint, const char * description, const char * remoteDumpFile ) throw ( Exception ); /** * De-initalize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline IceCast ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Log in to the server using the socket avialable. * * @return true if login was successful, false otherwise. * @exception Exception */ virtual bool sendLogin ( void ) throw ( Exception ); public: /** * Constructor. * * @param socket socket connection to the server. * @param password password to the server. * @param mountPoint mount point of the stream on the server. * @param remoteDumpFile remote dump file (may be NULL). * @param name name of the stream. * @param description description of the stream. * @param url URL associated with the stream. * @param genre genre of the stream. * @param bitRate bitrate of the stream (e.g. mp3 bitrate). * @param isPublic is the stream public? * @param streamDump an optional sink to dump the binary stream * data to. * @param bufferDuration duration of the BufferedSink buffer * in seconds. * @exception Exception */ inline IceCast ( TcpSocket * socket, const char * password, const char * mountPoint, unsigned int bitRate, const char * name = 0, const char * description = 0, const char * url = 0, const char * genre = 0, bool isPublic = false, const char * remoteDumpFile = 0, Sink * streamDump = 0, unsigned int bufferDuration = 10 ) throw ( Exception ) : CastSink( socket, password, bitRate, name, url, genre, isPublic, streamDump, bufferDuration ) { init( mountPoint, description, remoteDumpFile); } /** * Copy constructor. * * @param cs the IceCast to copy. */ inline IceCast( const IceCast & cs ) throw ( Exception ) : CastSink( cs ) { init( cs.getMountPoint(), cs.getDescription(), cs.getRemoteDumpFile() ); } /** * Destructor. * * @exception Exception */ inline virtual ~IceCast( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param cs the IceCast to assign this to. * @return a reference to this IceCast. * @exception Exception */ inline virtual IceCast & operator= ( const IceCast & cs ) throw ( Exception ) { if ( this != &cs ) { strip(); CastSink::operator=( cs ); init( cs.getMountPoint(), cs.getDescription(), cs.getRemoteDumpFile() ); } return *this; } /** * Get the mount point of the stream on the server. * * @return the mount point of the stream on the server. */ inline const char * getMountPoint ( void ) const throw () { return mountPoint; } /** * Get the remote dump file if any. * * @return the remote dump file. May be NULL. */ inline const char * getRemoteDumpFile ( void ) const throw () { return remoteDumpFile; } /** * Get the description of the stream. * * @return the description of the stream. */ inline const char * getDescription ( void ) const throw () { return description; } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* ICE_CAST_H */ darkice-1.0/src/Makefile.am0000644000175000001440000000605711371631674012535 00000000000000bin_PROGRAMS = darkice AM_CXXFLAGS = -O2 -pedantic -Wall @DEBUG_CXXFLAGS@ @PTHREAD_CFLAGS@ @JACK_CFLAGS@ INCLUDES = @LAME_INCFLAGS@ @VORBIS_INCFLAGS@ @FAAC_INCFLAGS@ @AACPLUS_INCFLAGS@ @TWOLAME_INCFLAGS@ \ @ALSA_INCFLAGS@ @JACK_INCFLAGS@ @SRC_INCFLAGS@ LDADD = @PTHREAD_LIBS@ @LAME_LDFLAGS@ @VORBIS_LDFLAGS@ @FAAC_LDFLAGS@ @AACPLUS_LDFLAGS@ @TWOLAME_LDFLAGS@ \ @ALSA_LDFLAGS@ @JACK_LDFLAGS@ @SRC_LDFLAGS@ if HAVE_SRC_LIB AFLIB_SOURCE = else AFLIB_SOURCE = aflibDebug.h\ aflibDebug.cc\ aflibConverter.h\ aflibConverter.cc\ aflibConverterLargeFilter.h\ aflibConverterSmallFilter.h endif darkice_SOURCES = AudioEncoder.h\ AudioSource.h\ AudioSource.cpp\ BufferedSink.cpp\ BufferedSink.h\ CastSink.cpp\ CastSink.h\ FileSink.h\ FileSink.cpp\ Connector.cpp\ Connector.h\ MultiThreadedConnector.cpp\ MultiThreadedConnector.h\ DarkIce.cpp\ DarkIce.h\ Exception.cpp\ Exception.h\ IceCast.cpp\ IceCast.h\ IceCast2.cpp\ IceCast2.h\ ShoutCast.cpp\ ShoutCast.h\ FileCast.h\ FileCast.cpp\ LameLibEncoder.cpp\ LameLibEncoder.h\ TwoLameLibEncoder.cpp\ TwoLameLibEncoder.h\ VorbisLibEncoder.cpp\ VorbisLibEncoder.h\ FaacEncoder.cpp\ FaacEncoder.h\ aacPlusEncoder.cpp\ aacPlusEncoder.h\ OssDspSource.cpp\ OssDspSource.h\ SerialUlaw.cpp\ SerialUlaw.h\ SolarisDspSource.cpp\ SolarisDspSource.h\ Ref.h\ Referable.h\ Sink.h\ Source.h\ TcpSocket.cpp\ TcpSocket.h\ Util.cpp\ Util.h\ ConfigSection.h\ ConfigSection.cpp\ DarkIceConfig.h\ DarkIceConfig.cpp\ Reporter.h\ Reporter.cpp\ AlsaDspSource.h\ AlsaDspSource.cpp\ JackDspSource.h\ JackDspSource.cpp\ main.cpp \ $(AFLIB_SOURCE) EXTRA_darkice_SOURCES = aflibDebug.h\ aflibDebug.cc\ aflibConverter.h\ aflibConverter.cc\ aflibConverterLargeFilter.h\ aflibConverterSmallFilter.h darkice-1.0/src/MultiThreadedConnector.cpp0000644000175000001440000003273411371632310015600 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : MultiThreadedConnector.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_SYS_TYPES_H #include #else #error need sys/types.h #endif #include "Exception.h" #include "MultiThreadedConnector.h" #include "Util.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: MultiThreadedConnector.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void MultiThreadedConnector :: init ( bool reconnect ) throw ( Exception ) { this->reconnect = reconnect; pthread_mutex_init( &mutexProduce, 0); pthread_cond_init( &condProduce, 0); threads = 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void MultiThreadedConnector :: strip ( void ) throw ( Exception ) { if ( threads ) { delete[] threads; threads = 0; } pthread_cond_destroy( &condProduce); pthread_mutex_destroy( &mutexProduce); } /*------------------------------------------------------------------------------ * Constructor *----------------------------------------------------------------------------*/ MultiThreadedConnector :: MultiThreadedConnector ( const MultiThreadedConnector & connector ) throw ( Exception ) : Connector( connector) { reconnect = connector.reconnect; mutexProduce = connector.mutexProduce; condProduce = connector.condProduce; if ( threads ) { delete[] threads; } threads = new ThreadData[numSinks]; for ( unsigned int i = 0; i < numSinks; ++i ) { threads[i] = connector.threads[i]; } } /*------------------------------------------------------------------------------ * Assignment operator *----------------------------------------------------------------------------*/ MultiThreadedConnector & MultiThreadedConnector :: operator= ( const MultiThreadedConnector & connector ) throw ( Exception ) { if ( this != &connector ) { Connector::operator=( connector); reconnect = connector.reconnect; mutexProduce = connector.mutexProduce; condProduce = connector.condProduce; if ( threads ) { delete[] threads; } threads = new ThreadData[numSinks]; for ( unsigned int i = 0; i < numSinks; ++i ) { threads[i] = connector.threads[i]; } } return *this; } /*------------------------------------------------------------------------------ * Open the source and all the sinks if needed * Create the sink threads *----------------------------------------------------------------------------*/ bool MultiThreadedConnector :: open ( void ) throw ( Exception ) { unsigned int i; size_t st; if ( !Connector::open() ) { return false; } running = true; pthread_attr_init( &threadAttr); pthread_attr_getstacksize(&threadAttr, &st); if (st < 128 * 1024) { reportEvent( 5, "MultiThreadedConnector :: open, stack size ", (long)st); st = 128 * 1024; pthread_attr_setstacksize(&threadAttr, st); } pthread_attr_setdetachstate( &threadAttr, PTHREAD_CREATE_JOINABLE); threads = new ThreadData[numSinks]; for ( i = 0; i < numSinks; ++i ) { ThreadData * threadData = threads + i; threadData->connector = this; threadData->ixSink = i; threadData->accepting = true; threadData->isDone = true; if ( pthread_create( &(threadData->thread), &threadAttr, ThreadData::threadFunction, threadData ) ) { break; } } // if could not create all, delete the ones created if ( i < numSinks ) { unsigned int j; // signal to stop for all running threads pthread_mutex_lock( &mutexProduce); running = false; pthread_cond_broadcast( &condProduce); pthread_mutex_unlock( &mutexProduce); for ( j = 0; j < i; ++j ) { pthread_join( threads[j].thread, 0); } delete[] threads; threads = 0; return false; } return true; } /*------------------------------------------------------------------------------ * Transfer some data from the source to the sink *----------------------------------------------------------------------------*/ unsigned int MultiThreadedConnector :: transfer ( unsigned long bytes, unsigned int bufSize, unsigned int sec, unsigned int usec ) throw ( Exception ) { unsigned int b; if ( numSinks == 0 ) { return 0; } if ( bufSize == 0 ) { return 0; } dataBuffer = new unsigned char[bufSize]; dataSize = 0; reportEvent( 6, "MultiThreadedConnector :: tranfer, bytes", bytes); for ( b = 0; !bytes || b < bytes; ) { if ( source->canRead( sec, usec) ) { unsigned int i; pthread_mutex_lock( &mutexProduce); dataSize = source->read( dataBuffer, bufSize); b += dataSize; // check for EOF if ( dataSize == 0 ) { reportEvent( 3, "MultiThreadedConnector :: transfer, EOF"); pthread_mutex_unlock( &mutexProduce); break; } for ( i = 0; i < numSinks; ++i ) { threads[i].isDone = false; } // tell sink threads that there is some data available pthread_cond_broadcast( &condProduce); // wait for all sink threads to get done with this data while ( true ) { for ( i = 0; i < numSinks && threads[i].isDone; ++i ); if ( i == numSinks ) { break; } pthread_cond_wait( &condProduce, &mutexProduce); } pthread_mutex_unlock( &mutexProduce); } else { reportEvent( 3, "MultiThreadedConnector :: transfer, can't read"); break; } } delete[] dataBuffer; return b; } /*------------------------------------------------------------------------------ * The function for each thread. * Read the presented data *----------------------------------------------------------------------------*/ void MultiThreadedConnector :: sinkThread( int ixSink ) { ThreadData * threadData = &threads[ixSink]; Sink * sink = sinks[ixSink].get(); while ( running ) { // wait for some data to become available pthread_mutex_lock( &mutexProduce); while ( running && threadData->isDone ) { pthread_cond_wait( &condProduce, &mutexProduce); } if ( !running ) { pthread_mutex_unlock( &mutexProduce); break; } if ( threadData->cut) { sink->cut(); threadData->cut = false; } if ( threadData->accepting ) { if ( sink->canWrite( 0, 0) ) { try { sink->write( dataBuffer, dataSize); } catch ( Exception & e ) { // something wrong. don't accept more data, try to // reopen the sink next time around threadData->accepting = false; } } else { reportEvent( 4, "MultiThreadedConnector :: sinkThread can't write ", ixSink); // don't care if we can't write } } threadData->isDone = true; pthread_cond_broadcast( &condProduce); pthread_mutex_unlock( &mutexProduce); if ( !threadData->accepting ) { if ( reconnect ) { reportEvent( 4, "MultiThreadedConnector :: sinkThread reconnecting ", ixSink); // if we're not accepting, try to reopen the sink try { sink->close(); Util::sleep(1L, 0L); sink->open(); sched_yield(); threadData->accepting = sink->isOpen(); } catch ( Exception & e ) { // don't care, just try and try again } } else { // if !reconnect, just stop the connector running = false; } } } } /*------------------------------------------------------------------------------ * Signal to each sink to cut what they've done so far, and start anew. *----------------------------------------------------------------------------*/ void MultiThreadedConnector :: cut ( void ) throw () { for ( unsigned int i = 0; i < numSinks; ++i ) { threads[i].cut = true; } // TODO: it might be more appropriate to signal all the threads here // but, they'll get signaled on new data anyway, and it might be // enough for them to cut at that time } /*------------------------------------------------------------------------------ * Stop the treads * Close the source and all the sinks if needed *----------------------------------------------------------------------------*/ void MultiThreadedConnector :: close ( void ) throw ( Exception ) { unsigned int i; // signal to stop for all threads pthread_mutex_lock( &mutexProduce); running = false; pthread_cond_broadcast( &condProduce); pthread_mutex_unlock( &mutexProduce); // wait for all the threads to finish for ( i = 0; i < numSinks; ++i ) { pthread_join( threads[i].thread, 0); } pthread_attr_destroy( &threadAttr); Connector::close(); } /*------------------------------------------------------------------------------ * The thread function *----------------------------------------------------------------------------*/ void * MultiThreadedConnector :: ThreadData :: threadFunction( void * param ) { struct sched_param sched; int sched_type; ThreadData * threadData = (ThreadData*) param; pthread_getschedparam( threadData->thread, &sched_type, &sched ); reportEvent( 5, "MultiThreadedConnector :: ThreadData :: threadFunction, " "was (thread, priority, type): ", param, sched.sched_priority, sched_type == SCHED_FIFO ? "SCHED_FIFO" : sched_type == SCHED_RR ? "SCHED_RR" : sched_type == SCHED_OTHER ? "SCHED_OTHER" : "INVALID" ); sched.sched_priority = 1; pthread_setschedparam( threadData->thread, SCHED_FIFO, &sched); pthread_getschedparam( threadData->thread, &sched_type, &sched ); reportEvent( 5, "MultiThreadedConnector :: ThreadData :: threadFunction, " "now is (thread, priority, type): ", param, sched.sched_priority, sched_type == SCHED_FIFO ? "SCHED_FIFO" : sched_type == SCHED_RR ? "SCHED_RR" : sched_type == SCHED_OTHER ? "SCHED_OTHER" : "INVALID" ); threadData->connector->sinkThread( threadData->ixSink); return 0; } darkice-1.0/src/OssDspSource.h0000644000175000001440000001665111371632310013233 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : OssDspSource.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef OSS_DSP_SOURCE_H #define OSS_DSP_SOURCE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Reporter.h" #include "AudioSource.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * An audio input based on /dev/dsp-like raw devices * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class OssDspSource : public AudioSource, public virtual Reporter { private: /** * The file name of the OSS DSP device (e.g. /dev/dsp or /dev/dsp0). */ char * fileName; /** * The low-level file descriptor of the OSS DSP device. */ int fileDescriptor; /** * Indicates wether the low-level OSS DSP device is in a recording * state. */ bool running; protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline OssDspSource ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Initialize the object * * @param name the file name of the OSS DSP device. * @exception Exception */ void init ( const char * name ) throw ( Exception ); /** * De-iitialize the object * * @exception Exception */ void strip ( void ) throw ( Exception ); public: /** * Constructor. * * @param name the file name of the OSS DSP device * (e.g. /dev/dsp or /dev/dsp0). * @param sampleRate samples per second (e.g. 44100 for 44.1kHz). * @param bitsPerSample bits per sample (e.g. 16 bits). * @param channel number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.). * @exception Exception */ inline OssDspSource ( const char * name, int sampleRate = 44100, int bitsPerSample = 16, int channel = 2 ) throw ( Exception ) : AudioSource( sampleRate, bitsPerSample, channel) { init( name); } /** * Copy Constructor. * * @param ods the object to copy. * @exception Exception */ inline OssDspSource ( const OssDspSource & ods ) throw ( Exception ) : AudioSource( ods ) { init( ods.fileName); } /** * Destructor. * * @exception Exception */ inline virtual ~OssDspSource ( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param ds the object to assign to this one. * @return a reference to this object. * @exception Exception */ inline virtual OssDspSource & operator= ( const OssDspSource & ds ) throw ( Exception ) { if ( this != &ds ) { strip(); AudioSource::operator=( ds); init( ds.fileName); } return *this; } /** * Tell if the data from this source comes in big or little endian. * * @return true if the source is big endian, false otherwise */ virtual bool isBigEndian ( void ) const throw (); /** * Open the OssDspSource. * This does not put the OSS DSP device into recording mode. * To start getting samples, call either canRead() or read(). * * @return true if opening was successful, false otherwise * @exception Exception * * @see #canRead * @see #read */ virtual bool open ( void ) throw ( Exception ); /** * Check if the OssDspSource is open. * * @return true if the OssDspSource is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return fileDescriptor != 0; } /** * Check if the OssDspSource can be read from. * Blocks until the specified time for data to be available. * Puts the OSS DSP device into recording mode. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the OssDspSource is ready to be read from, * false otherwise. * @exception Exception */ virtual bool canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Read from the OssDspSource. * Puts the OSS DSP device into recording mode. * * @param buf the buffer to read into. * @param len the number of bytes to read into buf * @return the number of bytes read (may be less than len). * @exception Exception */ virtual unsigned int read ( void * buf, unsigned int len ) throw ( Exception ); /** * Close the OssDspSource. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* OSS_DSP_SOURCE_H */ darkice-1.0/src/aflibConverter.h0000644000175000001440000001552311371632022013601 00000000000000/* * Copyright: (C) 2000 Julius O. Smith * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Julius O. Smith jos@ccrma.stanford.edu * */ /* This code was modified by Bruce Forsberg (forsberg@tns.net) to make it into a C++ class */ #ifndef _AFLIBCONVERTER_H_ #define _AFLIBCONVERTER_H_ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifndef MAX #define MAX(x,y) ((x)>(y) ?(x):(y)) #endif #ifndef MIN #define MIN(x,y) ((x)<(y) ?(x):(y)) #endif #define MAX_HWORD (32767) #define MIN_HWORD (-32768) #define IBUFFSIZE 4096 /* Input buffer size */ /*! \class aflibConverter \brief Provides sample rate conversion. This class will perform audio resampling. With the constructor you can choose the type of resampling to be done. Simple linear interpolation can be done by setting linear_interpolation to be TRUE in the constructor. The other two flags are ignored if this is set. If linear_interpolation is FALSE then some form of filtering will be done. IF high_quality is FALSE then a small filter will be performed. If high_quality is TRUE then a large filter (higher quality) will be performed. For both the small and large filters another parameter can be specified, filter_interpolation. With filter_interpolation set then the filter coefficients used for both the small and large filtering will be interpolated as well. This class was designed to stream audio data. It also expects audio data as 16 bit values. Each time a new stream is started some initialization needs to be done. Thus the function initialize should be called to initialize everything. This initialize function will set the conversion factor as well as a multiplecation factor for volume. The volume only applies to the small and large filter. Since this filter uses a history of the audio data it is possible for it to vary in amplitude. This allows users to scale the data. This class will work on any number of channels. Once everything is specified then resample should be called as many times as is necessary to process all the data. The value inCount will be returned indicating how many inArray samples were actually used to produce the output. This value can be used to indicate where the next block of inArray data should start. The resample function is driven by the outCount value specified. The inArray should contain at least: outCount / factor + extra_samples. extra_samples depends on the type of filtering done. As a rule of thumb 50 should be adequate for any type of filter. */ class aflibData; class aflibConverter { public: // Available contructors and destructors aflibConverter ( bool high_quality, bool linear_interpolation, bool filter_interpolation); ~aflibConverter(); void initialize( double factor, /* factor = Sndout/Sndin */ int channels, /* number of sound channels */ double volume = 1.0); /* factor to multiply amplitude */ int resample( /* number of output samples returned */ int& inCount, /* number of input samples to convert */ int outCount, /* number of output samples to compute */ short inArray[], /* input array data (length inCount * nChans) */ short outArray[]);/* output array data (length outCount * nChans) */ private: aflibConverter(); aflibConverter(const aflibConverter& op); const aflibConverter& operator=(const aflibConverter& op); int err_ret(char *s); void deleteMemory(); int readData( int inCount, /* _total_ number of frames in input file */ short inArray[], /* input data */ short *outPtr[], /* array receiving chan samps */ int dataArraySize, /* size of these arrays */ int Xoff, /* read into input array starting at this index */ bool init_count); inline short WordToHword(int v, int scl) { short out; int llsb = (1<<(scl-1)); v += llsb; /* round */ v >>= scl; if (v>MAX_HWORD) { v = MAX_HWORD; } else if (v < MIN_HWORD) { v = MIN_HWORD; } out = (short) v; return out; }; int SrcLinear( short X[], short Y[], double factor, unsigned int *Time, unsigned short& Nx, unsigned short Nout); int SrcUp( short X[], short Y[], double factor, unsigned int *Time, unsigned short& Nx, unsigned short Nout, unsigned short Nwing, unsigned short LpScl, short Imp[], short ImpD[], bool Interp); int SrcUD( short X[], short Y[], double factor, unsigned int *Time, unsigned short& Nx, unsigned short Nout, unsigned short Nwing, unsigned short LpScl, short Imp[], short ImpD[], bool Interp); int FilterUp( short Imp[], short ImpD[], unsigned short Nwing, bool Interp, short *Xp, short Ph, short Inc); int FilterUD( short Imp[], short ImpD[], unsigned short Nwing, bool Interp, short *Xp, short Ph, short Inc, unsigned short dhb); int resampleFast( /* number of output samples returned */ int& inCount, /* number of input samples to convert */ int outCount, /* number of output samples to compute */ short inArray[], /* input array data (length inCount * nChans) */ short outArray[]);/* output array data (length outCount * nChans) */ int resampleWithFilter( /* number of output samples returned */ int& inCount, /* number of input samples to convert */ int outCount, /* number of output samples to compute */ short inArray[], /* input array data (length inCount * nChans) */ short outArray[], /* output array data (length outCount * nChans) */ short Imp[], short ImpD[], unsigned short LpScl, unsigned short Nmult, unsigned short Nwing); static short SMALL_FILTER_IMP[]; static short LARGE_FILTER_IMP[]; bool interpFilt; bool largeFilter; bool linearInterp; short ** _II; short ** _JJ; unsigned int _Time; double _factor; int _nChans; bool _initial; double _vol; }; #endif darkice-1.0/src/FileCast.h0000644000175000001440000001651511371632310012330 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : FileCast.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef FILE_CAST_H #define FILE_CAST_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Ref.h" #include "Sink.h" #include "CastSink.h" #include "FileSink.h" #include "FileCast.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Class representing output to a local file. * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class FileCast : public CastSink { private: /** * The file to send the encoded data to. */ Ref targetFile; /** * Initalize the object. * * @param targetFile the file to send the encoded data to. * @exception Exception */ inline void init ( FileSink * targetFile ) throw ( Exception ) { this->targetFile = targetFile; } /** * De-initalize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } } protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline FileCast ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Log in to the server using the socket avialable. * No need to log in to a file. * * @return true if login was successful, false otherwise. * @exception Exception */ inline virtual bool sendLogin ( void ) throw ( Exception ) { return true; } public: /** * Constructor. * * @param targetFile the file to send all the data to. * @exception Exception */ inline FileCast ( FileSink * targetFile ) throw ( Exception ) : CastSink( 0, 0, 0) { init( targetFile ); } /** * Copy constructor. * * @param cs the FileCast to copy. */ inline FileCast( const FileCast & cs ) throw ( Exception ) { init( targetFile.get() ); } /** * Destructor. * * @exception Exception */ inline virtual ~FileCast( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param cs the FileCast to assign this to. * @return a reference to this FileCast. * @exception Exception */ inline virtual FileCast & operator= ( const FileCast & cs ) throw ( Exception ) { if ( this != &cs ) { strip(); init( targetFile.get() ); } return *this; } /** * Open the FileCast. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the FileCast is open. * * @return true if the FileCast is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return targetFile->isOpen(); } /** * Check if the FileCast is ready to accept data. * Blocks until the specified time for data to be available. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the FileCast is ready to accept data, * false otherwise. * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { return targetFile->canWrite( sec, usec); } /** * Write data to the FileCast. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ inline virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ) { return targetFile->write( buf, len); } /** * Flush all data that was written to the FileCast to the server. * * @exception Exception */ inline virtual void flush ( void ) throw ( Exception ) { return targetFile->flush(); } /** * Cut what the sink has been doing so far, and start anew. * This usually means separating the data sent to the sink up * until now, and start saving a new chunk of data. */ inline virtual void cut ( void ) throw () { targetFile->cut(); } /** * Close the FileCast. * * @exception Exception */ inline virtual void close ( void ) throw ( Exception ) { return targetFile->close(); } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* FILE_CAST_H */ darkice-1.0/src/JackDspSource.cpp0000644000175000001440000003461511371632310013672 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Copyright (c) 2005 Nicholas Humfrey. All rights reserved. Tyrell DarkIce File : JackDspSource.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include "AudioSource.h" #ifdef SUPPORT_JACK_DSP // only compile this code if there is support for it #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_SYS_TYPES_H #include #else #error need sys/types.h #endif #ifdef HAVE_MATH_H #include #else #error need math.h #endif #ifdef HAVE_STDLIB_H #include #else #error needs stdlib.h #endif #ifdef HAVE_LIMITS_H #include #else #error need limits.h #endif #include "Util.h" #include "Exception.h" #include "JackDspSource.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: JackDspSource.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void JackDspSource :: init ( const char* name ) throw ( Exception ) { // Set defaults ports[0] = NULL; // Left Port ports[1] = NULL; // Right Port rb[0] = NULL; // Left Ring Buffer rb[1] = NULL; // Right Ring Buffer client = NULL; auto_connect = false; // Default is to not auto connect the JACK ports tmp_buffer = NULL; // Buffer big enough for one 'read' of audio // Auto connect the ports ? if ( Util::strEq( name, "jack_auto", 9) ) { auto_connect = true; } // Check the sample size if (getBitsPerSample() != 16) { throw Exception( __FILE__, __LINE__, "JackDspSource doesn't support non 16-bit samples"); } } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void JackDspSource :: strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } // Free the temporary buffer if (tmp_buffer) { free(tmp_buffer); tmp_buffer = NULL; } } /*------------------------------------------------------------------------------ * Attempt to connect up the JACK ports automatically * - Just connect left&right to the first two output ports we find *----------------------------------------------------------------------------*/ void JackDspSource :: do_auto_connect ( void ) throw ( Exception ) { const char **all_ports; unsigned int ch = 0; int i; Reporter::reportEvent( 10, "JackDspSource :: do_auto_connect"); // Get a list of all the jack ports all_ports = jack_get_ports (client, NULL, NULL, JackPortIsOutput); if (!ports) { throw Exception( __FILE__, __LINE__, "jack_get_ports() returned NULL."); } // Step through each port name for (i = 0; all_ports[i]; ++i) { const char* in = all_ports[i]; const char* out = jack_port_name( ports[ch] ); Reporter::reportEvent( 2, "Connecting", in, "to", out); if (jack_connect(client, in, out)) { throw Exception( __FILE__, __LINE__, "Failed to jack_connect() ports", in, out); } // Found enough ports ? if (++ch >= getChannel()) break; } free( all_ports ); } /*------------------------------------------------------------------------------ * Open the audio source *----------------------------------------------------------------------------*/ bool JackDspSource :: open ( void ) throw ( Exception ) { char client_name[255]; size_t rb_size; unsigned int c; if ( isOpen() ) { return false; } // Register client with Jack if ( jack_client_name != NULL ) { snprintf(client_name, 255, "%s", jack_client_name); } else { snprintf(client_name, 255, "darkice-%d", getpid()); } if ((client = jack_client_new(client_name)) == NULL) { throw Exception( __FILE__, __LINE__, "JACK server not running?"); } Reporter::reportEvent( 1, "Registering as JACK client", client_name); // Check the sample rate is correct if (jack_get_sample_rate( client ) != (jack_nframes_t)getSampleRate()) { throw Exception( __FILE__, __LINE__, "JACK server sample rate is different than " "sample rate in darkice config file"); } // Register ports with Jack if (getChannel() == 1) { if (!(ports[0] = jack_port_register(client, "mono", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0))) { throw Exception( __FILE__, __LINE__, "Cannot register input port", "mono"); } } else if (getChannel() == 2) { if (!(ports[0] = jack_port_register(client, "left", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0))) { throw Exception( __FILE__, __LINE__, "Cannot register input port", "left"); } if (!(ports[1] = jack_port_register(client, "right", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0))) { throw Exception( __FILE__, __LINE__, "Cannot register input port", "right"); } } else { throw Exception( __FILE__, __LINE__, "Invalid number of channels", getChannel()); } // Create a ring buffer for each channel rb_size = 2 * jack_get_sample_rate(client) * sizeof (jack_default_audio_sample_t); for (c=0; c cur_wait) { bool canRead = true; for (unsigned int c = 0 ; c < getChannel() ; c++) { if (jack_ringbuffer_read_space(rb[c]) <= 0) { canRead = false; } } if (canRead) { return true; } cur_wait += wait_increment; usleep ( wait_increment ); } usleep( usec ); for (unsigned int c = 0 ; c < getChannel() ; c++) { if (jack_ringbuffer_read_space(rb[c]) <= 0) { return false; } } return true; } /*------------------------------------------------------------------------------ * Read from the audio source *----------------------------------------------------------------------------*/ unsigned int JackDspSource :: read ( void * buf, unsigned int len ) throw ( Exception ) { jack_nframes_t samples = len / 2 / getChannel(); jack_nframes_t samples_read[2] = {0,0}; short * output = (short*)buf; unsigned int c, n; if ( !isOpen() ) { return 0; } // Ensure the temporary buffer is big enough tmp_buffer = (jack_default_audio_sample_t*)realloc(tmp_buffer, samples * sizeof( jack_default_audio_sample_t ) ); if (!tmp_buffer) { throw Exception( __FILE__, __LINE__, "realloc on tmp_buffer failed"); } // We must be sure to fetch as many data on both channels int minBytesAvailable = samples * sizeof( jack_default_audio_sample_t ); for (c=0; c SHRT_MAX) { output[n*getChannel()+c] = SHRT_MAX; } else if (tmp < SHRT_MIN) { output[n*getChannel()+c] = SHRT_MIN; } else { output[n*getChannel()+c] = (short) tmp; } } } // Didn't get as many samples as we wanted ? if (getChannel() == 2 && samples_read[0] != samples_read[1]) { Reporter::reportEvent( 2, "Warning: Read a different number of samples " "for left and right channels"); } // Return the number of bytes put in the output buffer return samples_read[0] * 2 * getChannel(); } /*------------------------------------------------------------------------------ * Close the audio source *----------------------------------------------------------------------------*/ void JackDspSource :: close ( void ) throw ( Exception ) { unsigned int i; if ( !isOpen() ) { return; } for(i = 0; i < getChannel(); i++) { // Close the port for channel if ( ports[i] ) { jack_port_unregister( client, ports[i] ); ports[i] = NULL; } // Free up the ring buffer for channel if ( rb[i] ) { jack_ringbuffer_free( rb[i] ); rb[i] = NULL; } } /* Leave the jack graph */ if (client) { jack_client_close(client); client = NULL; } } /*------------------------------------------------------------------------------ * Callback called by JACK when audio is available * * Don't do anything too expensive here * - just shove audio samples in ring buffer *----------------------------------------------------------------------------*/ int JackDspSource :: process_callback( jack_nframes_t nframes, void *arg ) { JackDspSource* self = (JackDspSource*)arg; size_t to_write = sizeof (jack_default_audio_sample_t) * nframes; unsigned int c; // Wait until it is ready if (self->client == NULL) { return 0; } /* copy data to ringbuffer; one per channel */ for (c=0; c < self->getChannel(); c++) { char *buf = (char*)jack_port_get_buffer(self->ports[c], nframes); size_t len = jack_ringbuffer_write(self->rb[c], buf, to_write); if (len < to_write) { Reporter::reportEvent( 1, "failed to write to ring ruffer"); return 1; } } // Success return 0; } /*------------------------------------------------------------------------------ * Callback called when *----------------------------------------------------------------------------*/ void JackDspSource :: shutdown_callback( void *arg ) { //JackDspSource* self = (JackDspSource*)arg; Reporter::reportEvent( 1, "JackDspSource :: shutdown_callback"); } #endif // SUPPORT_JACK_DSP darkice-1.0/src/AlsaDspSource.cpp0000644000175000001440000002072411371632310013676 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Copyright (c) 2004 LS Informationstechnik (LIKE) University of Erlangen Nuremberg All rights reserved. Tyrell DarkIce File : AlsaDspSource.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include "AudioSource.h" // compile only if configured for ALSA #ifdef SUPPORT_ALSA_DSP #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Util.h" #include "Exception.h" #include "AlsaDspSource.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: AlsaDspSource.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Tell if source id big endian *----------------------------------------------------------------------------*/ bool AlsaDspSource :: isBigEndian ( void ) const throw () { return SND_PCM_FORMAT_S16 == SND_PCM_FORMAT_S16_BE; } /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void AlsaDspSource :: init ( const char * name ) throw ( Exception ) { pcmName = Util::strDup( name); captureHandle = 0; bufferTime = 1000000; // Do 1s buffering running = false; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void AlsaDspSource :: strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } delete[] pcmName; } /*------------------------------------------------------------------------------ * Open the audio source *----------------------------------------------------------------------------*/ bool AlsaDspSource :: open ( void ) throw ( Exception ) { unsigned int u; snd_pcm_format_t format; snd_pcm_hw_params_t *hwParams; if ( isOpen() ) { return false; } switch ( getBitsPerSample() ) { case 8: format = SND_PCM_FORMAT_S8; break; case 16: format = SND_PCM_FORMAT_S16; break; default: return false; } if (snd_pcm_open(&captureHandle, pcmName, SND_PCM_STREAM_CAPTURE, 0) < 0) { captureHandle = 0; return false; } if (snd_pcm_hw_params_malloc(&hwParams) < 0) { close(); throw Exception( __FILE__, __LINE__, "can't alloc hardware "\ "parameter structure"); } if (snd_pcm_hw_params_any(captureHandle, hwParams) < 0) { snd_pcm_hw_params_free(hwParams); close(); throw Exception( __FILE__, __LINE__, "can't initialize hardware "\ "parameter structure"); } if (snd_pcm_hw_params_set_access(captureHandle, hwParams, SND_PCM_ACCESS_RW_INTERLEAVED) < 0) { snd_pcm_hw_params_free(hwParams); close(); throw Exception( __FILE__, __LINE__, "can't set access type"); } if (snd_pcm_hw_params_set_format(captureHandle, hwParams, format) < 0) { snd_pcm_hw_params_free(hwParams); close(); throw Exception( __FILE__, __LINE__, "can't set sample format"); } u = getSampleRate(); if (snd_pcm_hw_params_set_rate_near(captureHandle, hwParams, &u, 0) < 0) { snd_pcm_hw_params_free(hwParams); close(); throw Exception( __FILE__, __LINE__, "can't set sample rate", u); } u = getChannel(); if (snd_pcm_hw_params_set_channels(captureHandle, hwParams, u) < 0) { snd_pcm_hw_params_free(hwParams); close(); throw Exception( __FILE__, __LINE__, "can't set channels", u); } u = 4; if (snd_pcm_hw_params_set_periods_near(captureHandle, hwParams, &u, 0) < 0) { snd_pcm_hw_params_free(hwParams); close(); throw Exception( __FILE__, __LINE__, "can't set interrupt frequency"); } u = getBufferTime(); if (snd_pcm_hw_params_set_buffer_time_near(captureHandle, hwParams, &u, 0) < 0) { snd_pcm_hw_params_free(hwParams); close(); throw Exception( __FILE__, __LINE__, "can't set buffer size"); } if (snd_pcm_hw_params(captureHandle, hwParams) < 0) { snd_pcm_hw_params_free(hwParams); close(); throw Exception( __FILE__, __LINE__, "can't set hardware parameters"); } snd_pcm_hw_params_free(hwParams); if (snd_pcm_prepare(captureHandle) < 0) { close(); throw Exception( __FILE__, __LINE__, "can't prepare audio interface "\ "for use"); } bytesPerFrame = getChannel() * getBitsPerSample() / 8; return true; } /*------------------------------------------------------------------------------ * Check wether read() would return anything *----------------------------------------------------------------------------*/ bool AlsaDspSource :: canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ) { if ( !isOpen() ) { return false; } if ( !running ) { snd_pcm_start(captureHandle); running = true; } /* * FIXME How to check for available frames? It * seems like snd_pcm_wait stops working when * it comes to ALSA plugins... :-( * * int milliDelay = sec * 1000 + usec/1000; * return snd_pcm_wait(captureHandle, milliDelay)!=0; */ return true; // bad!! } /*------------------------------------------------------------------------------ * Read from the audio source *----------------------------------------------------------------------------*/ unsigned int AlsaDspSource :: read ( void * buf, unsigned int len ) throw ( Exception ) { snd_pcm_sframes_t ret; if ( !isOpen() ) { return 0; } do { ret = snd_pcm_readi(captureHandle, buf, len/bytesPerFrame); // Check for buffer overrun if (ret == -EPIPE) { reportEvent(1, "Buffer overrun!"); snd_pcm_prepare(captureHandle); ret = -EAGAIN; } } while (ret == -EAGAIN); if ( ret < 0 ) { throw Exception(__FILE__, __LINE__, snd_strerror(ret)); } running = true; return ret * bytesPerFrame; } /*------------------------------------------------------------------------------ * Close the audio source *----------------------------------------------------------------------------*/ void AlsaDspSource :: close ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } snd_pcm_close(captureHandle); captureHandle = 0; running = false; } #endif // HAVE_ALSA_LIB darkice-1.0/src/IceCast2.cpp0000644000175000001440000001676211371632310012572 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : IceCast2.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDIO_H #include #else #error need stdio.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_MATH_H #include #else #error need math.h #endif #include "Exception.h" #include "Source.h" #include "Sink.h" #include "Util.h" #include "IceCast2.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: IceCast2.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Size of string conversion buffer *----------------------------------------------------------------------------*/ #define STRBUF_SIZE 32 /*------------------------------------------------------------------------------ * Expected positive response from server begins like this. *----------------------------------------------------------------------------*/ static const char responseOK[] = "HTTP/1.0 200"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void IceCast2 :: init ( StreamFormat format, const char * mountPoint, const char * description ) throw ( Exception ) { this->format = format; this->mountPoint = Util::strDup( mountPoint); this->description = description ? Util::strDup( description) : 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void IceCast2 :: strip ( void ) throw ( Exception ) { delete[] mountPoint; if ( description ) { delete[] description; } } /*------------------------------------------------------------------------------ * Log in to the IceCast2 server *----------------------------------------------------------------------------*/ bool IceCast2 :: sendLogin ( void ) throw ( Exception ) { Sink * sink = getSink(); Source * source = getSocket(); const char * str; char resp[STRBUF_SIZE]; unsigned int len; unsigned int lenExpected; if ( !source->isOpen() ) { return false; } if ( !sink->isOpen() ) { return false; } // send the request, a string like: // "SOURCE ICE/1.0" str = "SOURCE /"; sink->write( str, strlen( str)); str = getMountPoint(); sink->write( str, strlen( str)); str = " HTTP/1.0"; sink->write( str, strlen( str)); // send the content type, Ogg Vorbis str = "\nContent-type: "; sink->write( str, strlen( str)); switch ( format ) { case mp3: case mp2: str = "audio/mpeg"; break; case oggVorbis: str = "application/ogg"; break; case aac: str = "audio/aac"; break; case aacp: str = "audio/aacp"; break; default: throw Exception( __FILE__, __LINE__, "unsupported stream format", format); break; } sink->write( str, strlen( str)); // send the authentication info str = "\nAuthorization: Basic "; sink->write( str, strlen(str)); { // send source: encoded as base64 char * source = "source:"; const char * pwd = getPassword(); char * tmp = new char[Util::strLen(source) + Util::strLen(pwd) + 1]; Util::strCpy( tmp, source); Util::strCat( tmp, pwd); char * base64 = Util::base64Encode( tmp); delete[] tmp; sink->write( base64, strlen(base64)); delete[] base64; } // send user agent info str = "\nUser-Agent: DarkIce/" VERSION " (http://code.google.com/p/darkice/)"; sink->write( str, strlen( str)); // send the ice- headers str = "\nice-bitrate: "; sink->write( str, strlen( str)); if ( log10(getBitRate()) >= (STRBUF_SIZE-2) ) { throw Exception( __FILE__, __LINE__, "bitrate does not fit string buffer", getBitRate()); } sprintf( resp, "%d", getBitRate()); sink->write( resp, strlen( resp)); str = "\nice-public: "; sink->write( str, strlen( str)); str = getIsPublic() ? "1" : "0"; sink->write( str, strlen( str)); if ( getName() ) { str = "\nice-name: "; sink->write( str, strlen( str)); str = getName(); sink->write( str, strlen( str)); } if ( getDescription() ) { str = "\nice-description: "; sink->write( str, strlen( str)); str = getDescription(); sink->write( str, strlen( str)); } if ( getUrl() ) { str = "\nice-url: "; sink->write( str, strlen( str)); str = getUrl(); sink->write( str, strlen( str)); } if ( getGenre() ) { str = "\nice-genre: "; sink->write( str, strlen( str)); str = getGenre(); sink->write( str, strlen( str)); } str = "\n\n"; sink->write( str, strlen( str)); sink->flush(); // read the response, expected response begins with responseOK lenExpected = Util::strLen( responseOK); if ( (len = source->read( resp, STRBUF_SIZE-1)) < lenExpected ) { return false; } resp[lenExpected] = 0; if ( !Util::strEq( resp, responseOK) ) { return false; } // suck anything that the other side has to say while ( source->canRead( 0, 0) && (len = source->read( resp, STRBUF_SIZE-1)) ); return true; } darkice-1.0/src/aacPlusEncoder.cpp0000644000175000001440000003102211371632310014047 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2005 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : aacPlusEncoder.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif // compile the whole file only if aacplus support configured in #ifdef HAVE_AACPLUS_LIB #include "Exception.h" #include "Util.h" #include "aacPlusEncoder.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: aacPlusEncoder.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Open an encoding session *----------------------------------------------------------------------------*/ bool aacPlusEncoder :: open ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } // open the underlying sink if ( !sink->open() ) { throw Exception( __FILE__, __LINE__, "aacplus lib opening underlying sink error"); } reportEvent(1, "Using aacplus codec version", "720 3gpp"); bitrate = getOutBitrate() * 1000; bandwidth = 0; useParametricStereo = 0; numAncDataBytes=0; coreWriteOffset = 0; envReadOffset = 0; writeOffset = INPUT_DELAY*MAX_CHANNELS; writtenSamples = 0; aacEnc = NULL; hEnvEnc=NULL; /* set up basic parameters for aacPlus codec */ AacInitDefaultConfig(&config); nChannelsAAC = nChannelsSBR = getOutChannel(); if ( (getInChannel() == 2) && (bitrate >= 16000) && (bitrate < 44001) ) { useParametricStereo = 1; nChannelsAAC = 1; nChannelsSBR = 2; reportEvent(10, "use Parametric Stereo"); envReadOffset = (MAX_DS_FILTER_DELAY + INPUT_DELAY)*MAX_CHANNELS; coreWriteOffset = CORE_INPUT_OFFSET_PS; writeOffset = envReadOffset; } else { /* set up 2:1 downsampling */ InitIIR21_Resampler(&(IIR21_reSampler[0])); InitIIR21_Resampler(&(IIR21_reSampler[1])); if(IIR21_reSampler[0].delay > MAX_DS_FILTER_DELAY) throw Exception(__FILE__, __LINE__, "IIR21 resampler delay is bigger then MAX_DS_FILTER_DELAY"); writeOffset += IIR21_reSampler[0].delay*MAX_CHANNELS; } sampleRateAAC = getOutSampleRate(); config.bitRate = bitrate; config.nChannelsIn=getInChannel(); config.nChannelsOut=nChannelsAAC; config.bandWidth=bandwidth; /* set up SBR configuration */ if(!IsSbrSettingAvail(bitrate, nChannelsAAC, sampleRateAAC, &sampleRateAAC)) throw Exception(__FILE__, __LINE__, "No valid SBR configuration found"); InitializeSbrDefaults (&sbrConfig); sbrConfig.usePs = useParametricStereo; AdjustSbrSettings( &sbrConfig, bitrate, nChannelsAAC, sampleRateAAC, AACENC_TRANS_FAC, 24000); EnvOpen( &hEnvEnc, inBuf + coreWriteOffset, &sbrConfig, &config.bandWidth); /* set up AAC encoder, now that samling rate is known */ config.sampleRate = sampleRateAAC; if (AacEncOpen(&aacEnc, config) != 0){ AacEncClose(aacEnc); throw Exception(__FILE__, __LINE__, "Initialisation of AAC failed !"); } init_plans(); /* create the ADTS header */ adts_hdr(outBuf, &config); inSamples = AACENC_BLOCKSIZE * getInChannel() * 2; // initialize the resampling coverter if needed if ( converter ) { #ifdef HAVE_SRC_LIB converterData.input_frames = 4096/((getInBitsPerSample() / 8) * getInChannel()); converterData.data_in = new float[converterData.input_frames*getInChannel()]; converterData.output_frames = (int) (converterData.input_frames * resampleRatio + 1); if ((int) inSamples > getInChannel() * converterData.output_frames) { resampledOffset = new float[2 * inSamples]; } else { resampledOffset = new float[2 * getInChannel() * converterData.input_frames]; } converterData.src_ratio = resampleRatio; converterData.end_of_input = 0; #else converter->initialize( resampleRatio, getInChannel()); //needed 2x(converted input samples) to handle offsets int outCount = 2 * getInChannel() * (inSamples + 1); if (resampleRatio > 1) outCount = (int) (outCount * resampleRatio); resampledOffset = new short int[outCount]; #endif resampledOffsetSize = 0; } aacplusOpen = true; reportEvent(10, "bitrate=", bitrate); reportEvent(10, "nChannelsIn", getInChannel()); reportEvent(10, "nChannelsOut", getOutChannel()); reportEvent(10, "nChannelsSBR", nChannelsSBR); reportEvent(10, "nChannelsAAC", nChannelsAAC); reportEvent(10, "sampleRateAAC", sampleRateAAC); reportEvent(10, "inSamples", inSamples); return true; } /*------------------------------------------------------------------------------ * Write data to the encoder *----------------------------------------------------------------------------*/ unsigned int aacPlusEncoder :: write ( const void * buf, unsigned int len ) throw ( Exception ) { if ( !isOpen() || len == 0) { return 0; } unsigned int channels = getInChannel(); unsigned int bitsPerSample = getInBitsPerSample(); unsigned int sampleSize = (bitsPerSample / 8) * channels; unsigned int processed = len - (len % sampleSize); unsigned int nSamples = processed / sampleSize; unsigned int samples = (unsigned int) nSamples * channels; int processedSamples = 0; if ( converter ) { unsigned int converted; #ifdef HAVE_SRC_LIB src_short_to_float_array ((short *) buf, converterData.data_in, samples); converterData.input_frames = nSamples; converterData.data_out = resampledOffset + (resampledOffsetSize * channels); int srcError = src_process (converter, &converterData); if (srcError) throw Exception (__FILE__, __LINE__, "libsamplerate error: ", src_strerror (srcError)); converted = converterData.output_frames_gen; #else int inCount = nSamples; short int * shortBuffer = new short int[samples]; int outCount = (int) (inCount * resampleRatio); unsigned char * b = (unsigned char*) buf; Util::conv( bitsPerSample, b, processed, shortBuffer, isInBigEndian()); converted = converter->resample( inCount, outCount+1, shortBuffer, &resampledOffset[resampledOffsetSize*channels]); delete[] shortBuffer; #endif resampledOffsetSize += converted; // encode samples (if enough) while(resampledOffsetSize - processedSamples >= inSamples/channels) { #ifdef HAVE_SRC_LIB short *shortData = new short[inSamples]; src_float_to_short_array(resampledOffset + (processedSamples * channels), shortData, inSamples) ; encodeAacSamples (shortData, inSamples, channels); delete [] shortData; #else encodeAacSamples (&resampledOffset[processedSamples*channels], inSamples, channels); #endif processedSamples+=inSamples/channels; } if (processedSamples && (int) resampledOffsetSize >= processedSamples) { resampledOffsetSize -= processedSamples; //move least part of resampled data to beginning if(resampledOffsetSize) #ifdef HAVE_SRC_LIB resampledOffset = (float *) memmove(resampledOffset, &resampledOffset[processedSamples*channels], resampledOffsetSize*channels*sizeof(float)); #else resampledOffset = (short *) memmove(resampledOffset, &resampledOffset[processedSamples*channels], resampledOffsetSize*sampleSize); #endif } } else { encodeAacSamples ((short *) buf, samples, channels); } return samples; } void aacPlusEncoder :: encodeAacSamples (short *TimeDataPcm, unsigned int samples, int channels) throw ( Exception ) { unsigned int i; int ch, outSamples, numOutBytes; for (i=0; iwrite(outBuf, numOutBytes+ADTS_HEADER_SIZE); } writtenSamples=0; return; } /*------------------------------------------------------------------------------ * Flush the data from the encoder *----------------------------------------------------------------------------*/ void aacPlusEncoder :: flush ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } sink->flush(); } /*------------------------------------------------------------------------------ * Close the encoding session *----------------------------------------------------------------------------*/ void aacPlusEncoder :: close ( void ) throw ( Exception ) { if ( isOpen() ) { flush(); destroy_plans(); AacEncClose(aacEnc); if (hEnvEnc) { EnvClose(hEnvEnc); } aacplusOpen = false; sink->close(); } } #endif // HAVE_AACPLUS_LIB darkice-1.0/src/ConfigSection.cpp0000644000175000001440000001276211371632310013723 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell ConfigSection File : ConfigSection.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "ConfigSection.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: ConfigSection.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * string containing all white space characters *----------------------------------------------------------------------------*/ #define WHITE_SPACE_STR " \t" /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Add a key / value pair *----------------------------------------------------------------------------*/ bool ConfigSection :: add ( const char * key, const char * value ) throw ( Exception ) { if ( !key || !value ) { throw Exception( __FILE__, __LINE__, "no key or value"); } std::pair element( key, value); std::pair res; res = table.insert( element); return res.second; } /*------------------------------------------------------------------------------ * Get a value for a key *----------------------------------------------------------------------------*/ const char * ConfigSection :: get ( const char * key ) const throw ( Exception ) { if ( !key ) { throw Exception( __FILE__, __LINE__, "no key"); } TableType::const_iterator it = table.find( key); if ( it == table.end() ) { return 0; } return it->second.c_str(); } /*------------------------------------------------------------------------------ * Get a value for a key, in the key does not exist, throw an exception *----------------------------------------------------------------------------*/ const char * ConfigSection :: getForSure ( const char * key, const char * message1, const char * message2, int code ) const throw ( Exception ) { const char * value; if ( !(value = get( key)) ) { throw Exception( __FILE__, __LINE__, key, message1, message2, code); } return value; } /*------------------------------------------------------------------------------ * Add a configuration line *----------------------------------------------------------------------------*/ bool ConfigSection :: addLine ( const char * line ) throw ( Exception ) { if ( !line ) { throw Exception( __FILE__, __LINE__, "no line"); } std::string::size_type ix; std::string str( line); /* delete everything after the first # */ if ( (ix = str.find( '#')) != str.npos ) { str.erase( ix); } /* eat up all white space from the front */ if ( (ix = str.find_first_not_of( WHITE_SPACE_STR)) != str.npos ) { str.erase( 0, ix); } /* eat up all white space from the end */ if ( (ix = str.find_last_not_of( WHITE_SPACE_STR)) != str.npos ) { str.erase( ix + 1); } if ( !str.length() ) { return true; } /* find the '=' delimiter between key and value */ if ( (ix = str.find( '=')) == str.npos ) { return false; } std::string key( str, 0, ix); std::string value( str, ix + 1); /* eat up all white space from the front of value */ if ( (ix = value.find_first_not_of( WHITE_SPACE_STR)) != value.npos ) { value.erase( 0, ix); } /* eat up all white space from the end of key */ if ( (ix = key.find_last_not_of( WHITE_SPACE_STR)) != key.npos ) { key.erase( ix + 1); } /* now add the new key / value pair */ return add( key.c_str(), value.c_str()); } darkice-1.0/src/SolarisDspSource.h0000644000175000001440000001676711371632310014113 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : SolarisDspSource.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef SOLARIS_DSP_SOURCE_H #define SOLARIS_DSP_SOURCE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Reporter.h" #include "AudioSource.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * An audio input based on Solaris /dev/audio devices * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class SolarisDspSource : public AudioSource, public virtual Reporter { private: /** * The file name of the OSS DSP device (e.g. /dev/audio) */ char * fileName; /** * The low-level file descriptor of the Solaris DSP device. */ int fileDescriptor; protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline SolarisDspSource ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Initialize the object * * @param name the file name of the Solaris DSP device. * @exception Exception */ void init ( const char * name ) throw ( Exception ); /** * De-iitialize the object * * @exception Exception */ void strip ( void ) throw ( Exception ); public: /** * Constructor. * * @param name the file name of the Solaris DSP device * (e.g. /dev/audio or /dev/sound/0) * @param sampleRate samples per second (e.g. 44100 for 44.1kHz). * @param bitsPerSample bits per sample (e.g. 16 bits). * @param channel number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.). * @exception Exception */ inline SolarisDspSource ( const char * name, int sampleRate = 44100, int bitsPerSample = 16, int channel = 2 ) throw ( Exception ) : AudioSource( sampleRate, bitsPerSample, channel) { init( name); } /** * Copy Constructor. * * @param sds the object to copy. * @exception Exception */ inline SolarisDspSource ( const SolarisDspSource & sds ) throw ( Exception ) : AudioSource( sds ) { init( sds.fileName); } /** * Destructor. * * @exception Exception */ inline virtual ~SolarisDspSource ( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param ds the object to assign to this one. * @return a reference to this object. * @exception Exception */ inline virtual SolarisDspSource & operator= ( const SolarisDspSource & ds ) throw ( Exception ) { if ( this != &ds ) { strip(); AudioSource::operator=( ds); init( ds.fileName); } return *this; } /** * Tell if the data from this source comes in big or little endian. * * @return true */ virtual inline bool isBigEndian ( void ) const throw () { #ifdef WORDS_BIGENDIAN return true; #else return false; #endif } /** * Open the SolarisDspSource. * This does not put the Solaris DSP device into recording mode. * To start getting samples, call either canRead() or read(). * * @return true if opening was successful, false otherwise * @exception Exception * * @see #canRead * @see #read */ virtual bool open ( void ) throw ( Exception ); /** * Check if the SolarisDspSource is open. * * @return true if the SolarisDspSource is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return fileDescriptor != 0; } /** * Check if the SolarisDspSource can be read from. * Blocks until the specified time for data to be available. * Puts the Solaris DSP device into recording mode. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the SolarisDspSource is ready to be read from, * false otherwise. * @exception Exception */ virtual bool canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Read from the SolarisDspSource. * Puts the Solaris DSP device into recording mode. * * @param buf the buffer to read into. * @param len the number of bytes to read into buf * @return the number of bytes read (may be less than len). * @exception Exception */ virtual unsigned int read ( void * buf, unsigned int len ) throw ( Exception ); /** * Close the SolarisDspSource. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* SOLARIS_DSP_SOURCE_H */ darkice-1.0/src/DarkIceConfig.h0000644000175000001440000001265111371632310013263 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell Config File : DarkIceConfig.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef CONFIG_H #define CONFIG_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include #include #include #include "Referable.h" #include "ConfigSection.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A configuration file representation. The file is of the syntax: * *
 *  [section1]
 *  # this is a whole line comment
 *  key = value
 *  an ugly key name = long value    # this end is a comment too
 *
 *  [section2]
 *  # this is a whole line comment in section 2
 *  key = value
 *  an ugly key name = long value    # this end is a comment too
 *  
* * also empty lines are ignored and all white space is removed * from the front and end of keys / values * * Knwon problem: you can't use '#' in any part of a key / value pair * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class Config : public virtual Referable { private: /** * Type declaration of the hash table type. */ typedef std::map TableType; /** * Hash table holding the configuration sections. * * @see ConfigSection */ TableType table; /** * Hash table holding the configuration sections. * * @see ConfigSection */ std::string currentSection; protected: public: /** * Default constructor. * * @exception Exception */ inline Config ( void ) throw ( Exception ) { } /** * Constructor based on an input stream. * * @param is configuration will be read from this input stream * until end of stream is reached. * @exception Exception */ inline Config ( std::istream & is ) throw ( Exception ) { read( is ); } /** * Destructor. * * @exception Exception */ inline virtual ~Config ( void ) throw ( Exception ) { } /* TODO inline Config ( const Config & di ) throw ( Exception ) { } inline Config & operator= ( const Config * di ) throw ( Exception ) { } */ /** * Delete the configuration information stored in the object. * Resets the object to a clean state. * * @exception Exception */ inline virtual void reset ( void ) throw ( Exception ) { table.clear(); currentSection = ""; } /** * Read a line of confiugration information. * * @param line the line to read. * @return true if the line was correct, false otherwise. * @exception Exception */ virtual bool addLine ( const char * line ) throw ( Exception ); /** * Read a line of confiugration information. * * @param is the input stream to read from * @return true if the line was correct, false otherwise. * @exception Exception */ virtual void read ( std::istream & is ) throw ( Exception ); /** * Get a ConfigSection by name. * * @param key the name of the ConfigSection * @return the ConfigSection requested, or NULL if it doesn't exists. * @exception Exception */ virtual const ConfigSection * get ( const char * key ) const throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* CONFIG_H */ darkice-1.0/src/Source.h0000644000175000001440000001114211371632310012065 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Source.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef SOURCE_H #define SOURCE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Referable.h" #include "Exception.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A general data source * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class Source : public virtual Referable { private: protected: /** * Default Constructor. * * @exception Exception */ inline Source ( void ) throw ( Exception ) { } /** * Copy Constructor. * * @param source the object to copy. * @exception Exception */ inline Source ( const Source & source ) throw ( Exception ) { } /** * Assignment operator. * * @param source the object to assign to this one. * @return a reference to this object. * @exception Exception */ inline virtual Source & operator= ( const Source & source ) throw ( Exception ) { return *this; } public: /** * Destructor. * * @exception Exception */ inline virtual ~Source ( void ) throw ( Exception ) { } /** * Open the Source. * * @return true if opening was successful, false otherwise * @exception Exception */ virtual bool open ( void ) throw ( Exception ) = 0; /** * Check if the Source is open. * * @return true if the Source is open, false otherwise. */ virtual bool isOpen ( void ) const throw () = 0; /** * Check if the Source can be read from. * Blocks until the specified time for data to be available. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the Source is ready to be read from, * false otherwise. * @exception Exception */ virtual bool canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ) = 0; /** * Read from the Source. * * @param buf the buffer to read into. * @param len the number of bytes to read into buf * @return the number of bytes read (may be less than len). * @exception Exception */ virtual unsigned int read ( void * buf, unsigned int len ) throw ( Exception ) = 0; /** * Close the Source. * * @exception Exception */ virtual void close ( void ) throw ( Exception ) = 0; }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* SOURCE_H */ darkice-1.0/src/aflibDebug.cc0000644000175000001440000001305411371632022013013 00000000000000 /* Copyright (C) 2000 Stefan Westerfeld stefan@space.twc.de This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "aflibDebug.h" #include #include #include #include static int aflib_debug_level = ::aflibDebug::lInfo; static bool aflib_debug_abort = false; static const char *aflib_debug_prefix = ""; static char *messageAppName = 0; /* static char* status_strs[] = { "Success", "Error Open", "Unsupported", "AFLIB_ERROR_INITIALIZATION_FAILURE", "AFLIB_NOT_FOUND", "AFLIB_END_OF_FILE", "AFLIB_NO_DATA", 0 }; static char* data_size_strs[] = { "UNDEFINED", "8 bit signed", "8 bit unsigned", "16 bit signed", "16 bit unsigned", "32 bit signed", "32 bit unsigned", 0 }; static char* data_endian_strs[] = { "UNDEFINED", "ENDIAN_LITTLE", "ENDIAN_BIG", 0 }; */ /* * Call the graphical application to display a message, if * defined. Otherwise, send to standard error. Debug messages are * always sent to standard error because they tend to be very verbose. * Note that the external application is run in the background to * avoid blocking the sound server. */ void output_message(::aflibDebug::Level level, const char *msg) { char buff[1024]; /* default to text output if no message app is defined or if it is a debug message. */ if (messageAppName == 0 || !strcmp(messageAppName, "") || (level == ::aflibDebug::lDebug)) { fprintf(stderr, "%s\n", msg); return; } switch (level) { case ::aflibDebug::lFatal: sprintf(buff, "%s -e \"aflib fatal error:\n\n%s\" &", messageAppName, msg); break; case ::aflibDebug::lWarning: sprintf(buff, "%s -w \"aflib warning message:\n\n%s\" &", messageAppName, msg); break; case ::aflibDebug::lInfo: sprintf(buff, "%s -i \"aflib informational message:\n\n%s\" &", messageAppName, msg); break; default: break; // avoid compile warning } system(buff); } /* * Display a message using output_message. If the message is the same * as the previous one, just increment a count but don't display * it. This prevents flooding the user with duplicate warnings. If the * message is not the same as the previous one, then we report the * previously repeated message (if any) and reset the last message and * count. */ void display_message(::aflibDebug::Level level, const char *msg) { static char lastMsg[1024]; static ::aflibDebug::Level lastLevel; static int msgCount = 0; if (!strncmp(msg, lastMsg, 1024)) { msgCount++; } else { if (msgCount > 0) { char buff[1024]; sprintf(buff, "%s\n(The previous message was repeated %d times.)", lastMsg, msgCount); output_message(lastLevel, buff); } strncpy(lastMsg, msg, 1024); lastLevel = level; msgCount = 0; output_message(level, msg); } } static class DebugInitFromEnv { public: DebugInitFromEnv() { const char *env = getenv("AFLIB_DEBUG"); if(env) { if(strcmp(env,"debug") == 0) aflib_debug_level = ::aflibDebug::lDebug; else if(strcmp(env,"info") == 0) aflib_debug_level = ::aflibDebug::lInfo; else if(strcmp(env,"warning") == 0) aflib_debug_level = ::aflibDebug::lWarning; else if(strcmp(env,"quiet") == 0) aflib_debug_level = ::aflibDebug::lFatal; else { fprintf(stderr, "AFLIB_DEBUG must be one of debug,info,warning,quiet\n"); } } env = getenv("AFLIB_DEBUG_ABORT"); if(env) aflib_debug_abort = true; } } debugInitFromEnv; void aflibDebug::init(const char *prefix, Level level) { aflib_debug_level = level; aflib_debug_prefix = prefix; } void aflibDebug::fatal(const char *fmt, ...) { char buff[1024]; va_list ap; va_start(ap, fmt); vsprintf(buff, fmt, ap); va_end(ap); display_message(::aflibDebug::lFatal, buff); if(aflib_debug_abort) abort(); exit(1); } void aflibDebug::warning(const char *fmt, ...) { if(lWarning >= aflib_debug_level) { char buff[1024]; va_list ap; va_start(ap, fmt); vsprintf(buff, fmt, ap); va_end(ap); display_message(::aflibDebug::lWarning, buff); } } void aflibDebug::info(const char *fmt, ...) { if(lInfo >= aflib_debug_level) { char buff[1024]; va_list ap; va_start(ap, fmt); vsprintf(buff, fmt, ap); va_end(ap); display_message(::aflibDebug::lInfo, buff); } } void aflibDebug::debug(const char *fmt, ...) { if(lDebug >= aflib_debug_level) { char buff[1024]; va_list ap; va_start(ap, fmt); vsprintf(buff, fmt, ap); va_end(ap); display_message(::aflibDebug::lDebug, buff); } } void aflibDebug::messageApp(const char *appName) { messageAppName = (char*) realloc(messageAppName, strlen(appName)+1); strcpy(messageAppName, appName); } darkice-1.0/src/MultiThreadedConnector.h0000644000175000001440000002635111371632310015243 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : MultiThreadedConnector.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef MULTI_THREADED_CONNECTOR_H #define MULTI_THREADED_CONNECTOR_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif // check for __NetBSD__ because it won't be found by AC_CHECK_HEADER on NetBSD // as pthread.h is in /usr/pkg/include, not /usr/include #if defined( HAVE_PTHREAD_H ) || defined( __NetBSD__ ) #include #else #error need pthread.h #endif #include "Referable.h" #include "Ref.h" #include "Reporter.h" #include "Source.h" #include "Sink.h" #include "Connector.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Connects a source to one or more sinks, using a multi-threaded * producer - consumer approach. * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class MultiThreadedConnector : public virtual Connector { private: /** * Helper class to collect information for starting threads. */ class ThreadData { public: /** * The connector starting the thread */ MultiThreadedConnector * connector; /** * The index of the sink this thread writes to. */ unsigned int ixSink; /** * The POSIX thread itself. */ pthread_t thread; /** * Marks if the thread is accepting data. */ bool accepting; /** * Marks if the thread has processed the last batch * of data. */ bool isDone; /** * A flag to show that the sink should be made to cut in the * next iteration. */ bool cut; /** * Default constructor. */ inline ThreadData() { this->connector = 0; this->ixSink = 0; this->thread = 0; this->accepting = false; this->isDone = false; this->cut = false; } /** * The thread function. * * @param param thread parameter, a pointer to a * ThreadData * @return nothing */ static void * threadFunction( void * param ); }; /** * The mutex of this object. */ pthread_mutex_t mutexProduce; /** * The conditional variable for presenting new data. */ pthread_cond_t condProduce; /** * The thread attributes. */ pthread_attr_t threadAttr; /** * The threads for the sinks. */ ThreadData * threads; /** * Signal if we're running or not, so the threads no if to stop. */ bool running; /** * Flag to show if the connector should try to reconnect if * the connection is dropped on the other side. */ bool reconnect; /** * The buffer of information presented to each thread. */ unsigned char * dataBuffer; /** * The amount of information presented to each thread. */ unsigned int dataSize; /** * Initialize the object. * * @param reconnect flag to indicate if the connector should * try to reconnect if the connection was * dropped by the other end * @exception Exception */ void init ( bool reconnect ) throw ( Exception ); /** * De-initialize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline MultiThreadedConnector ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor based on a Source. * * @param source the source to connect to the sinks. * @param reconnect flag to indicate if the connector should * try to reconnect if the connection was * dropped by the other end * @exception Exception */ inline MultiThreadedConnector ( Source * source, bool reconnect ) throw ( Exception ) : Connector( source ) { init(reconnect); } /** * Constructor based on a Source and a Sink. * * @param source the source to connect to the sinks. * @param sink a sink to connect to the source. * @param reconnect flag to indicate if the connector should * try to reconnect if the connection was * dropped by the other end * @exception Exception */ inline MultiThreadedConnector ( Source * source, Sink * sink, bool reconnect ) throw ( Exception ) : Connector( source, sink) { init(reconnect); } /** * Copy constructor. * * @param connector the object to copy. * @exception Exception */ MultiThreadedConnector ( const MultiThreadedConnector & connector ) throw ( Exception ); /** * Destructor. * * @exception Exception */ inline virtual ~MultiThreadedConnector( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param connector the object to assign to this one. * @return a reference to this object. * @exception Exception */ virtual MultiThreadedConnector & operator= ( const MultiThreadedConnector & connector ) throw ( Exception ); /** * Open the connector. Opens the Source and the Sinks if necessary. * * @return true if opening was successful, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Transfer a given amount of data from the Source to all the * Sinks attached. * If an attached Sink closes or encounteres an error during the * process, it is detached and the function carries on with the * rest of the Sinks. If no Sinks remain, or an error is encountered * with the Source, the function returns prematurely. * * @param bytes the amount of data to transfer, in bytes. * If 0, transfer forever. * @param bufSize the size of the buffer to use for transfering. * This amount of data is read from the Source and * written to each Sink on each turn. * @param sec the number of seconds to wait for the Source to have * data available in each turn, and the number of seconds * to wait for the Sinks to accept data. * @param usec the number of micros seconds to wait for the Source to * have data available in each turn, and the number of * micro seconds to wait for the Sinks to accept data. * @return the number of bytes read from the Source. * @exception Exception */ virtual unsigned int transfer ( unsigned long bytes, unsigned int bufSize, unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Signal to each sink we have that they need to cut what they are * doing, and start again. For FileSinks, this usually means to * save the archive file recorded so far, and start a new archive * file. */ virtual void cut ( void ) throw (); /** * Close the Connector. The Source and all Sinks are closed. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); /** * This is the worker function for each thread. * This function has to return fast * * @param ixSink the index of the sink this thread works on. */ void sinkThread( int ixSink ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* MULTI_THREADED_CONNECTOR_H */ darkice-1.0/src/ShoutCast.cpp0000644000175000001440000001613511371632310013104 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : ShoutCast.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $Source$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDIO_H #include #else #error need stdio.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_MATH_H #include #else #error need math.h #endif #include #include "Exception.h" #include "Source.h" #include "Sink.h" #include "Util.h" #include "ShoutCast.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: ShoutCast.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Size of string conversion buffer *----------------------------------------------------------------------------*/ #define STRBUF_SIZE 32 /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void ShoutCast :: init ( const char * irc, const char * aim, const char * icq, const char * mountPoint ) throw ( Exception ) { this->irc = irc ? Util::strDup( irc) : 0; this->aim = aim ? Util::strDup( aim) : 0; this->icq = icq ? Util::strDup( icq) : 0; this->mountPoint = mountPoint ? Util::strDup( mountPoint ) : 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void ShoutCast :: strip ( void ) throw ( Exception ) { if ( irc ) { delete[] irc; } if ( aim ) { delete[] aim; } if ( icq ) { delete[] icq; } if (mountPoint ){ delete[] mountPoint; } } /*------------------------------------------------------------------------------ * Log in to the ShoutCast server using the icy login scheme *----------------------------------------------------------------------------*/ bool ShoutCast :: sendLogin ( void ) throw ( Exception ) { Sink * sink = getSink(); Source * source = getSocket(); const char * str; char resp[STRBUF_SIZE]; unsigned int len; bool needsMountPoint = false; const char * mountPoint = getMountPoint(); if ( !source->isOpen() ) { return false; } if ( !sink->isOpen() ) { return false; } // We will add SOURCE only if really needed: if the mountPoint is not null // and is different of "/". This is to keep maximum compatibility with // NullSoft Shoutcast server. if (mountPoint != 0L && strlen(mountPoint) > 0 && 0 != strcmp("/", mountPoint)) { needsMountPoint = true; } std::ostringstream os; if (needsMountPoint) { os << "SOURCE "; } /* first line is the password in itself */ os << getPassword(); os << "\n"; // send the mount point if (needsMountPoint) { os << " "; if (strncmp("/", mountPoint, 1) != 0) { os << "/"; } os << mountPoint; os << "\n"; } str = os.str().c_str(); // Ok, now we send login which will be different of classical Shoutcast // if mountPoint is not null and is different from "/" ... sink->write( str, strlen( str)); sink->flush(); /* read the anticipated response: "OK" */ len = source->read( resp, STRBUF_SIZE); reportEvent(8, "server response length: ", len); reportEvent(8, "server response: ", resp); if ( len < 2 || resp[0] != 'O' || resp[1] != 'K' ) { return false; } /* suck anything that the other side has to say */ while ( source->canRead( 0, 0) && (len = source->read( resp, STRBUF_SIZE)) ) { ; } /* send the icy headers */ if ( getName() ) { str = "icy-name:"; sink->write( str, strlen( str)); str = getName(); sink->write( str, strlen( str)); } if ( getUrl() ) { str = "\nicy-url:"; sink->write( str, strlen( str)); str = getUrl(); sink->write( str, strlen( str)); } if ( getGenre() ) { str = "\nicy-genre:"; sink->write( str, strlen( str)); str = getGenre(); sink->write( str, strlen( str)); } if ( getIrc() ) { str = "\nicy-irc:"; sink->write( str, strlen( str)); str = getIrc(); sink->write( str, strlen( str)); } if ( getAim() ) { str = "\nicy-aim:"; sink->write( str, strlen( str)); str = getAim(); sink->write( str, strlen( str)); } if ( getIcq() ) { str = "\nicy-icq:"; sink->write( str, strlen( str)); str = getIcq(); sink->write( str, strlen( str)); } str = "\nicy-br:"; sink->write( str, strlen( str)); if ( log10(getBitRate()) >= (STRBUF_SIZE-2) ) { throw Exception( __FILE__, __LINE__, "bitrate does not fit string buffer", getBitRate()); } sprintf( resp, "%d", getBitRate()); sink->write( resp, strlen( resp)); str = "\nicy-pub:"; sink->write( str, strlen( str)); str = getIsPublic() ? "1" : "0"; sink->write( str, strlen( str)); str = "\n\n"; sink->write( str, strlen( str)); sink->flush(); return true; } darkice-1.0/src/main.cpp0000644000175000001440000001402711371633567012130 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : main.cpp Version : $Revision: 476 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Abstract : Program entry point Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDLIB_H #include #else #error needs stdlib.h #endif #ifdef HAVE_SIGNAL_H #include #else #error needs signal.h #endif #include #include #include "Ref.h" #include "Exception.h" #include "Util.h" #include "DarkIce.h" /* =================================================== local data structures */ /*------------------------------------------------------------------------------ * The DarkIce object we're running *----------------------------------------------------------------------------*/ static Ref darkice; /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: main.cpp 476 2010-05-10 01:30:13Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Default config file name *----------------------------------------------------------------------------*/ static const char *DEFAULT_CONFIG_FILE = "/etc/darkice.cfg"; /* =============================================== local function prototypes */ /*------------------------------------------------------------------------------ * Show program usage *----------------------------------------------------------------------------*/ static void showUsage ( std::ostream & os ); /*------------------------------------------------------------------------------ * Handler for the SIGUSR1 signal *----------------------------------------------------------------------------*/ static void sigusr1Handler(int value); /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Program entry point *----------------------------------------------------------------------------*/ int main ( int argc, char * argv[] ) { int res = -1; std::cout << "DarkIce " << VERSION << " live audio streamer, http://code.google.com/p/darkice/" << std::endl << "Copyright (c) 2000-2007, Tyrell Hungary, http://tyrell.hu/" << std::endl << "Copyright (c) 2008-2010, Akos Maroy and Rafael Diniz" << std::endl << "This is free software, and you are welcome to redistribute it " << std::endl << "under the terms of The GNU General Public License version 3 or" << std::endl << "any later version." << std::endl << std::endl; try { const char * configFileName = DEFAULT_CONFIG_FILE; unsigned int verbosity = 1; int i; const char opts[] = "hc:v:"; while ( (i = getopt( argc, argv, opts)) != -1 ) { switch ( i ) { case 'c': configFileName = optarg; break; case 'v': verbosity = Util::strToL( optarg); break; default: case ':': case '?': case 'h': showUsage( std::cout); return 1; } } std::cout << "Using config file: " << configFileName << std::endl; std::ifstream configFile( configFileName); Reporter::setReportVerbosity( verbosity ); Reporter::setReportOutputStream( std::cout ); Config config( configFile); darkice = new DarkIce( config); signal(SIGUSR1, sigusr1Handler); res = darkice->run(); } catch ( Exception & e ) { std::cout << "DarkIce: " << e << std::endl << std::flush; } return res; } /*------------------------------------------------------------------------------ * Show program usage *----------------------------------------------------------------------------*/ static void showUsage ( std::ostream & os ) { os << "usage: darkice [-v n] -c config.file" << std::endl << std::endl << "options:" << std::endl << " -c config.file use configuration file config.file" << std::endl << " if not specified, /etc/darkice.cfg is used" << std::endl << " -v n verbosity level (0 = silent, 10 = loud)" << std::endl << " -h print this message and exit" << std::endl << std::endl; } /*------------------------------------------------------------------------------ * Handle the SIGUSR1 signal here *----------------------------------------------------------------------------*/ static void sigusr1Handler(int value) { darkice->cut(); } darkice-1.0/src/aacPlusEncoder.h0000644000175000001440000004465411371632310013533 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : aacPlusEncoder.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef AACP_ENCODER_H #define AACP_ENCODER_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_AACPLUS_LIB extern "C" { #include #include #include #include #include #include #include #include } #else #error configure with aacplus #endif #include #include #include "Ref.h" #include "Exception.h" #include "Reporter.h" #include "AudioEncoder.h" #include "Sink.h" #ifdef HAVE_SRC_LIB #include #else #include "aflibConverter.h" #endif /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A class representing aacplus AAC+ encoder. * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ #define CORE_DELAY (1600) #define INPUT_DELAY ((CORE_DELAY)*2 +6*64-2048+1) /* ((1600 (core codec)*2 (multi rate) + 6*64 (sbr dec delay) - 2048 (sbr enc delay) + magic*/ #define MAX_DS_FILTER_DELAY 16 /* the additional max resampler filter delay (source fs)*/ #define CORE_INPUT_OFFSET_PS (0) /* (96-64) makes AAC still some 64 core samples too early wrt SBR ... maybe -32 would be even more correct, but 1024-32 would need additional SBR bitstream delay by one frame */ class aacPlusEncoder : public AudioEncoder, public virtual Reporter { private: /** * A flag to indicate if the encoding session is open. */ bool aacplusOpen; /** * Resample ratio */ double resampleRatio; /** * sample rate converter object for possible resampling */ #ifdef HAVE_SRC_LIB SRC_STATE *converter; SRC_DATA converterData; float *resampledOffset; #else aflibConverter *converter; short *resampledOffset; #endif unsigned int resampledOffsetSize; /** * The Sink to dump aac+ data to */ Ref sink; float inBuf[(AACENC_BLOCKSIZE*2 + MAX_DS_FILTER_DELAY + INPUT_DELAY)*MAX_CHANNELS]; char outBuf[(6144/8)*MAX_CHANNELS+ADTS_HEADER_SIZE]; IIR21_RESAMPLER IIR21_reSampler[MAX_CHANNELS]; AACENC_CONFIG config; int nChannelsAAC, nChannelsSBR; unsigned int sampleRateAAC; int bitrate; int bandwidth; unsigned int numAncDataBytes; unsigned char ancDataBytes[MAX_PAYLOAD_SIZE]; bool useParametricStereo; int coreWriteOffset; int envReadOffset; int writeOffset; struct AAC_ENCODER *aacEnc; unsigned int inSamples; unsigned int writtenSamples; HANDLE_SBR_ENCODER hEnvEnc; sbrConfiguration sbrConfig; /** * Initialize the object. * * @param sink the sink to send mp3 output to * @exception Exception */ inline void init ( Sink * sink) throw (Exception) { this->aacplusOpen = false; this->sink = sink; /* TODO: if we have float as input, we don't need conversion */ if ( getInBitsPerSample() != 16 && getInBitsPerSample() != 32 ) { throw Exception( __FILE__, __LINE__, "specified bits per sample not supported", getInBitsPerSample() ); } if ( getInChannel() > 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of input channels for the encoder", getInChannel() ); } if ( getOutChannel() > 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of output channels for the encoder", getOutChannel() ); } /* TODO: this will be neede when we implement mono aac+ encoding */ if ( getInChannel() != getOutChannel() ) { throw Exception( __FILE__, __LINE__, "input channels and output channels do not match"); } if ( getOutSampleRate() == getInSampleRate() ) { resampleRatio = 1; converter = 0; } else if (getInBitsPerSample() == 16) { resampleRatio = ( (double) getOutSampleRate() / (double) getInSampleRate() ); // Determine if we can use linear interpolation. // The inverse of the ratio must be a power of two for linear mode to // be of sufficient quality. bool useLinear = true; double inverse = 1 / resampleRatio; int integer = (int) inverse; // Check that the inverse of the ratio is an integer if( integer == inverse ) { while( useLinear && integer ) { // Loop through the bits // If the lowest order bit is not the only one set if( integer & 1 && integer != 1 ) { // Not a power of two; cannot use linear useLinear = false; } else { // Shift all the bits over and try again integer >>= 1; } } } else { useLinear = false; } // If we get here and useLinear is still true, then we have // a power of two. // open the aflibConverter in // - high quality // - linear or quadratic (non-linear) based on algorithm // - not filter interpolation #ifdef HAVE_SRC_LIB int srcError = 0; converter = src_new(useLinear == true ? SRC_LINEAR : SRC_SINC_FASTEST, getInChannel(), &srcError); if(srcError) throw Exception (__FILE__, __LINE__, "libsamplerate error: ", src_strerror (srcError)); #else converter = new aflibConverter( true, useLinear, false); #endif } else { throw Exception( __FILE__, __LINE__, "specified bits per sample with samplerate conversion not supported", getInBitsPerSample() ); } bitrate = getOutBitrate() * 1000; bandwidth = 0; useParametricStereo = 0; numAncDataBytes=0; coreWriteOffset = 0; envReadOffset = 0; writeOffset = INPUT_DELAY*MAX_CHANNELS; writtenSamples = 0; aacEnc = NULL; hEnvEnc=NULL; } /** * De-initialize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { if ( converter ) { #ifdef HAVE_SRC_LIB delete [] converterData.data_in; src_delete (converter); #else delete converter; #endif delete [] resampledOffset; } } void encodeAacSamples (short *TimeDataPcm, unsigned int samples, int channels) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline aacPlusEncoder ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor. * * @param sink the sink to send mp3 output to * @param inSampleRate sample rate of the input. * @param inBitsPerSample number of bits per sample of the input. * @param inChannel number of channels of the input. * @param inBigEndian shows if the input is big or little endian * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, inSampleRate is used. * @param outChannel number of channels of the output. * If 0, inChannel is used. * @param lowpass frequency threshold for the lowpass filter. * Input above this frequency is cut. * If 0, aacplus's default values are used, * which depends on the out sample rate. * @exception Exception */ inline aacPlusEncoder ( Sink * sink, unsigned int inSampleRate, unsigned int inBitsPerSample, unsigned int inChannel, bool inBigEndian, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, int lowpass = 0) throw ( Exception ) : AudioEncoder ( sink, inSampleRate, inBitsPerSample, inChannel, inBigEndian, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( sink); } /** * Constructor. * * @param sink the sink to send mp3 output to * @param as get input sample rate, bits per sample and channels * from this AudioSource. * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, input sample rate is used. * @param outChannel number of channels of the output. * If 0, input channel is used. * @param lowpass frequency threshold for the lowpass filter. * Input above this frequency is cut. * If 0, aacplus's default values are used, * which depends on the out sample rate. * @exception Exception */ inline aacPlusEncoder ( Sink * sink, const AudioSource * as, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, int lowpass = 0) throw ( Exception ) : AudioEncoder ( sink, as, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( sink); } /** * Copy constructor. * * @param encoder the aacPlusEncoder to copy. */ inline aacPlusEncoder ( const aacPlusEncoder & encoder ) throw ( Exception ) : AudioEncoder( encoder ) { init( encoder.sink.get()); } /** * Destructor. * * @exception Exception */ inline virtual ~aacPlusEncoder ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } strip(); } /** * Assignment operator. * * @param encoder the aacPlusEncoder to assign this to. * @return a reference to this aacPlusEncoder. * @exception Exception */ inline virtual aacPlusEncoder & operator= ( const aacPlusEncoder & encoder ) throw ( Exception ) { if ( this != &encoder ) { strip(); AudioEncoder::operator=( encoder); init( encoder.sink.get()); } return *this; } /** * Get the version string of the underlying aacplus library. * * @return the version string of the underlying aacplus library. */ inline const char * getAacPlusVersion( void ) { char * id; //char * copyright; /* aacplusEncGetVersion(&id, ©right); */ return id; } /** * Check wether encoding is in progress. * * @return true if encoding is in progress, false otherwise. */ inline virtual bool isRunning ( void ) const throw () { return isOpen(); } /** * Start encoding. This function returns as soon as possible, * with encoding started in the background. * * @return true if encoding has started, false otherwise. * @exception Exception */ inline virtual bool start ( void ) throw ( Exception ) { return open(); } /** * Stop encoding. Stops the encoding running in the background. * * @exception Exception */ inline virtual void stop ( void ) throw ( Exception ) { return close(); } /** * Open an encoding session. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the encoding session is open. * * @return true if the encoding session is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return aacplusOpen; } /** * Check if the encoder is ready to accept data. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the encoder is ready to accept data, * false otherwise. * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { if ( !isOpen() ) { return false; } return true; } /** * Write data to the encoder. * Buf is expected to be a sequence of big-endian 16 bit values, * with left and right channels interleaved. Len is the number of * bytes, must be a multiple of 4. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * Flush all data that was written to the encoder to the underlying * connection. * * @exception Exception */ virtual void flush ( void ) throw ( Exception ); /** * Close the encoding session. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* AACP_ENCODER_H */ darkice-1.0/src/Ref.h0000644000175000001440000001733311371632310011351 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Ref.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef REF_H #define REF_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Exception.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Java-like object reference class. * Objects used with this reference class have to be descandents * of class Referable. * * sample usage: * *
 *  #include "Ref.h"
 *  #include "Referable.h"
 *
 *  class  A : public virtual Referable;
 *
 *  ...
 *   
 *  A        * a = new A();
 *  Ref     ref1 = a;       // 1 reference to a
 *  Ref     ref2 = ref1;    // 2 references to a
 *
 *  ref1 = 0;      // 1 reference to a
 *  ref2 = 0;      // at this point object a is destroyed
 *  
* * Based on Tima Saarinen's work, * http://gamma.nic.fi/~timosa/comp/refcount.html * * @ref Referable * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ template class Ref { private: /** * The object referenced by this Ref. * Must be a descandant of Referable. */ T* object; protected: public: /** * Default constructor. */ inline Ref ( void ) throw () { object = NULL; } /** * Copy constructor. * * @param other the Ref to copy. * @exception Exception */ inline Ref ( const Ref & other ) throw ( Exception ) { object = NULL; set( other.object); } /** * Constructor based on an object to reference. * * @param obj the object to reference. * @exception Exception */ inline Ref ( T * obj ) throw ( Exception ) { object = obj; obj->increaseReferenceCount(); } /** * Destructor. * * @exception Exception */ inline virtual ~Ref ( void ) throw ( Exception ) { set( 0 ); } /** * Operator overload to make the reference seem like a pointer. * * @return the pointer to the object referenced. */ inline T* operator->() const throw ( Exception ) { if ( !object ) { throw Exception( __FILE__, __LINE__, "reference to NULL object"); } return object; } /** * Assignment operator. * * @param other the Ref to assign to this one. * @return a reference to this Ref. * @exception Exception */ inline Ref & operator= ( Ref other ) throw ( Exception ) { set( other.object); return *this; } /** * Assignment operator. * * @param obj pointer to the object to assign to this Ref. * @return a reference to this Ref. * @exception Exception */ inline Ref & operator= ( T* obj ) throw ( Exception ) { set( obj); return *this; } /** * Set the object referenced. * Deletes the old referenced object is this was it's last reference. * * @param newobj pointer to the object to reference by this Ref. * @exception Exception */ inline void set ( T * newobj ) throw ( Exception ) { // If equal do nothing if ( newobj == object ) { return; } // Increase reference count if ( newobj ) { newobj->increaseReferenceCount(); } // Decrease the reference count of the old referable if ( object ) { if ( object->decreaseReferenceCount() == 0 ) { delete object; } } // Assign object = newobj; } /** * Return object pointer. This method should be used with * care because it breaks the encapsulation. * Typically this method is needed for the method calls * which require literal object pointer. * * It may not be bad idea to pass the Ref * objects as method arguments. * * @return Object pointer or NULL. */ inline T* get ( void ) const throw () { return object; } /** * Equality operator. * * @param other the pointer to compare this with. * @return true is this Ref refers to the same object as other, * false otherwise. */ inline bool operator== ( const T * other ) const throw () { return object == other; } /** * Equality operator. * * @param other the Ref to compare this with. * @return true is the two Refs refer to the same object, * false otherwise. */ inline bool operator== ( const Ref & other ) const throw () { return object == other.object; } /** * Unequality operator. * * @param other the pointer to compare this with. * @return false is this Ref refers to a different object then other, * true otherwise. */ inline bool operator!= ( const T * other ) const throw () { return object != other; } /** * Unequality operator. * * @param other the Ref to compare this with. * @return false is the two Refs refer to the same object, * true otherwise. */ inline bool operator!= ( const Ref & other ) const throw () { return object != other.object; } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* REF_H */ darkice-1.0/src/DarkIceConfig.cpp0000644000175000001440000001222211371632310013610 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell Config File : DarkIceConfig.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "DarkIceConfig.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: DarkIceConfig.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Max line size *----------------------------------------------------------------------------*/ #define LINE_SIZE 256 /*------------------------------------------------------------------------------ * string containing all white space characters *----------------------------------------------------------------------------*/ #define WHITE_SPACE_STR " \t" /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Get a value for a key *----------------------------------------------------------------------------*/ const ConfigSection * Config :: get ( const char * key ) const throw ( Exception ) { if ( !key ) { throw Exception( __FILE__, __LINE__, "no key"); } TableType::const_iterator it = table.find( key); if ( it == table.end() ) { return 0; } return &(it->second); } /*------------------------------------------------------------------------------ * Add a configuration line *----------------------------------------------------------------------------*/ bool Config :: addLine ( const char * line ) throw ( Exception ) { if ( !line ) { throw Exception( __FILE__, __LINE__, "no line"); } std::string::size_type ix; std::string str( line); /* delete everything after the first # */ if ( (ix = str.find( '#')) != str.npos ) { str.erase( ix); } /* eat up all white space from the front */ if ( (ix = str.find_first_not_of( WHITE_SPACE_STR)) != str.npos ) { str.erase( 0, ix); } /* eat up all white space from the end */ if ( (ix = str.find_last_not_of( WHITE_SPACE_STR)) != str.npos ) { str.erase( ix + 1); } if ( !str.length() ) { return true; } if ( str[0] == '[' && str[str.size()-1] == ']' ) { // a new section starts std::string section( str, 1, str.size()-2); ConfigSection cSection; std::pair element( section, cSection); std::pair res; res = table.insert( element); currentSection = section; return res.second; } else { // it's a line for the current section TableType::iterator it = table.find( currentSection); if ( it == table.end() ) { throw Exception( __FILE__, __LINE__, "no current section"); } return it->second.addLine( line); } } /*------------------------------------------------------------------------------ * Add a configuration line *----------------------------------------------------------------------------*/ void Config :: read ( std::istream & is ) throw ( Exception ) { char line[LINE_SIZE]; unsigned int num; for ( num = 0; !is.fail() && !is.eof(); ++num ) { is.getline( line, LINE_SIZE); if ( is.eof() ) { break; } else if ( is.fail() ) { throw Exception( __FILE__, __LINE__, "line too long", num); } addLine( line); } } darkice-1.0/src/SolarisDspSource.cpp0000644000175000001440000001640211371632310014430 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : SolarisDspSource.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include "SolarisDspSource.h" #ifdef SUPPORT_SOLARIS_DSP // only compile this code if there is support for it #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_SYS_TYPES_H #include #else #error need sys/types.h #endif #ifdef HAVE_SYS_STAT_H #include #else #error need sys/stat.h #endif #ifdef HAVE_FCNTL_H #include #else #error need fcntl.h #endif #ifdef HAVE_SYS_TIME_H #include #else #error need sys/time.h #endif #ifdef HAVE_SYS_IOCTL_H #include #else #error need sys/ioctl.h #endif #ifdef HAVE_SIGNAL_H #include #else #error need signal.h #endif #if defined( HAVE_SYS_AUDIO_H ) #include #elif defined( HAVE_SYS_AUDIOIO_H ) #include #else #error need sys/audio.h or sys/audioio.h #endif #include "Util.h" #include "Exception.h" #include "SolarisDspSource.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: SolarisDspSource.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void SolarisDspSource :: init ( const char * name ) throw ( Exception ) { fileName = Util::strDup( name); fileDescriptor = 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void SolarisDspSource :: strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } delete[] fileName; } #include /*------------------------------------------------------------------------------ * Open the audio source *----------------------------------------------------------------------------*/ bool SolarisDspSource :: open ( void ) throw ( Exception ) { audio_info_t audioInfo; if ( isOpen() ) { return false; } if ( (fileDescriptor = ::open( fileName, O_RDONLY)) == -1 ) { fileDescriptor = 0; return false; } AUDIO_INITINFO( &audioInfo); audioInfo.record.sample_rate = getSampleRate(); audioInfo.record.channels = getChannel(); audioInfo.record.precision = getBitsPerSample(); audioInfo.record.encoding = AUDIO_ENCODING_LINEAR; // for stupid OpenBSD we need to add the following, as it masks // read/write calls when using -pthread audioInfo.record.pause = 0; if ( ioctl( fileDescriptor, AUDIO_SETINFO, &audioInfo) == -1 ) { close(); throw Exception( __FILE__, __LINE__, "ioctl error"); } if ( audioInfo.record.channels != getChannel() ) { close(); throw Exception( __FILE__, __LINE__, "can't set channels", audioInfo.record.channels); } if ( audioInfo.record.precision != getBitsPerSample() ) { close(); throw Exception( __FILE__, __LINE__, "can't set bits per sample", audioInfo.record.precision); } if ( audioInfo.record.sample_rate != getSampleRate() ) { reportEvent( 2, "sound card recording sample rate set to ", audioInfo.record.sample_rate, " while trying to set it to ", getSampleRate()); reportEvent( 2, "this is probably not a problem, but a slight " "drift in the sound card driver"); } return true; } /*------------------------------------------------------------------------------ * Check wether read() would return anything *----------------------------------------------------------------------------*/ bool SolarisDspSource :: canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ) { fd_set fdset; struct timespec timespec; sigset_t sigset; int ret; if ( !isOpen() ) { return false; } FD_ZERO( &fdset); FD_SET( fileDescriptor, &fdset); timespec.tv_sec = sec; timespec.tv_nsec = usec * 1000L; // mask out SIGUSR1, as we're expecting that signal for other reasons sigemptyset(&sigset); sigaddset(&sigset, SIGUSR1); ret = pselect( fileDescriptor + 1, &fdset, NULL, NULL, ×pec, &sigset); if ( ret == -1 ) { throw Exception( __FILE__, __LINE__, "select error"); } return ret > 0; } /*------------------------------------------------------------------------------ * Read from the audio source *----------------------------------------------------------------------------*/ unsigned int SolarisDspSource :: read ( void * buf, unsigned int len ) throw ( Exception ) { ssize_t ret; if ( !isOpen() ) { return 0; } ret = ::read( fileDescriptor, buf, len); if ( ret == -1 ) { throw Exception( __FILE__, __LINE__, "read error"); } return ret; } /*------------------------------------------------------------------------------ * Close the audio source *----------------------------------------------------------------------------*/ void SolarisDspSource :: close ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } ::close( fileDescriptor); fileDescriptor = 0; } #endif // SUPPORT_SOLARIS_DSP darkice-1.0/src/SerialUlaw.cpp0000644000175000001440000002224511371631674013252 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000 Tyrell Corporation. Copyright (c) 2006 Clyde Stubbs. Tyrell DarkIce File : SerialUlaw.cpp Version : $Revision: 1.13 $ Author : $Author: darkeye $ Location : $Source: /cvsroot/darkice/darkice/src/SerialUlaw.cpp,v $ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include "SerialUlaw.h" #ifdef SUPPORT_SERIAL_ULAW // only compile this code if there's support for it #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_SYS_TYPES_H #include #else #error need sys/types.h #endif #ifdef HAVE_SYS_STAT_H #include #else #error need sys/stat.h #endif #ifdef HAVE_FCNTL_H #include #else #error need fcntl.h #endif #ifdef HAVE_SYS_TIME_H #include #else #error need sys/time.h #endif #ifdef HAVE_SYS_IOCTL_H #include #else #error need sys/ioctl.h #endif #ifdef HAVE_TERMIOS_H #include #else #error need termios.h #endif #include "Util.h" #include "Exception.h" #include "SerialUlaw.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id$"; /*------------------------------------------------------------------------------ * Ulaw decode table *----------------------------------------------------------------------------*/ static unsigned int ulawdecode[256] = { 0x8284,0x8684,0x8a84,0x8e84,0x9284,0x9684,0x9a84,0x9e84, 0xa284,0xa684,0xaa84,0xae84,0xb284,0xb684,0xba84,0xbe84, 0xc184,0xc384,0xc584,0xc784,0xc984,0xcb84,0xcd84,0xcf84, 0xd184,0xd384,0xd584,0xd784,0xd984,0xdb84,0xdd84,0xdf84, 0xe104,0xe204,0xe304,0xe404,0xe504,0xe604,0xe704,0xe804, 0xe904,0xea04,0xeb04,0xec04,0xed04,0xee04,0xef04,0xf004, 0xf0c4,0xf144,0xf1c4,0xf244,0xf2c4,0xf344,0xf3c4,0xf444, 0xf4c4,0xf544,0xf5c4,0xf644,0xf6c4,0xf744,0xf7c4,0xf844, 0xf8a4,0xf8e4,0xf924,0xf964,0xf9a4,0xf9e4,0xfa24,0xfa64, 0xfaa4,0xfae4,0xfb24,0xfb64,0xfba4,0xfbe4,0xfc24,0xfc64, 0xfc94,0xfcb4,0xfcd4,0xfcf4,0xfd14,0xfd34,0xfd54,0xfd74, 0xfd94,0xfdb4,0xfdd4,0xfdf4,0xfe14,0xfe34,0xfe54,0xfe74, 0xfe8c,0xfe9c,0xfeac,0xfebc,0xfecc,0xfedc,0xfeec,0xfefc, 0xff0c,0xff1c,0xff2c,0xff3c,0xff4c,0xff5c,0xff6c,0xff7c, 0xff88,0xff90,0xff98,0xffa0,0xffa8,0xffb0,0xffb8,0xffc0, 0xffc8,0xffd0,0xffd8,0xffe0,0xffe8,0xfff0,0xfff8,0x0000, 0x7d7c,0x797c,0x757c,0x717c,0x6d7c,0x697c,0x657c,0x617c, 0x5d7c,0x597c,0x557c,0x517c,0x4d7c,0x497c,0x457c,0x417c, 0x3e7c,0x3c7c,0x3a7c,0x387c,0x367c,0x347c,0x327c,0x307c, 0x2e7c,0x2c7c,0x2a7c,0x287c,0x267c,0x247c,0x227c,0x207c, 0x1efc,0x1dfc,0x1cfc,0x1bfc,0x1afc,0x19fc,0x18fc,0x17fc, 0x16fc,0x15fc,0x14fc,0x13fc,0x12fc,0x11fc,0x10fc,0x0ffc, 0x0f3c,0x0ebc,0x0e3c,0x0dbc,0x0d3c,0x0cbc,0x0c3c,0x0bbc, 0x0b3c,0x0abc,0x0a3c,0x09bc,0x093c,0x08bc,0x083c,0x07bc, 0x075c,0x071c,0x06dc,0x069c,0x065c,0x061c,0x05dc,0x059c, 0x055c,0x051c,0x04dc,0x049c,0x045c,0x041c,0x03dc,0x039c, 0x036c,0x034c,0x032c,0x030c,0x02ec,0x02cc,0x02ac,0x028c, 0x026c,0x024c,0x022c,0x020c,0x01ec,0x01cc,0x01ac,0x018c, 0x0174,0x0164,0x0154,0x0144,0x0134,0x0124,0x0114,0x0104, 0x00f4,0x00e4,0x00d4,0x00c4,0x00b4,0x00a4,0x0094,0x0084, 0x0078,0x0070,0x0068,0x0060,0x0058,0x0050,0x0048,0x0040, 0x0038,0x0030,0x0028,0x0020,0x0018,0x0010,0x0008,0x0000, }; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Tell if source id big endian *----------------------------------------------------------------------------*/ bool SerialUlaw :: isBigEndian ( void ) const throw () { return false; } /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void SerialUlaw :: init ( const char * name ) throw ( Exception ) { fileName = Util::strDup( name); fileDescriptor = 0; running = false; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void SerialUlaw :: strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } delete[] fileName; } /*------------------------------------------------------------------------------ * Open the audio source *----------------------------------------------------------------------------*/ bool SerialUlaw :: open ( void ) throw ( Exception ) { struct termios ts; if ( isOpen() ) { return false; } switch ( getBitsPerSample() ) { case 16: break; default: return false; } if (getChannel() != 1) { reportEvent(3, "Only mono input supported for Serial ULaw"); return false; } if (getSampleRate() != 8000) { reportEvent(3, "Only 8000 Hz sample rate supported for Serial ULaw"); return false; } if ( (fileDescriptor = ::open( fileName, O_RDONLY)) == -1 ) { fileDescriptor = 0; return false; } if(tcgetattr(fileDescriptor, &ts) < 0) { close(); throw Exception( __FILE__, __LINE__, "can't get tty settings"); } cfsetispeed(&ts, B115200); cfmakeraw(&ts); ts.c_cflag |= CLOCAL; if(tcsetattr(fileDescriptor, TCSANOW, &ts) < 0) { close(); throw Exception( __FILE__, __LINE__, "can't set tty settings"); } tcflush(fileDescriptor, TCIFLUSH); return true; } /*------------------------------------------------------------------------------ * Check whether read() would return anything *----------------------------------------------------------------------------*/ bool SerialUlaw :: canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ) { fd_set fdset; struct timeval tv; int ret; if ( !isOpen() ) { return false; } FD_ZERO( &fdset); FD_SET( fileDescriptor, &fdset); tv.tv_sec = sec; tv.tv_usec = usec; ret = select( fileDescriptor + 1, &fdset, NULL, NULL, &tv); if ( ret == -1 ) { throw Exception( __FILE__, __LINE__, "select error"); } return ret > 0; } /*------------------------------------------------------------------------------ * Read from the audio source *----------------------------------------------------------------------------*/ unsigned int SerialUlaw :: read ( void * buf, unsigned int len ) throw ( Exception ) { ssize_t ret; unsigned char ubuf[256], * ptr; int i, plen; if ( !isOpen() ) { return 0; } ret = 0; ptr = (unsigned char *)buf; while(len > 1) { plen = sizeof(ubuf); if (plen > (int)len/2) { plen = len/2; } plen = ::read( fileDescriptor, ubuf, plen); if(plen < 0) { perror("read"); throw Exception( __FILE__, __LINE__, "read error"); } for(i = 0 ; i != plen ; i++) { *ptr++ = ulawdecode[ubuf[i]] & 0xFF; *ptr++ = ulawdecode[ubuf[i]] >> 8; } len -= plen*2; ret += plen*2; } running = true; return ret; } /*------------------------------------------------------------------------------ * Close the audio source *----------------------------------------------------------------------------*/ void SerialUlaw :: close ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } ::close( fileDescriptor); fileDescriptor = 0; running = false; } #endif // SUPPORT_SERIAL_ULAW darkice-1.0/src/FaacEncoder.h0000644000175000001440000004211011371632310012756 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : FaacEncoder.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef AAC_ENCODER_H #define AAC_ENCODER_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_FAAC_LIB #include #else #error configure with faac #endif #include "Ref.h" #include "Exception.h" #include "Reporter.h" #include "AudioEncoder.h" #include "Sink.h" #ifdef HAVE_SRC_LIB #include #else #include "aflibConverter.h" #endif /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A class representing faac AAC encoder. * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class FaacEncoder : public AudioEncoder, public virtual Reporter { private: /** * A flag to indicate if the encoding session is open. */ bool faacOpen; /** * The handle to the AAC encoder instance. */ faacEncHandle encoderHandle; /** * The maximum number of input samples to supply to the encoder. */ unsigned long inputSamples; /** * The maximum number of output bytes the encoder returns in one call. */ unsigned long maxOutputBytes; /** * Lowpass filter. Sound frequency in Hz, from where up the * input is cut. */ int lowpass; /** * Resample ratio */ double resampleRatio; /** * sample rate converter object for possible resampling */ #ifdef HAVE_SRC_LIB SRC_STATE *converter; SRC_DATA converterData; float *resampledOffset; #else aflibConverter *converter; short *resampledOffset; #endif unsigned int resampledOffsetSize; /** * Initialize the object. * * @param lowpass frequency threshold for the lowpass filter. * Input above this frequency is cut. * If 0, faac's default values are used, * which depends on the out sample rate. * @exception Exception */ inline void init ( int lowpass) throw (Exception) { this->faacOpen = false; this->lowpass = lowpass; if ( getInBitsPerSample() != 16 && getInBitsPerSample() != 8 ) { throw Exception( __FILE__, __LINE__, "specified bits per sample not supported", getInBitsPerSample() ); } if ( getInChannel() != 1 && getInChannel() != 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of input channels for the encoder", getInChannel() ); } if ( getOutChannel() != 1 && getOutChannel() != 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of output channels for the encoder", getOutChannel() ); } if ( getInChannel() != getOutChannel() ) { throw Exception( __FILE__, __LINE__, "input channels and output channels do not match"); } if ( getOutSampleRate() == getInSampleRate() ) { resampleRatio = 1; converter = 0; } else if (getInBitsPerSample() == 16) { resampleRatio = ( (double) getOutSampleRate() / (double) getInSampleRate() ); // Determine if we can use linear interpolation. // The inverse of the ratio must be a power of two for linear mode to // be of sufficient quality. bool useLinear = true; double inverse = 1 / resampleRatio; int integer = (int) inverse; // Check that the inverse of the ratio is an integer if( integer == inverse ) { while( useLinear && integer ) { // Loop through the bits // If the lowest order bit is not the only one set if( integer & 1 && integer != 1 ) { // Not a power of two; cannot use linear useLinear = false; } else { // Shift all the bits over and try again integer >>= 1; } } } else { useLinear = false; } // If we get here and useLinear is still true, then we have // a power of two. // open the aflibConverter in // - high quality // - linear or quadratic (non-linear) based on algorithm // - not filter interpolation #ifdef HAVE_SRC_LIB int srcError = 0; converter = src_new(useLinear == true ? SRC_LINEAR : SRC_SINC_FASTEST, getInChannel(), &srcError); if(srcError) throw Exception (__FILE__, __LINE__, "libsamplerate error: ", src_strerror (srcError)); #else converter = new aflibConverter( true, useLinear, false); #endif } else { throw Exception( __FILE__, __LINE__, "specified bits per sample with samplerate conversion not supported", getInBitsPerSample() ); } } /** * De-initialize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { if ( converter ) { #ifdef HAVE_SRC_LIB delete [] converterData.data_in; src_delete (converter); #else delete converter; #endif delete [] resampledOffset; } } protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline FaacEncoder ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor. * * @param sink the sink to send mp3 output to * @param inSampleRate sample rate of the input. * @param inBitsPerSample number of bits per sample of the input. * @param inChannel number of channels of the input. * @param inBigEndian shows if the input is big or little endian * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, inSampleRate is used. * @param outChannel number of channels of the output. * If 0, inChannel is used. * @param lowpass frequency threshold for the lowpass filter. * Input above this frequency is cut. * If 0, faac's default values are used, * which depends on the out sample rate. * @exception Exception */ inline FaacEncoder ( Sink * sink, unsigned int inSampleRate, unsigned int inBitsPerSample, unsigned int inChannel, bool inBigEndian, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, int lowpass = 0) throw ( Exception ) : AudioEncoder ( sink, inSampleRate, inBitsPerSample, inChannel, inBigEndian, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( lowpass); } /** * Constructor. * * @param sink the sink to send mp3 output to * @param as get input sample rate, bits per sample and channels * from this AudioSource. * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, input sample rate is used. * @param outChannel number of channels of the output. * If 0, input channel is used. * @param lowpass frequency threshold for the lowpass filter. * Input above this frequency is cut. * If 0, faac's default values are used, * which depends on the out sample rate. * @exception Exception */ inline FaacEncoder ( Sink * sink, const AudioSource * as, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, int lowpass = 0) throw ( Exception ) : AudioEncoder ( sink, as, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( lowpass); } /** * Copy constructor. * * @param encoder the FaacEncoder to copy. */ inline FaacEncoder ( const FaacEncoder & encoder ) throw ( Exception ) : AudioEncoder( encoder ) { init( encoder.lowpass); } /** * Destructor. * * @exception Exception */ inline virtual ~FaacEncoder ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } strip(); } /** * Assignment operator. * * @param encoder the FaacEncoder to assign this to. * @return a reference to this FaacEncoder. * @exception Exception */ inline virtual FaacEncoder & operator= ( const FaacEncoder & encoder ) throw ( Exception ) { if ( this != &encoder ) { strip(); AudioEncoder::operator=( encoder); init( encoder.lowpass); } return *this; } /** * Get the version string of the underlying faac library. * * @return the version string of the underlying faac library. */ inline const char * getFaacVersion( void ) { char * id; char * copyright; faacEncGetVersion(&id, ©right); return id; } /** * Check wether encoding is in progress. * * @return true if encoding is in progress, false otherwise. */ inline virtual bool isRunning ( void ) const throw () { return isOpen(); } /** * Start encoding. This function returns as soon as possible, * with encoding started in the background. * * @return true if encoding has started, false otherwise. * @exception Exception */ inline virtual bool start ( void ) throw ( Exception ) { return open(); } /** * Stop encoding. Stops the encoding running in the background. * * @exception Exception */ inline virtual void stop ( void ) throw ( Exception ) { return close(); } /** * Open an encoding session. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the encoding session is open. * * @return true if the encoding session is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return faacOpen; } /** * Check if the encoder is ready to accept data. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the encoder is ready to accept data, * false otherwise. * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { if ( !isOpen() ) { return false; } return true; } /** * Write data to the encoder. * Buf is expected to be a sequence of big-endian 16 bit values, * with left and right channels interleaved. Len is the number of * bytes, must be a multiple of 4. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * Flush all data that was written to the encoder to the underlying * connection. * * @exception Exception */ virtual void flush ( void ) throw ( Exception ); /** * Close the encoding session. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* AAC_ENCODER_H */ darkice-1.0/src/AudioSource.cpp0000644000175000001440000001204011371632310013400 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : AudioSource.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "AudioSource.h" #include "Util.h" #include "Exception.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: AudioSource.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Return an audio source based on the compiled DSP supports and the * supplied device name parameter. *----------------------------------------------------------------------------*/ AudioSource * AudioSource :: createDspSource( const char * deviceName, const char * jackClientName, int sampleRate, int bitsPerSample, int channel) throw ( Exception ) { if ( Util::strEq( deviceName, "/dev/tty", 8) ) { #if defined( SUPPORT_SERIAL_ULAW ) Reporter::reportEvent( 1, "Using Serial Ulaw input device:", deviceName); return new SerialUlaw( deviceName, sampleRate, bitsPerSample, channel); #else throw Exception( __FILE__, __LINE__, "trying to open Serial ULaw device " "without support compiled", deviceName); #endif } else if ( Util::strEq( deviceName, "/dev", 4) ) { #if defined( SUPPORT_OSS_DSP ) Reporter::reportEvent( 1, "Using OSS DSP input device:", deviceName); return new OssDspSource( deviceName, sampleRate, bitsPerSample, channel); #elif defined( SUPPORT_SOLARIS_DSP ) Reporter::reportEvent( 1, "Using Solaris DSP input device:",deviceName); return new SolarisDspSource( deviceName, sampleRate, bitsPerSample, channel); #else throw Exception( __FILE__, __LINE__, "trying to open OSS or Solaris DSP device " "without support compiled", deviceName); #endif } else if ( Util::strEq( deviceName, "jack", 4) ) { #if defined( SUPPORT_JACK_DSP ) Reporter::reportEvent( 1, "Using JACK audio server as input device."); return new JackDspSource( deviceName, jackClientName, sampleRate, bitsPerSample, channel); #else throw Exception( __FILE__, __LINE__, "trying to open JACK device without " "support compiled", deviceName); #endif } else { #if defined( SUPPORT_ALSA_DSP ) Reporter::reportEvent( 1, "Using ALSA DSP input device:", deviceName); return new AlsaDspSource( deviceName, sampleRate, bitsPerSample, channel); #else throw Exception( __FILE__, __LINE__, "trying to open ALSA DSP device without " "support compiled", deviceName); #endif } } darkice-1.0/src/Referable.h0000644000175000001440000001055011371632310012516 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Referable.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef REFERABLE_H #define REFERABLE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Exception.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Base class for an object for which references can be made * with the reference class Ref. * * usage: * *
 *  class A : public virtual Referable
 *  {
 *     ...
 *  };
 *  
* * @ref Ref * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class Referable { private: /** * Number of references to the object. */ unsigned int referenceCount; /** * Maximum number of references before an overflow occurs. */ static const unsigned int maxCount = ~((unsigned int)0); protected: /** * Default constructor. */ inline Referable ( void ) throw () { referenceCount = 0; } /** * Desctructor. * * @exception Exception */ inline virtual ~Referable ( void ) throw ( Exception ) { if ( referenceCount > 0 ) { throw Exception( __FILE__, __LINE__, "reference count positive in destructor", referenceCount); } } public: /** * Increase reference count. * * @return the new reference count. * @exception Exception */ inline unsigned int increaseReferenceCount ( void ) throw ( Exception ) { if ( referenceCount >= maxCount ) { throw Exception( __FILE__, __LINE__, "reference count overflow", referenceCount ); } return ++referenceCount; } /** * Decrease reference count. * * @return the new reference count. * @exception Exception */ inline unsigned int decreaseReferenceCount ( void ) throw ( Exception ) { if ( referenceCount == 0 ) { throw Exception( __FILE__, __LINE__, "reference count underflow", referenceCount ); } return --referenceCount; } /** * Get the reference count. * * @return the reference count. */ inline unsigned int getReferenceCount ( void ) const throw () { return referenceCount; } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* REFERABLE_H */ darkice-1.0/src/TwoLameLibEncoder.h0000644000175000001440000002640411371632310014133 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : TwoLameLibEncoder.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef TWOLAME_LIB_ENCODER_H #define TWOLAME_LIB_ENCODER_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_TWOLAME_LIB #include #else #error configure with twolame #endif #include "Ref.h" #include "Exception.h" #include "Reporter.h" #include "AudioEncoder.h" #include "Sink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A class representing the TwoLame encoder linked as a shared object or as * a static library. * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class TwoLameLibEncoder : public AudioEncoder, public virtual Reporter { private: /** * TwoLame library global flags */ twolame_options * twolame_opts; /** * Initialize the object. * * @param sink the sink to send mp2 output to * @exception Exception */ void init ( void ) throw ( Exception ); /** * De-initialize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { } protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline TwoLameLibEncoder ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor. * * @param sink the sink to send mp2 output to * @param inSampleRate sample rate of the input. * @param inBitsPerSample number of bits per sample of the input. * @param inChannel number of channels of the input. * @param inBigEndian shows if the input is big or little endian * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outSampleRate sample rate of the output. * If 0, inSampleRate is used. * @param outChannel number of channels of the output. * If 0, inChannel is used. * @exception Exception */ inline TwoLameLibEncoder ( Sink * sink, unsigned int inSampleRate, unsigned int inBitsPerSample, unsigned int inChannel, bool inBigEndian, BitrateMode outBitrateMode, unsigned int outBitrate, unsigned int outSampleRate = 0, unsigned int outChannel = 0 ) throw ( Exception ) : AudioEncoder ( sink, inSampleRate, inBitsPerSample, inChannel, inBigEndian, outBitrateMode, outBitrate, 0.0f, // outQuality outSampleRate, outChannel ) { init(); } /** * Constructor. * * @param sink the sink to send mp2 output to * @param as get input sample rate, bits per sample and channels * from this AudioSource. * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outSampleRate sample rate of the output. * If 0, input sample rate is used. * @param outChannel number of channels of the output. * If 0, input channel is used. * @exception Exception */ inline TwoLameLibEncoder ( Sink * sink, const AudioSource * as, BitrateMode outBitrateMode, unsigned int outBitrate, unsigned int outSampleRate = 0, unsigned int outChannel = 0 ) throw ( Exception ) : AudioEncoder ( sink, as, outBitrateMode, outBitrate, 0.0f, // outQuality outSampleRate, outChannel ) { init(); } /** * Copy constructor. * * @param encoder the TwoLameLibEncoder to copy. */ inline TwoLameLibEncoder ( const TwoLameLibEncoder & encoder ) throw ( Exception ) : AudioEncoder( encoder ) { init(); } /** * Destructor. * * @exception Exception */ inline virtual ~TwoLameLibEncoder ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } strip(); } /** * Assignment operator. * * @param encoder the TwoLameLibEncoder to assign this to. * @return a reference to this TwoLameLibEncoder. * @exception Exception */ inline virtual TwoLameLibEncoder & operator= ( const TwoLameLibEncoder & encoder ) throw ( Exception ) { if ( this != &encoder ) { strip(); AudioEncoder::operator=( encoder); init(); } return *this; } /** * Get the version string of the underlying lame library. * * @return the version string of the underlying lame library. */ inline const char * getLameVersion( void ) { return get_twolame_version(); } /** * Check wether encoding is in progress. * * @return true if encoding is in progress, false otherwise. */ inline virtual bool isRunning ( void ) const throw () { return isOpen(); } /** * Start encoding. This function returns as soon as possible, * with encoding started in the background. * * @return true if encoding has started, false otherwise. * @exception Exception */ inline virtual bool start ( void ) throw ( Exception ) { return open(); } /** * Stop encoding. Stops the encoding running in the background. * * @exception Exception */ inline virtual void stop ( void ) throw ( Exception ) { return close(); } /** * Open an encoding session. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the encoding session is open. * * @return true if the encoding session is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return twolame_opts != 0; } /** * Check if the encoder is ready to accept data. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the encoder is ready to accept data, * false otherwise. * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { if ( !isOpen() ) { return false; } return true; } /** * Write data to the encoder. * Buf is expected to be a sequence of big-endian 16 bit values, * with left and right channels interleaved. Len is the number of * bytes, must be a multiple of 4. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * Flush all data that was written to the encoder to the underlying * connection. * * @exception Exception */ virtual void flush ( void ) throw ( Exception ); /** * Close the encoding session. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* TWOLAME_LIB_ENCODER_H */ darkice-1.0/src/aflibConverterSmallFilter.h0000644000175000001440000005350511371632022015742 00000000000000/* * Copyright: (C) 2000 Julius O. Smith * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Julius O. Smith jos@ccrma.stanford.edu * */ #ifdef HAVE_CONFIG_H #include #endif #define SMALL_FILTER_NMULT ((short)13) #define SMALL_FILTER_SCALE 13128 /* Unity-gain scale factor */ #define SMALL_FILTER_NWING 1536 /* Filter table length */ short aflibConverter::SMALL_FILTER_IMP[] /* Impulse response */ = { 32767, 32766, 32764, 32760, 32755, 32749, 32741, 32731, 32721, 32708, 32695, 32679, 32663, 32645, 32625, 32604, 32582, 32558, 32533, 32506, 32478, 32448, 32417, 32385, 32351, 32316, 32279, 32241, 32202, 32161, 32119, 32075, 32030, 31984, 31936, 31887, 31836, 31784, 31731, 31676, 31620, 31563, 31504, 31444, 31383, 31320, 31256, 31191, 31124, 31056, 30987, 30916, 30845, 30771, 30697, 30621, 30544, 30466, 30387, 30306, 30224, 30141, 30057, 29971, 29884, 29796, 29707, 29617, 29525, 29433, 29339, 29244, 29148, 29050, 28952, 28852, 28752, 28650, 28547, 28443, 28338, 28232, 28125, 28017, 27908, 27797, 27686, 27574, 27461, 27346, 27231, 27115, 26998, 26879, 26760, 26640, 26519, 26398, 26275, 26151, 26027, 25901, 25775, 25648, 25520, 25391, 25262, 25131, 25000, 24868, 24735, 24602, 24467, 24332, 24197, 24060, 23923, 23785, 23647, 23507, 23368, 23227, 23086, 22944, 22802, 22659, 22515, 22371, 22226, 22081, 21935, 21789, 21642, 21494, 21346, 21198, 21049, 20900, 20750, 20600, 20449, 20298, 20146, 19995, 19842, 19690, 19537, 19383, 19230, 19076, 18922, 18767, 18612, 18457, 18302, 18146, 17990, 17834, 17678, 17521, 17365, 17208, 17051, 16894, 16737, 16579, 16422, 16264, 16106, 15949, 15791, 15633, 15475, 15317, 15159, 15001, 14843, 14685, 14527, 14369, 14212, 14054, 13896, 13739, 13581, 13424, 13266, 13109, 12952, 12795, 12639, 12482, 12326, 12170, 12014, 11858, 11703, 11548, 11393, 11238, 11084, 10929, 10776, 10622, 10469, 10316, 10164, 10011, 9860, 9708, 9557, 9407, 9256, 9106, 8957, 8808, 8659, 8511, 8364, 8216, 8070, 7924, 7778, 7633, 7488, 7344, 7200, 7057, 6914, 6773, 6631, 6490, 6350, 6210, 6071, 5933, 5795, 5658, 5521, 5385, 5250, 5115, 4981, 4848, 4716, 4584, 4452, 4322, 4192, 4063, 3935, 3807, 3680, 3554, 3429, 3304, 3180, 3057, 2935, 2813, 2692, 2572, 2453, 2335, 2217, 2101, 1985, 1870, 1755, 1642, 1529, 1418, 1307, 1197, 1088, 979, 872, 765, 660, 555, 451, 348, 246, 145, 44, -54, -153, -250, -347, -443, -537, -631, -724, -816, -908, -998, -1087, -1175, -1263, -1349, -1435, -1519, -1603, -1685, -1767, -1848, -1928, -2006, -2084, -2161, -2237, -2312, -2386, -2459, -2531, -2603, -2673, -2742, -2810, -2878, -2944, -3009, -3074, -3137, -3200, -3261, -3322, -3381, -3440, -3498, -3554, -3610, -3665, -3719, -3772, -3824, -3875, -3925, -3974, -4022, -4069, -4116, -4161, -4205, -4249, -4291, -4333, -4374, -4413, -4452, -4490, -4527, -4563, -4599, -4633, -4666, -4699, -4730, -4761, -4791, -4820, -4848, -4875, -4901, -4926, -4951, -4974, -4997, -5019, -5040, -5060, -5080, -5098, -5116, -5133, -5149, -5164, -5178, -5192, -5205, -5217, -5228, -5238, -5248, -5257, -5265, -5272, -5278, -5284, -5289, -5293, -5297, -5299, -5301, -5303, -5303, -5303, -5302, -5300, -5298, -5295, -5291, -5287, -5282, -5276, -5270, -5263, -5255, -5246, -5237, -5228, -5217, -5206, -5195, -5183, -5170, -5157, -5143, -5128, -5113, -5097, -5081, -5064, -5047, -5029, -5010, -4991, -4972, -4952, -4931, -4910, -4889, -4867, -4844, -4821, -4797, -4774, -4749, -4724, -4699, -4673, -4647, -4620, -4593, -4566, -4538, -4510, -4481, -4452, -4422, -4393, -4363, -4332, -4301, -4270, -4238, -4206, -4174, -4142, -4109, -4076, -4042, -4009, -3975, -3940, -3906, -3871, -3836, -3801, -3765, -3729, -3693, -3657, -3620, -3584, -3547, -3510, -3472, -3435, -3397, -3360, -3322, -3283, -3245, -3207, -3168, -3129, -3091, -3052, -3013, -2973, -2934, -2895, -2855, -2816, -2776, -2736, -2697, -2657, -2617, -2577, -2537, -2497, -2457, -2417, -2377, -2337, -2297, -2256, -2216, -2176, -2136, -2096, -2056, -2016, -1976, -1936, -1896, -1856, -1817, -1777, -1737, -1698, -1658, -1619, -1579, -1540, -1501, -1462, -1423, -1384, -1345, -1306, -1268, -1230, -1191, -1153, -1115, -1077, -1040, -1002, -965, -927, -890, -854, -817, -780, -744, -708, -672, -636, -600, -565, -530, -494, -460, -425, -391, -356, -322, -289, -255, -222, -189, -156, -123, -91, -59, -27, 4, 35, 66, 97, 127, 158, 188, 218, 247, 277, 306, 334, 363, 391, 419, 447, 474, 501, 528, 554, 581, 606, 632, 657, 683, 707, 732, 756, 780, 803, 827, 850, 872, 895, 917, 939, 960, 981, 1002, 1023, 1043, 1063, 1082, 1102, 1121, 1139, 1158, 1176, 1194, 1211, 1228, 1245, 1262, 1278, 1294, 1309, 1325, 1340, 1354, 1369, 1383, 1397, 1410, 1423, 1436, 1448, 1461, 1473, 1484, 1496, 1507, 1517, 1528, 1538, 1548, 1557, 1566, 1575, 1584, 1592, 1600, 1608, 1616, 1623, 1630, 1636, 1643, 1649, 1654, 1660, 1665, 1670, 1675, 1679, 1683, 1687, 1690, 1694, 1697, 1700, 1702, 1704, 1706, 1708, 1709, 1711, 1712, 1712, 1713, 1713, 1713, 1713, 1712, 1711, 1710, 1709, 1708, 1706, 1704, 1702, 1700, 1697, 1694, 1691, 1688, 1685, 1681, 1677, 1673, 1669, 1664, 1660, 1655, 1650, 1644, 1639, 1633, 1627, 1621, 1615, 1609, 1602, 1596, 1589, 1582, 1575, 1567, 1560, 1552, 1544, 1536, 1528, 1520, 1511, 1503, 1494, 1485, 1476, 1467, 1458, 1448, 1439, 1429, 1419, 1409, 1399, 1389, 1379, 1368, 1358, 1347, 1337, 1326, 1315, 1304, 1293, 1282, 1271, 1260, 1248, 1237, 1225, 1213, 1202, 1190, 1178, 1166, 1154, 1142, 1130, 1118, 1106, 1094, 1081, 1069, 1057, 1044, 1032, 1019, 1007, 994, 981, 969, 956, 943, 931, 918, 905, 892, 879, 867, 854, 841, 828, 815, 802, 790, 777, 764, 751, 738, 725, 713, 700, 687, 674, 662, 649, 636, 623, 611, 598, 585, 573, 560, 548, 535, 523, 510, 498, 486, 473, 461, 449, 437, 425, 413, 401, 389, 377, 365, 353, 341, 330, 318, 307, 295, 284, 272, 261, 250, 239, 228, 217, 206, 195, 184, 173, 163, 152, 141, 131, 121, 110, 100, 90, 80, 70, 60, 51, 41, 31, 22, 12, 3, -5, -14, -23, -32, -41, -50, -59, -67, -76, -84, -93, -101, -109, -117, -125, -133, -140, -148, -156, -163, -170, -178, -185, -192, -199, -206, -212, -219, -226, -232, -239, -245, -251, -257, -263, -269, -275, -280, -286, -291, -297, -302, -307, -312, -317, -322, -327, -332, -336, -341, -345, -349, -354, -358, -362, -366, -369, -373, -377, -380, -384, -387, -390, -394, -397, -400, -402, -405, -408, -411, -413, -416, -418, -420, -422, -424, -426, -428, -430, -432, -433, -435, -436, -438, -439, -440, -442, -443, -444, -445, -445, -446, -447, -447, -448, -448, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -449, -448, -448, -447, -447, -446, -445, -444, -443, -443, -442, -441, -440, -438, -437, -436, -435, -433, -432, -430, -429, -427, -426, -424, -422, -420, -419, -417, -415, -413, -411, -409, -407, -405, -403, -400, -398, -396, -393, -391, -389, -386, -384, -381, -379, -376, -374, -371, -368, -366, -363, -360, -357, -355, -352, -349, -346, -343, -340, -337, -334, -331, -328, -325, -322, -319, -316, -313, -310, -307, -304, -301, -298, -294, -291, -288, -285, -282, -278, -275, -272, -269, -265, -262, -259, -256, -252, -249, -246, -243, -239, -236, -233, -230, -226, -223, -220, -217, -213, -210, -207, -204, -200, -197, -194, -191, -187, -184, -181, -178, -175, -172, -168, -165, -162, -159, -156, -153, -150, -147, -143, -140, -137, -134, -131, -128, -125, -122, -120, -117, -114, -111, -108, -105, -102, -99, -97, -94, -91, -88, -86, -83, -80, -78, -75, -72, -70, -67, -65, -62, -59, -57, -55, -52, -50, -47, -45, -43, -40, -38, -36, -33, -31, -29, -27, -25, -22, -20, -18, -16, -14, -12, -10, -8, -6, -4, -2, 0, 0, 2, 4, 6, 8, 9, 11, 13, 14, 16, 17, 19, 21, 22, 24, 25, 27, 28, 29, 31, 32, 33, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 59, 60, 61, 62, 62, 63, 63, 64, 64, 65, 66, 66, 66, 67, 67, 68, 68, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 71, 71, 71, 71, 71, 70, 70, 70, 70, 69, 69, 69, 69, 68, 68, 68, 67, 67, 67, 66, 66, 66, 65, 65, 64, 64, 64, 63, 63, 62, 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 58, 57, 57, 56, 56, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51, 50, 50, 49, 48, 48, 47, 47, 46, 46, 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 40, 39, 39, 38, 38, 37, 37, 36, 36, 35, 35, 34, 34, 33, 33, 32, 32, 31, 31, 30, 30, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 23, 22, 22, 21, 21, 20, 20, 20, 19, 19, 18, 18, 17, 17, 17, 16, 16, 15, 15, 15, 14, 14, 14, 13, 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 9, 9, 9, 9, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; static short SMALL_FILTER_IMPD[] = { -1, -2, -4, -5, -6, -8, -10, -10, -13, -13, -16, -16, -18, -20, -21, -22, -24, -25, -27, -28, -30, -31, -32, -34, -35, -37, -38, -39, -41, -42, -44, -45, -46, -48, -49, -51, -52, -53, -55, -56, -57, -59, -60, -61, -63, -64, -65, -67, -68, -69, -71, -71, -74, -74, -76, -77, -78, -79, -81, -82, -83, -84, -86, -87, -88, -89, -90, -92, -92, -94, -95, -96, -98, -98, -100, -100, -102, -103, -104, -105, -106, -107, -108, -109, -111, -111, -112, -113, -115, -115, -116, -117, -119, -119, -120, -121, -121, -123, -124, -124, -126, -126, -127, -128, -129, -129, -131, -131, -132, -133, -133, -135, -135, -135, -137, -137, -138, -138, -140, -139, -141, -141, -142, -142, -143, -144, -144, -145, -145, -146, -146, -147, -148, -148, -148, -149, -149, -150, -150, -151, -151, -152, -151, -153, -152, -153, -154, -153, -154, -154, -155, -155, -155, -155, -156, -156, -156, -156, -157, -156, -157, -157, -157, -157, -158, -157, -158, -158, -157, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -157, -158, -158, -157, -158, -157, -158, -157, -157, -157, -156, -157, -156, -156, -156, -156, -155, -155, -155, -155, -154, -155, -153, -154, -153, -153, -152, -153, -151, -152, -151, -150, -151, -150, -149, -149, -149, -148, -147, -148, -146, -146, -146, -145, -145, -144, -144, -143, -143, -141, -142, -141, -140, -140, -139, -138, -138, -137, -137, -136, -135, -135, -134, -133, -132, -132, -132, -130, -130, -129, -128, -128, -127, -126, -125, -125, -124, -123, -122, -122, -121, -120, -119, -118, -118, -116, -116, -115, -115, -113, -113, -111, -111, -110, -109, -109, -107, -107, -105, -105, -104, -103, -102, -101, -101, -98, -99, -97, -97, -96, -94, -94, -93, -92, -92, -90, -89, -88, -88, -86, -86, -84, -84, -82, -82, -81, -80, -78, -78, -77, -76, -75, -74, -73, -72, -72, -70, -69, -68, -68, -66, -65, -65, -63, -63, -61, -61, -59, -59, -58, -56, -56, -55, -54, -53, -52, -51, -50, -49, -48, -47, -47, -45, -44, -44, -42, -42, -41, -39, -39, -38, -37, -36, -36, -34, -33, -33, -31, -31, -30, -29, -28, -27, -26, -25, -25, -23, -23, -22, -21, -20, -20, -18, -18, -17, -16, -15, -14, -14, -13, -12, -11, -10, -10, -9, -8, -7, -6, -6, -5, -4, -4, -2, -2, -2, 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9, 9, 11, 11, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 19, 19, 19, 20, 21, 21, 21, 22, 23, 23, 24, 23, 25, 25, 25, 26, 26, 27, 27, 27, 28, 28, 29, 29, 30, 29, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 34, 33, 34, 35, 34, 35, 35, 35, 36, 36, 36, 36, 37, 36, 37, 37, 38, 37, 38, 37, 38, 39, 38, 38, 39, 39, 38, 39, 39, 40, 39, 39, 40, 39, 40, 40, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 41, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 40, 40, 39, 40, 39, 40, 39, 39, 39, 39, 39, 39, 39, 38, 38, 39, 38, 38, 38, 37, 38, 37, 38, 37, 36, 37, 37, 36, 36, 36, 36, 36, 35, 35, 36, 34, 35, 34, 35, 34, 33, 34, 33, 33, 33, 33, 32, 32, 32, 31, 31, 31, 31, 30, 31, 30, 30, 29, 30, 29, 28, 29, 28, 28, 28, 27, 27, 27, 26, 27, 25, 26, 25, 26, 24, 25, 24, 24, 23, 24, 23, 22, 23, 22, 22, 21, 21, 21, 21, 20, 20, 19, 20, 19, 18, 19, 18, 18, 17, 17, 17, 17, 16, 16, 15, 16, 15, 14, 15, 14, 14, 13, 13, 13, 12, 13, 12, 11, 12, 11, 10, 11, 10, 10, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 6, 7, 6, 5, 6, 5, 5, 5, 4, 4, 4, 3, 4, 3, 3, 2, 2, 2, 2, 1, 2, 1, 0, 1, 0, 0, 0, -1, -1, -1, -1, -1, -2, -2, -2, -2, -3, -3, -3, -3, -3, -4, -4, -4, -4, -5, -4, -5, -5, -6, -5, -6, -6, -6, -6, -6, -7, -6, -7, -7, -7, -8, -7, -8, -8, -8, -8, -8, -9, -8, -9, -9, -9, -9, -9, -10, -9, -10, -10, -10, -10, -10, -10, -11, -10, -11, -10, -11, -11, -11, -11, -11, -11, -11, -12, -11, -12, -12, -11, -12, -12, -12, -12, -12, -12, -12, -12, -12, -13, -12, -12, -13, -12, -13, -12, -13, -13, -12, -13, -13, -12, -13, -13, -13, -13, -12, -13, -13, -13, -13, -13, -12, -13, -13, -13, -13, -13, -12, -13, -13, -13, -12, -13, -13, -13, -12, -13, -13, -12, -13, -12, -13, -12, -13, -12, -12, -13, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -11, -12, -11, -12, -11, -12, -11, -11, -11, -11, -11, -11, -11, -11, -11, -10, -11, -11, -10, -10, -11, -10, -10, -10, -10, -10, -9, -10, -10, -9, -10, -9, -8, -9, -9, -9, -9, -9, -9, -8, -9, -8, -9, -8, -8, -8, -8, -8, -7, -8, -8, -7, -7, -8, -7, -7, -7, -7, -6, -7, -7, -6, -7, -6, -6, -6, -6, -6, -6, -5, -6, -5, -6, -5, -5, -5, -5, -5, -5, -5, -4, -5, -4, -4, -5, -4, -4, -4, -3, -4, -4, -3, -4, -3, -3, -4, -3, -3, -2, -3, -3, -3, -2, -3, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -1, -2, -1, -1, -2, -1, -1, -1, 0, -1, -1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 2, 3, 3, 2, 2, 3, 2, 3, 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, -2, -4, -5, -6, -8, -10, -10, -13, -13, -16, -16, -18, -20, -21, -22, -24, -25, -27, -28, -30, -31, -32, -34, -35, -37, -38, -39, -41, -42, -44, -45, -46, -48, -49, -51, -52, -53, -55, -56, -57, -59, -60, -61, -63, -64, -65, -67, -68, -69, -71, -71, -74, -74, -76, -77, -78, -79, -81, -82, -83, -84, -86, -87, -88, -89, -90, -92, -92, -94, -95, -96, -98, -98, -100, -100, -102, -103, -104, -105, -106, -107, -108, -109, -111, -111, -112, -113, -115, -115, -116, -117, -119, -119, -120, -121, -121, -123, -124, -124, -126, -126, -127, -128, -129, -129, -131, -131, -132, -133, -133, -135, -135, -135, -137, -137, -138, -138, -140, -139, -141, -141, -142, -142, -143, -144, -144, -145, -145, -146, -146, -147, -148, -148, -148, -149, -149, -150, -150, -151, -151, -152, -151, -153, -152, -153, -154, -153, -154, -154, -155, -155, -155, -155, -156, -156, -156, -156, -157, -156, -157, -157, -157, -157, -158, -157, -158, -158, -157, -158, -158, -158, -158, -158, -158, -158, -158, -158, -158, -157, -158, -158, -157, -158, -157, -158, -157, -157, -157, -156, -157, -156, -156, -156, -156, -155, -155, -155, -155, -154, -155, -153, -154, -153, -153, -152, -153, -151, -152, -151, -150, -151, -150, -149, -149, -149, -148, -147, -148, -146, -146, -146, -145, -145, -144, -144, -143, -143, -141, -142, -141, -140, -140, -139, -138, -138, -137, -137, -136, -135, -135, -134, -133, -132, -132, -132, -130, -130, -129, -128, -128, -127, -126, -125, -125, -124, -123, -122, -122, -121, -120, -119, -118, -118, -116, -116, -115, -115, -113, -113, -111, -111, -110, -109, -109, -107, -107, -105, -105, -104, -103, -102, -101, -101, -98, -99, -97, -97, -96, -94, -94, -93, -92, -92, -90, -89, -88, -88, -86, -86, -84, -84, -82, -82, -81, -80, -78, -78, -77, -76, -75, -74, -73, -72, -72, -70, -69, -68, -68, -66, -65, -65, -63, -63, -61, -61, -59, -59, -58, -56, -56, -55, -54, -53, -52, -51, -50, -49, -48, -47, -47, -45, -44, -44, -42, -42, -41, -39, -39, -38, -37, -36, -36, -34, -33, -33, -31, -31, -30, -29, -28, -27, -26, -25, -25, -23, -23, -22, -21, -20, -20, -18, -18, -17, -16, -15, -14, -14, -13, -12, -11, -10, -10, -9, -8, -7, -6, -6, -5, -4, -4, -2, -2, -2, 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 9, 9, 11, 11, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 19, 19, 19, 20, 21, 21, 21, 22, 23, 23, 24, 23, 25, 25, 25, 26, 26, 27, 27, 27, 28, 28, 29, 29, 30, 29, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 34, 33, 34, 35, 34, 35, 35, 35, 36, 36, 36, 36, 37, 36, 37, 37, 38, 37, 38, 37, 38, 39, 38, 38, 39, 39, 38, 39, 39, 40, 39, 39, 40, 39, 40, 40, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 41, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 40, 40, 39, 40, 39, 40, 39, 39, 39, 39, 39, 39, 39, 38, 38, 39, 38, 38, 38, 37, 38, 37, 38, 37, 36, 37, 37, 36, 36, 36, 36, 36, 35, 35, 36, 34, 35, 34, 35, 34, 33, 34, 33, 33, 33, 33, 32, 32, 32, 31, 31, 31, 31, 30, 31, 30, 30, 29, 30, 29, 28, 29, 28, 28, 28, 27, 27, 27, 26, 27, 25, 26, 25, 26, 24, 25, 24, 24, 23, 24, 23, 22, 23, 22, 22, 21, 21, 21, 21, 20, 20, 19, 20, 19, 18, 19, 18, 18, 17, 17, 17, 17, 16, 16, 15, 16, 15, 14, 15, 14, 14, 13, 13, 13, 12, 13, 12, 11, 12, 11, 10, 11, 10, 10, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 6, 7, 6, 5, 6, 5, 5, 5, 4, 4, 4, 3, 4, 3, 3, 2, 2, 2, 2, 1, 2, 1, 0, 1, 0, 0, 0, -1, -1, -1, -1, -1, -2, -2, -2, -2, -3, -3, -3, -3, -3, -4, -4, -4, -4, -5, -4, -5, -5, -6, -5, -6, -6, -6, -6, -6, -7, -6, -7, -7, -7, -8, -7, -8, -8, -8, -8, -8, -9, -8, -9, -9, -9, -9, -9, -10, -9, -10, -10, -10, -10, -10, -10, -11, -10, -11, -10, -11, -11, -11, -11, -11, -11, -11, -12, -11, -12, -12, -11, -12, -12, -12, -12, -12, -12, -12, -12, -12, -13, -12, -12, -13, -12, -13, -12, -13, -13, -12, -13, -13, -12, -13, -13, -13, -13, -12, -13, -13, -13, -13, -13, -12, -13, -13, -13, -13, -13, -12, -13, -13, -13, -12, -13, -13, -13, -12, -13, -13, -12, -13, -12, -13, -12, -13, -12, -12, -13, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, -11, -12, -11, -12, -11, -12, -11, -11, -11, -11, -11, -11, -11, -11, -11, -10, -11, -11, -10, -10, -11, -10, -10, -10, -10, -10, -9, -10, -10, -9, -10, -9, -8, -9, -9, -9, -9, -9, -9, -8, -9, -8, -9, -8, -8, -8, -8, -8, -7, -8, -8, -7, -7, -8, -7, -7, -7, -7, -6, -7, -7, -6, -7, -6, -6, -6, -6, -6, -6, -5, -6, -5, -6, -5, -5, -5, -5, -5, -5, -5, -4, -5, -4, -4, -5, -4, -4, -4, -3, -4, -4, -3, -4, -3, -3, -4, -3, -3, -2, -3, -3, -3, -2, -3, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -1, -2, -1, -1, -2, -1, -1, -1, 0, -1, -1, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 3, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 2, 3, 3, 2, 2, 3, 2, 3, 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; darkice-1.0/src/FileSink.h0000644000175000001440000001771611371632310012346 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : FileSink.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef FILE_SINK_H #define FILE_SINK_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Reporter.h" #include "Sink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * File data output * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class FileSink : public Sink, public virtual Reporter { private: /** * The name of the configuration related to * this file sink. something like "file-0" or "file-2". */ char * configName; /** * Name of the file represented by the FileSink. */ char * fileName; /** * Initialize the object. * * @param configName the name of the configuration related to * this file sink. something like "file-0" or "file-2". * @param name name of the file to be represented by the object. * @exception Exception */ void init ( const char * configName, const char * name ) throw ( Exception ); /** * De-initialize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); /** * Get the file name to where to move the data saved so far. * Used in cut(). * * @return the file name where to move the data saved so far. * @throws Exception on file operation errors */ std::string getArchiveFileName( void ) throw ( Exception ); protected: /** * Low-level file descriptor for the file represented by this object. */ int fileDescriptor; /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline FileSink ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor by a file name. * * @param configName the name of the configuration related to * this file sink. something like "file-0" or "file-2". * @param name name of the file to be represented by the object. * @exception Exception */ inline FileSink( const char * configName, const char * name ) throw ( Exception ) { init( configName, name); } /** * Copy constructor. * * @param fsink the FileSink to copy. * @exception Exception */ FileSink( const FileSink & fsink ) throw ( Exception ); /** * Destructor. * * @exception Exception */ inline virtual ~FileSink( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param fs the FileSink to assign to this object. * @return a reference to this object. * @exception Exception */ virtual FileSink & operator= ( const FileSink & fs ) throw ( Exception ); /** * Get the file name this FileSink represents. * * @return the file name this FileSink represents. */ inline const char * getFileName ( void ) const throw () { return fileName; } /** * Check for the existence of the file this FileSink represents. * * @return true if the file exists and is a regular file, * false otherwise. */ virtual bool exists ( void ) const throw (); /** * Create the file. * * @return true if creation was successful, false otherwise. * @exception Exception */ virtual bool create ( void ) throw ( Exception ); /** * Open the file. Truncates the file. * * @return true if opening was successful, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the FileSink is open. * * @return true if the FileSink is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return fileDescriptor != 0; } /** * Check if the FileSink is ready to accept data. * Blocks until the specified time for data to be available. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the Sink is ready to accept data, false otherwise. * @exception Exception */ virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Write data to the FileSink. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * This is a no-op in this FileSink. * * @exception Exception */ inline virtual void flush ( void ) throw ( Exception ) { } /** * Cut what the sink has been doing so far, and start anew. * This usually means separating the data sent to the sink up * until now, and start saving a new chunk of data. */ virtual void cut ( void ) throw (); /** * Close the FileSink. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* FILE_SINK_H */ darkice-1.0/src/Util.cpp0000644000175000001440000003715611371632310012112 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Util.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_STDLIB_H #include #else #error need stdlib.h #endif #ifdef HAVE_LIMITS_H #include #else #error need limits.h #endif #ifdef HAVE_MATH_H #include #else #error need math.h #endif #ifdef HAVE_TIME_H #include #else #error need time.h #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_SYS_TIME_H #include #else #error need sys/time.h #endif #ifdef HAVE_SIGNAL_H #include #else #error need signal.h #endif #include "Util.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: Util.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ char Util :: base64Table[] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f', 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' }; /*------------------------------------------------------------------------------ * Calculate the length of a zero-terminated C string, * w/o the zero-termination *----------------------------------------------------------------------------*/ unsigned int Util :: strLen( const char * str ) throw ( Exception ) { size_t len; if ( !str ) { throw Exception( __FILE__, __LINE__, "no str"); } len = strlen( str); return len; } /*------------------------------------------------------------------------------ * Copy the contents of a string into another *----------------------------------------------------------------------------*/ void Util :: strCpy ( char * dest, const char * src ) throw ( Exception ) { if ( !dest || !src ) { throw Exception( __FILE__, __LINE__, "no src or dest"); } strcpy( dest, src); } /*------------------------------------------------------------------------------ * Concatenate the contents of a string onto another *----------------------------------------------------------------------------*/ void Util :: strCat ( char * dest, const char * src ) throw ( Exception ) { if ( !dest || !src ) { throw Exception( __FILE__, __LINE__, "no src or dest"); } strcat( dest, src); } /*------------------------------------------------------------------------------ * Duplicate a string by allocating space with new[] * The returned string must be freed with delete[] *----------------------------------------------------------------------------*/ char * Util :: strDup( const char * str ) throw ( Exception ) { size_t len; char * s; if ( !str ) { throw Exception( __FILE__, __LINE__, "no str"); } len = strlen( str) + 1; s = new char[len]; memcpy( s, str, len); return s; } /*------------------------------------------------------------------------------ * Convert a string into base64 encoding. *----------------------------------------------------------------------------*/ char * Util :: base64Encode( const char * str ) throw ( Exception ) { if ( !str ) { throw Exception( __FILE__, __LINE__, "no str"); } const char * data = str; size_t len = strlen( data); char * out = new char[len * 4 / 3 + 4]; char * result = out; unsigned chunk; while ( len > 0 ) { chunk = (len > 3) ? 3 : len; *out++ = base64Table[(*data & 0xfc) >> 2]; *out++ = base64Table[((*data & 0x03) << 4) | ((*(data+1) & 0xf0) >> 4)]; switch ( chunk ) { case 3: *out++ = base64Table[((*(data+1) & 0x0f) << 2) | ((*(data+2) & 0xc0) >> 6)]; *out++ = base64Table[(*(data+2)) & 0x3f]; break; case 2: *out++ = base64Table[((*(data+1) & 0x0f) << 2)]; *out++ = '='; break; case 1: *out++ = '='; *out++ = '='; break; } data += chunk; len -= chunk; } *out = 0; return result; } /*------------------------------------------------------------------------------ * Check wether two strings are equal *----------------------------------------------------------------------------*/ bool Util :: strEq( const char * str1, const char * str2, unsigned int len ) throw ( Exception ) { if ( !str1 || !str2 ) { throw Exception( __FILE__, __LINE__, "no str1 or no str2"); } return len == 0 ? !strcmp( str1, str2) : !strncmp( str1, str2, len); } /*------------------------------------------------------------------------------ * Convert a string to a long integer *----------------------------------------------------------------------------*/ long int Util :: strToL( const char * str, int base ) throw ( Exception ) { long int val; char * s; if ( !str ) { throw Exception( __FILE__, __LINE__, "no str"); } val = strtol( str, &s, base); if ( s == str || val == LONG_MIN || val == LONG_MAX ) { throw Exception( __FILE__, __LINE__, "number conversion error"); } return val; } /*------------------------------------------------------------------------------ * Convert a string to a double *----------------------------------------------------------------------------*/ double Util :: strToD( const char * str ) throw ( Exception ) { double val; char * s; if ( !str ) { throw Exception( __FILE__, __LINE__, "no str"); } val = strtod( str, &s); if ( s == str || val == HUGE_VAL ) { throw Exception( __FILE__, __LINE__, "number conversion error"); } return val; } /*------------------------------------------------------------------------------ * add current date to a file name, before the file extension (if any) *----------------------------------------------------------------------------*/ char * Util :: fileAddDate ( const char * str, const char * format ) throw ( Exception ) { unsigned int size; const char * last; char * s; char * strdate; time_t now; if ( !str ) { throw Exception( __FILE__, __LINE__, "no str"); } strdate = new char[128]; now = time(NULL); strftime( strdate, 128, format, localtime (&now)); // search for the part before the extension of the file name if ( !(last = strrchr( str, '.')) ) { last = (char *) str + strlen( str); } size = strlen( str) + strlen( strdate) + 1; s = new char [size]; memcpy( s, str, strlen (str)-strlen(last)); memcpy( s + strlen(str) - strlen(last), strdate, strlen (strdate)); memcpy( s + strlen(str) - strlen(last) + strlen(strdate), last, strlen(last)); s[size-1] = '\0'; delete[] strdate; return s; } /*------------------------------------------------------------------------------ * Convert an unsigned char buffer holding 8 or 16 bit PCM values with * channels interleaved to a short int buffer, still with channels interleaved *----------------------------------------------------------------------------*/ void Util :: conv ( unsigned int bitsPerSample, unsigned char * pcmBuffer, unsigned int lenPcmBuffer, short int * outBuffer, bool isBigEndian ) throw ( Exception ) { if ( bitsPerSample == 8 ) { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { outBuffer[j] = pcmBuffer[i++]; ++j; } } else if ( bitsPerSample == 16 ) { if ( isBigEndian ) { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { short int value; value = pcmBuffer[i++] << 8; value |= pcmBuffer[i++]; outBuffer[j] = value; ++j; } } else { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { short int value; value = pcmBuffer[i++]; value |= pcmBuffer[i++] << 8; outBuffer[j] = value; ++j; } } } else { throw Exception( __FILE__, __LINE__, "this number of bits per sample not supported", bitsPerSample); } } /*------------------------------------------------------------------------------ * Convert a short buffer holding PCM values with channels interleaved * to one or more float buffers, one for each channel *----------------------------------------------------------------------------*/ void Util :: conv ( short int * shortBuffer, unsigned int lenShortBuffer, float ** floatBuffers, unsigned int channels ) throw ( Exception ) { unsigned int i, j; for ( i = 0, j = 0; i < lenShortBuffer; ) { for ( unsigned int c = 0; c < channels; ++c ) { floatBuffers[c][j] = ((float) shortBuffer[i++]) / 32768.f; } ++j; } } /*------------------------------------------------------------------------------ * Convert an unsigned char buffer holding 8 bit PCM values with channels * interleaved to two short int buffers (one for each channel) *----------------------------------------------------------------------------*/ void Util :: conv8 ( unsigned char * pcmBuffer, unsigned int lenPcmBuffer, short int * leftBuffer, short int * rightBuffer, unsigned int channels ) throw ( Exception ) { if ( channels == 1 ) { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { unsigned short int value; value = pcmBuffer[i++]; leftBuffer[j] = (short int) value; ++j; } } else if ( channels == 2 ) { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { unsigned short int value; value = pcmBuffer[i++]; leftBuffer[j] = (short int) value; value = pcmBuffer[i++]; rightBuffer[j] = (short int) value; ++j; } } else { throw Exception( __FILE__, __LINE__, "this number of channels not supported", channels); } } /*------------------------------------------------------------------------------ * Convert an unsigned char buffer holding 16 bit PCM values with channels * interleaved to two short int buffers (one for each channel) *----------------------------------------------------------------------------*/ void Util :: conv16 ( unsigned char * pcmBuffer, unsigned int lenPcmBuffer, short int * leftBuffer, short int * rightBuffer, unsigned int channels, bool isBigEndian ) throw ( Exception ) { if ( isBigEndian ) { if ( channels == 1 ) { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { unsigned short int value; value = pcmBuffer[i++] << 8; value |= pcmBuffer[i++]; leftBuffer[j] = (short int) value; ++j; } } else { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { unsigned short int value; value = pcmBuffer[i++] << 8; value |= pcmBuffer[i++]; leftBuffer[j] = (short int) value; value = pcmBuffer[i++] << 8; value |= pcmBuffer[i++]; rightBuffer[j] = (short int) value; ++j; } } } else { if ( channels == 1 ) { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { unsigned short int value; value = pcmBuffer[i++]; value |= pcmBuffer[i++] << 8; leftBuffer[j] = (short int) value; ++j; } } else { unsigned int i, j; for ( i = 0, j = 0; i < lenPcmBuffer; ) { unsigned short int value; value = pcmBuffer[i++]; value |= pcmBuffer[i++] << 8; leftBuffer[j] = (short int) value; value = pcmBuffer[i++]; value |= pcmBuffer[i++] << 8; rightBuffer[j] = (short int) value; ++j; } } } } /*------------------------------------------------------------------------------ * Make a thread sleep for a specified amount of time. *----------------------------------------------------------------------------*/ void Util :: sleep ( long sec, long nsec) { struct timespec timespec; sigset_t sigset; timespec.tv_sec = sec; timespec.tv_nsec = nsec; // mask out SIGUSR1, as we're expecting that signal for other reasons sigemptyset(&sigset); sigaddset(&sigset, SIGUSR1); pselect( 0, NULL, NULL, NULL, ×pec, &sigset); } darkice-1.0/src/LameLibEncoder.cpp0000644000175000001440000003142111371632310013767 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : LameLibEncoder.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif // compile the whole file only if lame support configured in #ifdef HAVE_LAME_LIB #include "Exception.h" #include "Util.h" #include "LameLibEncoder.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: LameLibEncoder.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Open an encoding session *----------------------------------------------------------------------------*/ bool LameLibEncoder :: open ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } // open the underlying sink if ( !getSink()->open() ) { throw Exception( __FILE__, __LINE__, "lame lib opening underlying sink error"); } lameGlobalFlags = lame_init(); // ugly lame returns -1 in a pointer on allocation errors // this is cast to (long int) so that the pointer can be handled // on 64 bit systems as well if ( !lameGlobalFlags || ((long int)lameGlobalFlags) == -1 ) { throw Exception( __FILE__, __LINE__, "lame lib init error", (long int) lameGlobalFlags); } if ( 0 > lame_set_num_channels( lameGlobalFlags, getInChannel()) ) { throw Exception( __FILE__, __LINE__, "lame lib setting channels error", getInChannel() ); } if ( 0 > lame_set_mode( lameGlobalFlags, getOutChannel() == 1 ? MONO : JOINT_STEREO) ) { throw Exception( __FILE__, __LINE__, "lame lib setting mode error", JOINT_STEREO ); } reportEvent( 5, "set lame mode", lame_get_mode( lameGlobalFlags)); reportEvent( 5, "set lame channels", lame_get_num_channels( lameGlobalFlags)); if ( 0 > lame_set_in_samplerate( lameGlobalFlags, getInSampleRate()) ) { throw Exception( __FILE__, __LINE__, "lame lib setting input sample rate error", getInSampleRate() ); } reportEvent( 5, "set lame in sample rate", lame_get_in_samplerate( lameGlobalFlags)); if ( 0 > lame_set_out_samplerate( lameGlobalFlags, getOutSampleRate()) ) { throw Exception( __FILE__, __LINE__, "lame lib setting output sample rate error", getOutSampleRate() ); } reportEvent( 5, "set lame out sample rate", lame_get_out_samplerate( lameGlobalFlags)); switch ( getOutBitrateMode() ) { case cbr: { if ( 0 > lame_set_brate( lameGlobalFlags, getOutBitrate()) ) { throw Exception( __FILE__, __LINE__, "lame lib setting output bit rate error", getOutBitrate() ); } reportEvent( 5, "set lame bit rate", lame_get_brate( lameGlobalFlags)); double d = (1.0 - getOutQuality()) * 10.0; if ( d > 9 ) { d = 9; } int q = int (d); if ( 0 > lame_set_quality( lameGlobalFlags, q) ) { throw Exception( __FILE__, __LINE__, "lame lib setting quality error", q); } reportEvent( 5, "set lame quality", lame_get_quality( lameGlobalFlags)); } break; case abr: if ( 0 > lame_set_VBR( lameGlobalFlags,vbr_abr)) { throw Exception( __FILE__, __LINE__, "lame lib setting abr error", vbr_abr); } reportEvent( 5, "set lame abr bitrate", lame_get_VBR( lameGlobalFlags)); if ( 0 > lame_set_VBR_mean_bitrate_kbps( lameGlobalFlags, getOutBitrate())) { throw Exception( __FILE__, __LINE__, "lame lib setting abr mean bitrate error", getOutBitrate()); } reportEvent( 5, "set lame abr mean bitrate", lame_get_VBR_mean_bitrate_kbps( lameGlobalFlags)); break; case vbr: { if ( 0 > lame_set_VBR( lameGlobalFlags, vbr_mtrh)) { throw Exception( __FILE__, __LINE__, "lame lib setting vbr error", vbr_mtrh ); } reportEvent( 5, "set lame vbr bitrate", lame_get_VBR( lameGlobalFlags)); double d = (1.0 - getOutQuality()) * 10.0; if ( d > 9 ) { d = 9; } int q = int (d); if ( 0 > lame_set_VBR_q( lameGlobalFlags, q) ) { throw Exception( __FILE__, __LINE__, "lame lib setting vbr quality error", q); } reportEvent( 5, "set lame vbr quality", lame_get_VBR_q( lameGlobalFlags)); } break; } if ( 0 > lame_set_lowpassfreq( lameGlobalFlags, lowpass) ) { throw Exception( __FILE__, __LINE__, "lame lib setting lowpass frequency error", lowpass ); } reportEvent( 5, "set lame lowpass frequency", lame_get_lowpassfreq( lameGlobalFlags)); if ( 0 > lame_set_highpassfreq( lameGlobalFlags, highpass) ) { throw Exception( __FILE__, __LINE__, "lame lib setting highpass frequency error", lowpass ); } reportEvent( 5, "set lame highpass frequency", lame_get_highpassfreq( lameGlobalFlags)); // not configurable lame settings if ( 0 > lame_set_exp_nspsytune( lameGlobalFlags, 1) ) { throw Exception( __FILE__, __LINE__, "lame lib setting psycho acoustic model error"); } reportEvent( 5, "set lame psycho acoustic model", lame_get_exp_nspsytune( lameGlobalFlags)); if ( 0 > lame_set_error_protection( lameGlobalFlags, 1) ) { throw Exception( __FILE__, __LINE__, "lame lib setting error protection error", 1 ); } reportEvent( 5, "set lame error protection", lame_get_error_protection( lameGlobalFlags)); // let lame init its own params based on our settings if ( 0 > lame_init_params( lameGlobalFlags) ) { throw Exception( __FILE__, __LINE__, "lame lib initializing params error" ); } if (getReportVerbosity() >= 3) { lame_print_config( lameGlobalFlags); } return true; } /*------------------------------------------------------------------------------ * Write data to the encoder *----------------------------------------------------------------------------*/ unsigned int LameLibEncoder :: write ( const void * buf, unsigned int len ) throw ( Exception ) { if ( !isOpen() || len == 0 ) { return 0; } unsigned int bitsPerSample = getInBitsPerSample(); unsigned int inChannels = getInChannel(); unsigned int sampleSize = (bitsPerSample / 8) * inChannels; unsigned char * b = (unsigned char*) buf; unsigned int processed = len - (len % sampleSize); unsigned int nSamples = processed / sampleSize; short int * leftBuffer = new short int[nSamples]; short int * rightBuffer = new short int[nSamples]; if ( bitsPerSample == 8 ) { Util::conv8( b, processed, leftBuffer, rightBuffer, inChannels); } else if ( bitsPerSample == 16 ) { Util::conv16( b, processed, leftBuffer, rightBuffer, inChannels, isInBigEndian()); } else { delete[] leftBuffer; delete[] rightBuffer; throw Exception( __FILE__, __LINE__, "unsupported number of bits per sample for the encoder", bitsPerSample ); } // data chunk size estimate according to lame documentation // NOTE: mp3Size is calculated based on the number of input channels // which may be bigger than need, as output channels can be less unsigned int mp3Size = (unsigned int) (1.25 * nSamples + 7200); unsigned char * mp3Buf = new unsigned char[mp3Size]; int ret; ret = lame_encode_buffer( lameGlobalFlags, leftBuffer, inChannels == 2 ? rightBuffer : leftBuffer, nSamples, mp3Buf, mp3Size ); delete[] leftBuffer; delete[] rightBuffer; if ( ret < 0 ) { reportEvent( 3, "lame encoding error", ret); delete[] mp3Buf; return 0; } unsigned int written = getSink()->write( mp3Buf, ret); delete[] mp3Buf; // just let go data that could not be written if ( written < (unsigned int) ret ) { reportEvent( 2, "couldn't write all from encoder to underlying sink", ret - written); } return processed; } /*------------------------------------------------------------------------------ * Flush the data from the encoder *----------------------------------------------------------------------------*/ void LameLibEncoder :: flush ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } // data chunk size estimate according to lame documentation unsigned int mp3Size = 7200; unsigned char * mp3Buf = new unsigned char[mp3Size]; int ret; ret = lame_encode_flush( lameGlobalFlags, mp3Buf, mp3Size ); unsigned int written = getSink()->write( mp3Buf, ret); delete[] mp3Buf; // just let go data that could not be written if ( written < (unsigned int) ret ) { reportEvent( 2, "couldn't write all from encoder to underlying sink", ret - written); } getSink()->flush(); } /*------------------------------------------------------------------------------ * Close the encoding session *----------------------------------------------------------------------------*/ void LameLibEncoder :: close ( void ) throw ( Exception ) { if ( isOpen() ) { flush(); lame_close( lameGlobalFlags); lameGlobalFlags = 0; getSink()->close(); } } #endif // HAVE_LAME_LIB darkice-1.0/src/Connector.cpp0000644000175000001440000002275011371632310013121 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Connector.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include "Exception.h" #include "Connector.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: Connector.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void Connector :: init ( Source * source ) throw ( Exception ) { this->source = source; this->sinks = 0; this->numSinks = 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void Connector :: strip ( void ) throw ( Exception ) { source = 0; if ( sinks ) { unsigned int u; for ( u = 0; u < numSinks; ++u ) { sinks[u] = 0; } delete[] sinks; } } /*------------------------------------------------------------------------------ * Constructor *----------------------------------------------------------------------------*/ Connector :: Connector ( const Connector & connector ) throw ( Exception ) { unsigned int u; init( connector.source.get()); for ( u = 0; u < connector.numSinks; ++u ) { attach( connector.sinks[u].get() ); } } /*------------------------------------------------------------------------------ * Assignment operator *----------------------------------------------------------------------------*/ Connector & Connector :: operator= ( const Connector & connector ) throw ( Exception ) { if ( this != &connector ) { unsigned int u; // first free everything strip(); // then fill in init( connector.source.get() ); for ( u = 0; u < connector.numSinks; ++u ) { attach( connector.sinks[u].get() ); } } return *this; } /*------------------------------------------------------------------------------ * Attach a sink to the connector *----------------------------------------------------------------------------*/ void Connector :: attach ( Sink * sink ) throw ( Exception ) { if ( !sinks ) { numSinks = 1; sinks = new Ref[1]; sinks[0] = sink; } else { unsigned int u; Ref * s = new Ref[numSinks + 1]; for ( u = 0; u < numSinks; ++u ) { s[u] = sinks[u].get(); } s[numSinks] = sink; delete[] sinks; sinks = s; ++numSinks; } } /*------------------------------------------------------------------------------ * Detach a sink to the connector *----------------------------------------------------------------------------*/ bool Connector :: detach ( Sink * sink ) throw ( Exception ) { if ( numSinks == 0 ) { return false; } else if ( numSinks == 1 ) { if ( sinks[0].get() != sink ) { return false; } sinks[0] = 0; delete[] sinks; sinks = 0; --numSinks; return true; } else { unsigned int u; unsigned int v; unsigned int ix; Ref * s; ix = numSinks; for ( u = 0; u < numSinks; ++u ) { if ( sinks[u].get() == sink ) { ix = u; break; } } if ( ix == numSinks ) { return false; } s = new Ref[numSinks - 1]; for ( u = 0, v = 0; u < numSinks; ++u ) { if ( u != ix ) { s[v++] = sinks[u]; } } sinks[ix] = 0; delete[] sinks; sinks = s; --numSinks; return true; } } /*------------------------------------------------------------------------------ * Open the source and all the sinks if needed *----------------------------------------------------------------------------*/ bool Connector :: open ( void ) throw ( Exception ) { unsigned int u; if ( !source->isOpen() ) { if ( !source->open() ) { return false; } } for ( u = 0; u < numSinks; ++u ) { if ( !sinks[u]->isOpen() ) { if ( !sinks[u]->open() ) { break; } } } // if not all could be opened, close those that were if ( u < numSinks ) { unsigned int v; for ( v = 0; v < u; ++v ) { sinks[v]->close(); } source->close(); return false; } return true; } /*------------------------------------------------------------------------------ * Transfer some data from the source to the sink *----------------------------------------------------------------------------*/ unsigned int Connector :: transfer ( unsigned long bytes, unsigned int bufSize, unsigned int sec, unsigned int usec ) throw ( Exception ) { unsigned int u; unsigned long b; if ( numSinks == 0 ) { return 0; } if ( bufSize == 0 ) { return 0; } unsigned char * buf = new unsigned char[bufSize]; reportEvent( 6, "Connector :: tranfer, bytes", bytes); for ( b = 0; !bytes || b < bytes; ) { unsigned int d = 0; unsigned int e = 0; if ( source->canRead( sec, usec) ) { d = source->read( buf, bufSize); // check for EOF if ( d == 0 ) { reportEvent( 3, "Connector :: transfer, EOF"); break; } for ( u = 0; u < numSinks; ++u ) { if ( sinks[u]->canWrite( sec, usec) ) { try { // we expect the sink to accept all data written e = sinks[u]->write( buf, d); } catch ( Exception & e ) { sinks[u]->close(); detach( sinks[u].get() ); reportEvent( 4, "Connector :: transfer, sink removed, remaining", numSinks); if ( numSinks == 0 ) { reportEvent( 4, "Connector :: transfer, no more sinks"); delete[] buf; return b; } // with the call to detach, numSinks gets 1 lower, // and the next sink comes to sinks[u] --u; } } } b += d; } else { reportEvent( 3, "Connector :: transfer, can't read"); break; } } delete[] buf; return b; } /*------------------------------------------------------------------------------ * Signal to each sink to cut what they've done so far, and start anew. *----------------------------------------------------------------------------*/ void Connector :: cut ( void ) throw () { unsigned int u; for ( u = 0; u < numSinks; ++u ) { if ( sinks[u]->isOpen() ) { sinks[u]->cut(); } } } /*------------------------------------------------------------------------------ * Close the source and all the sinks if needed *----------------------------------------------------------------------------*/ void Connector :: close ( void ) throw ( Exception ) { unsigned int u; source->close(); for ( u = 0; u < numSinks; ++u ) { sinks[u]->close(); } } darkice-1.0/src/VorbisLibEncoder.cpp0000644000175000001440000003704411371632310014364 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : VorbisLibEncoder.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif // compile only if configured for Ogg Vorbis #ifdef HAVE_VORBIS_LIB #include "Exception.h" #include "Util.h" #include "VorbisLibEncoder.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: VorbisLibEncoder.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the encoder *----------------------------------------------------------------------------*/ void VorbisLibEncoder :: init ( unsigned int outMaxBitrate ) throw ( Exception ) { this->outMaxBitrate = outMaxBitrate; if ( getInBitsPerSample() != 16 && getInBitsPerSample() != 8 ) { throw Exception( __FILE__, __LINE__, "specified bits per sample not supported", getInBitsPerSample() ); } if ( getInChannel() != 1 && getInChannel() != 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of channels for the encoder", getInChannel() ); } if ( getOutSampleRate() == getInSampleRate() ) { resampleRatio = 1; converter = 0; } else { resampleRatio = ( (double) getOutSampleRate() / (double) getInSampleRate() ); // Determine if we can use linear interpolation. // The inverse of the ratio must be a power of two for linear mode to // be of sufficient quality. bool useLinear = true; double inverse = 1 / resampleRatio; int integer = (int) inverse; // Check that the inverse of the ratio is an integer if( integer == inverse ) { while( useLinear && integer ) { // Loop through the bits // If the lowest order bit is not the only one set if( integer & 1 && integer != 1 ) { // Not a power of two; cannot use linear useLinear = false; } else { // Shift all the bits over and try again integer >>= 1; } } } else { useLinear = false; } // If we get here and useLinear is still true, then we have // a power of two. // open the aflibConverter in // - high quality // - linear or quadratic (non-linear) based on algorithm // - not filter interpolation #ifdef HAVE_SRC_LIB int srcError = 0; converter = src_new(useLinear == true ? SRC_LINEAR : SRC_SINC_FASTEST, getInChannel(), &srcError); if(srcError) throw Exception (__FILE__, __LINE__, "libsamplerate error: ", src_strerror (srcError)); #else converter = new aflibConverter( true, useLinear, false); #endif } encoderOpen = false; } /*------------------------------------------------------------------------------ * Open an encoding session *----------------------------------------------------------------------------*/ bool VorbisLibEncoder :: open ( void ) throw ( Exception ) { int ret; if ( isOpen() ) { close(); } // open the underlying sink if ( !getSink()->open() ) { throw Exception( __FILE__, __LINE__, "vorbis lib opening underlying sink error"); } vorbis_info_init( &vorbisInfo); switch ( getOutBitrateMode() ) { case cbr: { int maxBitrate = getOutMaxBitrate() * 1000; if ( !maxBitrate ) { maxBitrate = -1; } if ( (ret = vorbis_encode_init( &vorbisInfo, getOutChannel(), getOutSampleRate(), maxBitrate, getOutBitrate() * 1000, -1)) ) { throw Exception( __FILE__, __LINE__, "vorbis encode init error", ret); } } break; case abr: /* set non-managed VBR around the average bitrate */ ret = vorbis_encode_setup_managed( &vorbisInfo, getOutChannel(), getOutSampleRate(), -1, getOutBitrate() * 1000, -1 ) || vorbis_encode_ctl( &vorbisInfo, OV_ECTL_RATEMANAGE_SET, NULL) || vorbis_encode_setup_init( &vorbisInfo); if ( ret ) { throw Exception( __FILE__, __LINE__, "vorbis encode init error", ret); } break; case vbr: if ( (ret = vorbis_encode_init_vbr( &vorbisInfo, getOutChannel(), getOutSampleRate(), getOutQuality() )) ) { throw Exception( __FILE__, __LINE__, "vorbis encode init error", ret); } break; } if ( (ret = vorbis_analysis_init( &vorbisDspState, &vorbisInfo)) ) { throw Exception( __FILE__, __LINE__, "vorbis analysis init error", ret); } if ( (ret = vorbis_block_init( &vorbisDspState, &vorbisBlock)) ) { throw Exception( __FILE__, __LINE__, "vorbis block init error", ret); } if ( (ret = ogg_stream_init( &oggStreamState, 0)) ) { throw Exception( __FILE__, __LINE__, "ogg stream init error", ret); } // create an empty vorbis_comment structure vorbis_comment_init( &vorbisComment); /* FIXME: removed title metadata when the sink type was changed from * CastSink to the more generic Sink. * make sure to add metadata somehow // Add comment to vorbis headers to show title in players // stupid cast to (char*) because of stupid vorbis API if ( getSink()->getName() ) { vorbis_comment_add_tag(&vorbisComment, "TITLE", (char*) getSink()->getName()); } */ // create the vorbis stream headers and send them to the underlying sink ogg_packet header; ogg_packet commentHeader; ogg_packet codeHeader; if ( (ret = vorbis_analysis_headerout( &vorbisDspState, &vorbisComment, &header, &commentHeader, &codeHeader )) ) { throw Exception( __FILE__, __LINE__, "vorbis header init error", ret); } ogg_stream_packetin( &oggStreamState, &header); ogg_stream_packetin( &oggStreamState, &commentHeader); ogg_stream_packetin( &oggStreamState, &codeHeader); ogg_page oggPage; while ( ogg_stream_flush( &oggStreamState, &oggPage) ) { getSink()->write( oggPage.header, oggPage.header_len); getSink()->write( oggPage.body, oggPage.body_len); } vorbis_comment_clear( &vorbisComment ); // initialize the resampling coverter if needed if ( converter ) { #ifdef HAVE_SRC_LIB converterData.input_frames = 4096/((getInBitsPerSample() / 8) * getInChannel()); converterData.data_in = new float[converterData.input_frames*getInChannel()]; converterData.output_frames = (int) (converterData.input_frames * resampleRatio + 1); converterData.data_out = new float[getInChannel() * converterData.output_frames]; converterData.src_ratio = resampleRatio; converterData.end_of_input = 0; #else converter->initialize( resampleRatio, getInChannel()); #endif } encoderOpen = true; return true; } /*------------------------------------------------------------------------------ * Write data to the encoder *----------------------------------------------------------------------------*/ unsigned int VorbisLibEncoder :: write ( const void * buf, unsigned int len ) throw ( Exception ) { if ( !isOpen() || len == 0 ) { return 0; } unsigned int channels = getInChannel(); unsigned int bitsPerSample = getInBitsPerSample(); unsigned int sampleSize = (bitsPerSample / 8) * channels; unsigned int i; if ( getInChannel() == 2 && getOutChannel() == 1 ) { for ( i = 0; i < len/sampleSize; i++) { if ( bitsPerSample == 8 ) { char * buf8 = (char *) buf; unsigned int ix = sampleSize * i; unsigned int iix = ix; buf8[i] = (buf8[ix] + buf8[++iix]) / 2; } if ( bitsPerSample == 16 ) { short * buf16 = (short *) buf; unsigned int ix = (bitsPerSample >> 3) * i; unsigned int iix = ix; buf16[i] = (buf16[ix] + buf16[++iix]) / 2; } } len >>= 1; channels = 1; } sampleSize = (bitsPerSample / 8) * channels; unsigned char * b = (unsigned char*) buf; unsigned int processed = len - (len % sampleSize); unsigned int nSamples = processed / sampleSize; float ** vorbisBuffer; // convert the byte-based raw input into a short buffer // with channels still interleaved unsigned int totalSamples = nSamples * channels; short int * shortBuffer = new short int[totalSamples]; Util::conv( bitsPerSample, b, processed, shortBuffer, isInBigEndian()); if ( converter ) { // resample if needed int inCount = nSamples; int outCount = (int) (inCount * resampleRatio); short int * resampledBuffer = new short int[(outCount+1)* channels]; int converted; #ifdef HAVE_SRC_LIB converterData.input_frames = nSamples; src_short_to_float_array (shortBuffer, converterData.data_in, totalSamples); int srcError = src_process (converter, &converterData); if (srcError) throw Exception (__FILE__, __LINE__, "libsamplerate error: ", src_strerror (srcError)); converted = converterData.output_frames_gen; src_float_to_short_array(converterData.data_out, resampledBuffer, converted*channels); #else converted = converter->resample( inCount, outCount, shortBuffer, resampledBuffer ); #endif vorbisBuffer = vorbis_analysis_buffer( &vorbisDspState, converted); Util::conv( resampledBuffer, converted * channels, vorbisBuffer, channels); delete[] resampledBuffer; vorbis_analysis_wrote( &vorbisDspState, converted); } else { vorbisBuffer = vorbis_analysis_buffer( &vorbisDspState, nSamples); Util::conv( shortBuffer, totalSamples, vorbisBuffer, channels); vorbis_analysis_wrote( &vorbisDspState, nSamples); } delete[] shortBuffer; vorbisBlocksOut(); return processed; } /*------------------------------------------------------------------------------ * Flush the data from the encoder *----------------------------------------------------------------------------*/ void VorbisLibEncoder :: flush ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } vorbis_analysis_wrote( &vorbisDspState, 0); vorbisBlocksOut(); getSink()->flush(); } /*------------------------------------------------------------------------------ * Send pending Vorbis blocks to the underlying stream *----------------------------------------------------------------------------*/ void VorbisLibEncoder :: vorbisBlocksOut ( void ) throw ( Exception ) { while ( 1 == vorbis_analysis_blockout( &vorbisDspState, &vorbisBlock) ) { ogg_packet oggPacket; ogg_page oggPage; vorbis_analysis( &vorbisBlock, &oggPacket); vorbis_bitrate_addblock( &vorbisBlock); while ( vorbis_bitrate_flushpacket( &vorbisDspState, &oggPacket) ) { ogg_stream_packetin( &oggStreamState, &oggPacket); while ( ogg_stream_pageout( &oggStreamState, &oggPage) ) { int written; written = getSink()->write(oggPage.header, oggPage.header_len); written += getSink()->write( oggPage.body, oggPage.body_len); if ( written < oggPage.header_len + oggPage.body_len ) { // just let go data that could not be written reportEvent( 2, "couldn't write full vorbis data to underlying sink", oggPage.header_len + oggPage.body_len - written); } } } } } /*------------------------------------------------------------------------------ * Close the encoding session *----------------------------------------------------------------------------*/ void VorbisLibEncoder :: close ( void ) throw ( Exception ) { if ( isOpen() ) { flush(); ogg_stream_clear( &oggStreamState); vorbis_block_clear( &vorbisBlock); vorbis_dsp_clear( &vorbisDspState); vorbis_comment_clear( &vorbisComment); vorbis_info_clear( &vorbisInfo); encoderOpen = false; getSink()->close(); } } #endif // HAVE_VORBIS_LIB darkice-1.0/src/Reporter.cpp0000644000175000001440000000420611371632310012765 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell Reporter File : Reporter.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include #include "Reporter.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: Reporter.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Initial values for static members of the class *----------------------------------------------------------------------------*/ unsigned int Reporter::verbosity = 1; std::ostream * Reporter::os = &std::cout; /* =============================================== local function prototypes */ /* ============================================================= module code */ darkice-1.0/src/TwoLameLibEncoder.cpp0000644000175000001440000002300511371632310014460 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : TwoLameLibEncoder.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif // compile the whole file only if TwoLame support configured in #ifdef HAVE_TWOLAME_LIB #include "Exception.h" #include "Util.h" #include "TwoLameLibEncoder.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: TwoLameLibEncoder.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void TwoLameLibEncoder :: init ( void ) throw ( Exception ) { this->twolame_opts = NULL; if ( getInBitsPerSample() != 16 ) { throw Exception( __FILE__, __LINE__, "specified bits per sample not supported", getInBitsPerSample() ); } if ( getInChannel() != 1 && getInChannel() != 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of input channels for the encoder", getInChannel() ); } if ( getOutChannel() != 1 && getOutChannel() != 2 ) { throw Exception( __FILE__, __LINE__, "unsupported number of output channels for the encoder", getOutChannel() ); } if ( getInChannel() < getOutChannel() ) { throw Exception( __FILE__, __LINE__, "output channels greater then input channels", getOutChannel() ); } } /*------------------------------------------------------------------------------ * Open an encoding session *----------------------------------------------------------------------------*/ bool TwoLameLibEncoder :: open ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } // open the underlying sink if ( !getSink()->open() ) { throw Exception( __FILE__, __LINE__, "TwoLAME lib opening underlying sink error"); } twolame_opts = ::twolame_init(); // ugly twolame returns -1 in a pointer on allocation errors if ( !twolame_opts ) { throw Exception( __FILE__, __LINE__, "TwoLAME lib init error", (long int) twolame_opts); } if ( 0 > twolame_set_num_channels( twolame_opts, getInChannel()) ) { throw Exception( __FILE__, __LINE__, "TwoLAME lib setting channels error", getInChannel() ); } if ( 0 > twolame_set_mode( twolame_opts, getOutChannel() == 1 ? TWOLAME_MONO : TWOLAME_JOINT_STEREO) ) { throw Exception( __FILE__, __LINE__, "TwoLAME lib setting mode error", TWOLAME_JOINT_STEREO ); } if ( 0 > twolame_set_in_samplerate( twolame_opts, getInSampleRate()) ) { throw Exception( __FILE__, __LINE__, "TwoLAME lib setting input sample rate error", getInSampleRate() ); } if ( 0 > twolame_set_out_samplerate( twolame_opts, getOutSampleRate()) ) { throw Exception( __FILE__, __LINE__, "TwoLAME lib setting output sample rate error", getOutSampleRate() ); } switch ( getOutBitrateMode() ) { case cbr: { if ( 0 > twolame_set_brate( twolame_opts, getOutBitrate()) ) { throw Exception( __FILE__, __LINE__, "TwoLAME lib setting output bit rate error", getOutBitrate() ); } } break; default: { throw Exception( __FILE__, __LINE__, "Unsupported bitrate mode." ); } } // let TwoLAME init its own params based on our settings if ( 0 > twolame_init_params( twolame_opts) ) { throw Exception( __FILE__, __LINE__, "TwoLAME lib initializing params error" ); } // Information about TwoLame's setup if (getReportVerbosity() >= 3) { twolame_print_config( twolame_opts); } return true; } /*------------------------------------------------------------------------------ * Write data to the encoder *----------------------------------------------------------------------------*/ unsigned int TwoLameLibEncoder :: write ( const void * buf, unsigned int len ) throw ( Exception ) { if ( !isOpen() || len == 0 ) { return 0; } unsigned int bitsPerSample = getInBitsPerSample(); unsigned int inChannels = getInChannel(); unsigned int sampleSize = (bitsPerSample / 8) * inChannels; unsigned char * b = (unsigned char*) buf; unsigned int processed = len - (len % sampleSize); unsigned int nSamples = processed / sampleSize; short int * leftBuffer = new short int[nSamples]; short int * rightBuffer = new short int[nSamples]; if ( bitsPerSample == 8 ) { Util::conv8( b, processed, leftBuffer, rightBuffer, inChannels); } else if ( bitsPerSample == 16 ) { Util::conv16( b, processed, leftBuffer, rightBuffer, inChannels, isInBigEndian()); } else { delete[] leftBuffer; delete[] rightBuffer; throw Exception( __FILE__, __LINE__, "unsupported number of bits per sample for the encoder", bitsPerSample ); } // data chunk size estimate according to TwoLAME documentation // NOTE: mp2Size is calculated based on the number of input channels // which may be bigger than need, as output channels can be less unsigned int mp2Size = (unsigned int) (1.25 * nSamples + 7200); unsigned char * mp2Buf = new unsigned char[mp2Size]; int ret; ret = twolame_encode_buffer( twolame_opts, leftBuffer, inChannels == 2 ? rightBuffer : leftBuffer, nSamples, mp2Buf, mp2Size ); delete[] leftBuffer; delete[] rightBuffer; if ( ret < 0 ) { reportEvent( 3, "TwoLAME encoding error", ret); delete[] mp2Buf; return 0; } unsigned int written = getSink()->write( mp2Buf, ret); delete[] mp2Buf; // just let go data that could not be written if ( written < (unsigned int) ret ) { reportEvent( 2, "couldn't write all from encoder to underlying sink", ret - written); } return processed; } /*------------------------------------------------------------------------------ * Flush the data from the encoder *----------------------------------------------------------------------------*/ void TwoLameLibEncoder :: flush ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } // data chunk size estimate according to TwoLAME documentation unsigned int mp2Size = 7200; unsigned char * mp2Buf = new unsigned char[mp2Size]; int ret; ret = twolame_encode_flush( twolame_opts, mp2Buf, mp2Size ); unsigned int written = getSink()->write( mp2Buf, ret); delete[] mp2Buf; // just let go data that could not be written if ( written < (unsigned int) ret ) { reportEvent( 2, "couldn't write all from encoder to underlying sink", ret - written); } getSink()->flush(); } /*------------------------------------------------------------------------------ * Close the encoding session *----------------------------------------------------------------------------*/ void TwoLameLibEncoder :: close ( void ) throw ( Exception ) { if ( isOpen() ) { flush(); twolame_close( &twolame_opts ); getSink()->close(); } } #endif // HAVE_TWOLAME_LIB darkice-1.0/src/VorbisLibEncoder.h0000644000175000001440000003354411371632310014032 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : VorbisLibEncoder.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef VORBIS_LIB_ENCODER_H #define VORBIS_LIB_ENCODER_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_VORBIS_LIB #include #else #error configure for Ogg Vorbis #endif #include "Ref.h" #include "Exception.h" #include "Reporter.h" #include "AudioEncoder.h" #include "CastSink.h" #ifdef HAVE_SRC_LIB #include #else #include "aflibConverter.h" #endif /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A class representing the ogg vorbis encoder linked as a shared object or * as a static library. * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class VorbisLibEncoder : public AudioEncoder, public virtual Reporter { private: /** * Value indicating if the encoding process is going on */ bool encoderOpen; /** * Ogg Vorbis library global info */ vorbis_info vorbisInfo; /** * Ogg Vorbis library global DSP state */ vorbis_dsp_state vorbisDspState; /** * Ogg Vorbis library global block */ vorbis_block vorbisBlock; /** * Ogg Vorbis library global comment */ vorbis_comment vorbisComment; /** * Ogg library global stream state */ ogg_stream_state oggStreamState; /** * Maximum bitrate of the output in kbits/sec. If 0, don't care. */ unsigned int outMaxBitrate; /** * Resample ratio */ double resampleRatio; /** * sample rate converter object for possible resampling */ #ifdef HAVE_SRC_LIB SRC_STATE * converter; SRC_DATA converterData; #else aflibConverter * converter; #endif /** * Initialize the object. * * @param the maximum bit rate * @exception Exception */ void init ( unsigned int outMaxBitrate ) throw ( Exception ); /** * De-initialize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { if ( converter ) { #ifdef HAVE_SRC_LIB delete [] converterData.data_in; delete [] converterData.data_out; src_delete (converter); #else delete converter; #endif } } /** * Send pending Vorbis blocks to the underlying stream */ void vorbisBlocksOut( void ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline VorbisLibEncoder ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor. * * @param sink the sink to send encoded output to * @param inSampleRate sample rate of the input. * @param inBitsPerSample number of bits per sample of the input. * @param inChannel number of channels of the input. * @param inBigEndian shows if the input is big or little endian * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, inSampleRate is used. * @param outMaxBitrate maximum output bitrate. * 0 if not used. * @param outChannel number of channels of the output. * If 0, inChannel is used. * @exception Exception */ inline VorbisLibEncoder ( CastSink * sink, unsigned int inSampleRate, unsigned int inBitsPerSample, unsigned int inChannel, bool inBigEndian, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, unsigned int outMaxBitrate = 0 ) throw ( Exception ) : AudioEncoder ( sink, inSampleRate, inBitsPerSample, inChannel, inBigEndian, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( outMaxBitrate); } /** * Constructor. * * @param sink the sink to send encoded output to * @param as get input sample rate, bits per sample and channels * from this AudioSource. * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, input sample rate is used. * @param outMaxBitrate maximum output bitrate. * 0 if not used. * @param outChannel number of channels of the output. * If 0, input channel is used. * @exception Exception */ inline VorbisLibEncoder ( CastSink * sink, const AudioSource * as, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0, unsigned int outMaxBitrate = 0 ) throw ( Exception ) : AudioEncoder ( sink, as, outBitrateMode, outBitrate, outQuality, outSampleRate, outChannel ) { init( outMaxBitrate); } /** * Copy constructor. * * @param encoder the VorbisLibEncoder to copy. */ inline VorbisLibEncoder ( const VorbisLibEncoder & encoder ) throw ( Exception ) : AudioEncoder( encoder ) { if( encoder.isOpen() ) { throw Exception(__FILE__, __LINE__, "don't copy open encoders"); } init( encoder.getOutMaxBitrate() ); } /** * Destructor. * * @exception Exception */ inline virtual ~VorbisLibEncoder ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } strip(); } /** * Assignment operator. * * @param encoder the VorbisLibEncoder to assign this to. * @return a reference to this VorbisLibEncoder. * @exception Exception */ inline virtual VorbisLibEncoder & operator= ( const VorbisLibEncoder & encoder ) throw ( Exception ) { if( encoder.isOpen() ) { throw Exception(__FILE__, __LINE__, "don't copy open encoders"); } if ( this != &encoder ) { strip(); AudioEncoder::operator=( encoder); init( encoder.getOutMaxBitrate() ); } return *this; } /** * Get the maximum bit rate of the output in kbits/sec, * for fixed / average bitrate encodings. * * @return the maximum bit rate of the output, or 0 if not set. */ inline unsigned int getOutMaxBitrate ( void ) const throw () { return outMaxBitrate; } /** * Check wether encoding is in progress. * * @return true if encoding is in progress, false otherwise. */ inline virtual bool isRunning ( void ) const throw () { return isOpen(); } /** * Start encoding. This function returns as soon as possible, * with encoding started in the background. * * @return true if encoding has started, false otherwise. * @exception Exception */ inline virtual bool start ( void ) throw ( Exception ) { return open(); } /** * Stop encoding. Stops the encoding running in the background. * * @exception Exception */ inline virtual void stop ( void ) throw ( Exception ) { return close(); } /** * Open an encoding session. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the encoding session is open. * * @return true if the encoding session is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return encoderOpen; } /** * Check if the encoder is ready to accept data. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the encoder is ready to accept data, * false otherwise. * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { if ( !isOpen() ) { return false; } return true; } /** * Write data to the encoder. * Buf is expected to be a sequence of big-endian 16 bit values, * with left and right channels interleaved. Len is the number of * bytes, must be a multiple of 4. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * Flush all data that was written to the encoder to the underlying * connection. * * @exception Exception */ virtual void flush ( void ) throw ( Exception ); /** * Close the encoding session. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* VORBIS_LIB_ENCODER_H */ darkice-1.0/src/FileSink.cpp0000644000175000001440000002316111371632310012670 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : FileSink.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_STDLIB_H #include #else #error need stdlib.h #endif #ifdef HAVE_SYS_TYPES_H #include #else #error need sys/types.h #endif #ifdef HAVE_ERRNO_H #include #else #error need errno.h #endif #ifdef HAVE_SYS_STAT_H #include #else #error need sys/stat.h #endif #ifdef HAVE_FCNTL_H #include #else #error need fcntl.h #endif #ifdef HAVE_SYS_TIME_H #include #else #error need sys/time.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_SIGNAL_H #include #else #error need signal.h #endif #include #include #include #include "Util.h" #include "Exception.h" #include "FileSink.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: FileSink.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void FileSink :: init ( const char * configName, const char * name ) throw ( Exception ) { this->configName = Util::strDup(configName); fileName = Util::strDup(name); fileDescriptor = 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void FileSink :: strip ( void) throw ( Exception ) { if ( isOpen() ) { close(); } delete[] fileName; } /*------------------------------------------------------------------------------ * Copy Constructor *----------------------------------------------------------------------------*/ FileSink :: FileSink ( const FileSink & fs ) throw ( Exception ) : Sink( fs ) { int fd; init( fs.configName, fs.fileName); if ( (fd = fs.fileDescriptor ? dup( fs.fileDescriptor) : 0) == -1 ) { strip(); throw Exception( __FILE__, __LINE__, "dup failure"); } fileDescriptor = fd; } /*------------------------------------------------------------------------------ * Assignment operator *----------------------------------------------------------------------------*/ FileSink & FileSink :: operator= ( const FileSink & fs ) throw ( Exception ) { if ( this != &fs ) { int fd; /* first strip */ strip(); /* then build up */ Sink::operator=( fs ); init( fs.configName, fs.fileName); if ( (fd = fs.fileDescriptor ? dup( fs.fileDescriptor) : 0) == -1 ) { strip(); throw Exception( __FILE__, __LINE__, "dup failure"); } fileDescriptor = fd; } return *this; } /*------------------------------------------------------------------------------ * Check wether a file exists and is regular file *----------------------------------------------------------------------------*/ bool FileSink :: exists ( void ) const throw () { struct stat st; if ( stat( (const char*)fileName, &st) == -1 ) { return false; } return S_ISREG( st.st_mode); } /*------------------------------------------------------------------------------ * Create a file, truncate if already exists *----------------------------------------------------------------------------*/ bool FileSink :: create ( void ) throw ( Exception ) { int fd; if ( isOpen() ) { return false; } if ( (fd = ::creat( fileName, S_IRUSR | S_IWUSR)) == -1 ) { reportEvent( 3, "can't create file", fileName, errno); return false; } ::close( fd); return true; } /*------------------------------------------------------------------------------ * Open the file *----------------------------------------------------------------------------*/ bool FileSink :: open ( void ) throw ( Exception ) { if ( isOpen() ) { return false; } if ( (fileDescriptor = ::open( fileName, O_WRONLY | O_TRUNC, 0)) == -1 ) { fileDescriptor = 0; return false; } return true; } /*------------------------------------------------------------------------------ * Check wether the file can be written to *----------------------------------------------------------------------------*/ bool FileSink :: canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { fd_set fdset; struct timespec timespec; sigset_t sigset; int ret; if ( !isOpen() ) { return false; } FD_ZERO( &fdset); FD_SET( fileDescriptor, &fdset); timespec.tv_sec = sec; timespec.tv_nsec = usec * 1000L; // mask out SIGUSR1, as we're expecting that signal for other reasons sigemptyset(&sigset); sigaddset(&sigset, SIGUSR1); ret = pselect( fileDescriptor + 1, NULL, &fdset, NULL, ×pec, &sigset); if ( ret == -1 ) { throw Exception( __FILE__, __LINE__, "select error"); } return ret > 0; } /*------------------------------------------------------------------------------ * Write to the FileSink *----------------------------------------------------------------------------*/ unsigned int FileSink :: write ( const void * buf, unsigned int len ) throw ( Exception ) { ssize_t ret; if ( !isOpen() ) { return 0; } ret = ::write( fileDescriptor, buf, len); if ( ret == -1 ) { if ( errno == EAGAIN ) { ret = 0; } else { throw Exception( __FILE__, __LINE__, "write error", errno); } } return ret; } /*------------------------------------------------------------------------------ * Get the file name to where to move the data saved so far. * The trick is to read the file name from a file named * /tmp/darkice.$configName.$PID , where: * - $configName is the name of the configuration section for this file sink * - $PID is the current process id *----------------------------------------------------------------------------*/ std::string FileSink :: getArchiveFileName ( void ) throw ( Exception ) { pid_t pid = getpid(); std::stringstream metaFileName; metaFileName << "/tmp/darkice." << configName << "." << pid; std::ifstream ifs(metaFileName.str().c_str()); if (!ifs.good()) { throw Exception(__FILE__, __LINE__, "can't find file ", metaFileName.str().c_str(), 0); } std::string archiveFileName; ifs >> archiveFileName; ifs.close(); return archiveFileName; } /*------------------------------------------------------------------------------ * Cut what we've done so far, and start anew. *----------------------------------------------------------------------------*/ void FileSink :: cut ( void ) throw () { flush(); close(); try { std::string archiveFileName = getArchiveFileName(); if (::rename(fileName, archiveFileName.c_str()) != 0) { reportEvent(2, "couldn't move file", fileName, "to", archiveFileName); } } catch ( Exception &e ) { reportEvent(2, "error during archive cut", e); } create(); open(); } /*------------------------------------------------------------------------------ * Close the FileSink *----------------------------------------------------------------------------*/ void FileSink :: close ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } flush(); ::close( fileDescriptor); fileDescriptor = 0; } darkice-1.0/src/Sink.h0000644000175000001440000001210311371632310011527 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Sink.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef SINK_H #define SINK_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Referable.h" #include "Exception.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A general data sink * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class Sink : public virtual Referable { private: protected: /** * Default constructor. */ inline Sink ( void ) throw () { } /** * Copy constructor. * * @param sink the Sink to copy. */ inline Sink ( const Sink & sink ) throw () { } /** * Assignment operator. * * @param sink the Sink to assign this to. * @return a reference to this Sink. * @exception Exception */ inline virtual Sink & operator= ( const Sink & sink ) throw ( Exception ) { return *this; } public: /** * Destructor. * * @exception Exception */ inline virtual ~Sink ( void ) throw ( Exception ) { } /** * Open the sink. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ) = 0; /** * Check if the Sink is open. * * @return true if the Sink is open, false otherwise. */ virtual bool isOpen ( void ) const throw () = 0; /** * Check if the Sink is ready to accept data. * Blocks until the specified time for data to be available. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the Sink is ready to accept data, false otherwise. * @exception Exception */ virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) = 0; /** * Write data to the Sink. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ) = 0; /** * Flush all data that was written to the Sink to the underlying * construct. * * @exception Exception */ virtual void flush ( void ) throw ( Exception ) = 0; /** * Cut what the sink has been doing so far, and start anew. * This usually means separating the data sent to the sink up * until now, and start saving a new chunk of data. */ virtual void cut ( void ) throw () = 0; /** * Close the Sink. * * @exception Exception */ virtual void close ( void ) throw ( Exception ) = 0; }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* SINK_H */ darkice-1.0/src/CastSink.cpp0000644000175000001440000001072211371632310012702 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : CastSink.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include "Util.h" #include "Exception.h" #include "CastSink.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: CastSink.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void CastSink :: init ( TcpSocket * socket, Sink * streamDump, const char * password, unsigned int bitRate, const char * name, const char * url, const char * genre, bool isPublic, unsigned int bufferDuration ) throw ( Exception ) { this->socket = socket; this->streamDump = streamDump; this->password = password ? Util::strDup( password) : 0; this->bitRate = bitRate; this->name = name ? Util::strDup( name) : 0; this->url = url ? Util::strDup( url) : 0; this->genre = genre ? Util::strDup( genre) : 0; this->isPublic = isPublic; this->bufferDuration = bufferDuration; int bufferSize = bitRate ? (bitRate * 1024 / 8) * bufferDuration : (128 * 1024 / 8) * bufferDuration; bufferedSink = socket ? new BufferedSink( socket, bufferSize) : 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void CastSink :: strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } if ( password ) { delete[] password; } if ( name ) { delete[] name; } if ( url ) { delete[] url; } if ( genre ) { delete[] genre; } } /*------------------------------------------------------------------------------ * Open the connection *----------------------------------------------------------------------------*/ bool CastSink :: open ( void ) throw ( Exception ) { if ( isOpen() ) { return false; } if ( !bufferedSink->open() ) { return false; } if ( !sendLogin() ) { close(); return false; } if ( streamDump != 0 ) { if ( !streamDump->isOpen() ) { if ( !streamDump->open() ) { reportEvent( 2, "can't open stream dump"); } } } return true; } darkice-1.0/src/IceCast.cpp0000644000175000001440000001421411371632310012476 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : IceCast.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDIO_H #include #else #error need stdio.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_MATH_H #include #else #error need math.h #endif #include "Exception.h" #include "Source.h" #include "Sink.h" #include "Util.h" #include "IceCast.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: IceCast.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Size of string conversion buffer *----------------------------------------------------------------------------*/ #define STRBUF_SIZE 32 /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void IceCast :: init ( const char * mountPoint, const char * description, const char * remoteDumpFile ) throw ( Exception ) { this->mountPoint = Util::strDup( mountPoint); this->description = description ? Util::strDup( description) : 0; this->remoteDumpFile = remoteDumpFile ? Util::strDup( remoteDumpFile) : 0; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void IceCast :: strip ( void ) throw ( Exception ) { delete[] mountPoint; if ( description ) { delete[] description; } if ( remoteDumpFile ) { delete[] remoteDumpFile; } } /*------------------------------------------------------------------------------ * Log in to the IceCast server *----------------------------------------------------------------------------*/ bool IceCast :: sendLogin ( void ) throw ( Exception ) { Sink * sink = getSink(); Source * source = getSocket(); const char * str; char resp[STRBUF_SIZE]; unsigned int len; if ( !source->isOpen() ) { return false; } if ( !sink->isOpen() ) { return false; } /* send the request, a string like: * "SOURCE /\n" */ str = "SOURCE "; sink->write( str, strlen( str)); str = getPassword(); sink->write( str, strlen( str)); str = " /"; sink->write( str, strlen( str)); str = getMountPoint(); sink->write( str, strlen( str)); /* send the x-audiocast headers */ str = "\nx-audiocast-bitrate: "; sink->write( str, strlen( str)); if ( log10(getBitRate()) >= (STRBUF_SIZE-2) ) { throw Exception( __FILE__, __LINE__, "bitrate does not fit string buffer", getBitRate()); } sprintf( resp, "%d", getBitRate()); sink->write( resp, strlen( resp)); str = "\nx-audiocast-public: "; sink->write( str, strlen( str)); str = getIsPublic() ? "1" : "0"; sink->write( str, strlen( str)); if ( getName() ) { str = "\nx-audiocast-name: "; sink->write( str, strlen( str)); str = getName(); sink->write( str, strlen( str)); } if ( getDescription() ) { str = "\nx-audiocast-description: "; sink->write( str, strlen( str)); str = getDescription(); sink->write( str, strlen( str)); } if ( getUrl() ) { str = "\nx-audiocast-url: "; sink->write( str, strlen( str)); str = getUrl(); sink->write( str, strlen( str)); } if ( getGenre() ) { str = "\nx-audiocast-genre: "; sink->write( str, strlen( str)); str = getGenre(); sink->write( str, strlen( str)); } if ( getRemoteDumpFile() ) { str = "\nx-audiocast-dumpfile: "; sink->write( str, strlen( str)); str = getRemoteDumpFile(); sink->write( str, strlen( str)); } str = "\n\n"; sink->write( str, strlen( str)); sink->flush(); /* read the anticipated response: "OK" */ len = source->read( resp, STRBUF_SIZE); if ( len < 2 || resp[0] != 'O' || resp[1] != 'K' ) { return false; } /* suck anything that the other side has to say */ while ( source->canRead( 0, 0) && (len = source->read( resp, STRBUF_SIZE)) ) { ; } return true; } darkice-1.0/src/AudioEncoder.h0000644000175000001440000003614411371632310013177 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : AudioEncoder.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef AUDIO_ENCODER_H #define AUDIO_ENCODER_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Referable.h" #include "Sink.h" #include "AudioSource.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * An audio encoder * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class AudioEncoder : public Sink, public virtual Referable { public: /** * Type to specify bitrate mode. Possible values: * - cbr - constant bitrate mode * described by bitrate * - abr - average bitrate mode * described by an average bitrate and quality * - vbr - variable bitrate mode * described by quality */ enum BitrateMode { cbr, abr, vbr }; private: /** * The Sink to dump the encoded data to */ Ref sink; /** * Sample rate of the input. */ unsigned int inSampleRate; /** * Number of bits per sample of the input. */ unsigned int inBitsPerSample; /** * Number of channels of the input. */ unsigned int inChannel; /** * Is the input big endian or little endian? */ bool inBigEndian; /** * The bitrate mode of the encoder */ BitrateMode outBitrateMode; /** * Bit rate of the output in kbits/sec, for fixed bitrate encodings. */ unsigned int outBitrate; /** * Quality of the output, for variable bitrate encodings. */ double outQuality; /** * Sample rate of the output. */ unsigned int outSampleRate; /** * Number of channels of the output. */ unsigned int outChannel; /** * Initialize the object. * * @param sink the sink to send encoded output to * @param inSampleRate sample rate of the input. * @param inBitsPerSample number of bits per sample of the input. * @param inChannel number of channels of the input. * @param inBigEndian shows if the input is big or little endian. * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output. * @param outSampleRate sample rate of the output. * @param outChannel number of channels of the output. * @exception Exception */ inline void init ( Sink * sink, unsigned int inSampleRate, unsigned int inBitsPerSample, unsigned int inChannel, bool inBigEndian, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate, unsigned int outChannel ) throw ( Exception ) { this->sink = sink; this->inSampleRate = inSampleRate; this->inBitsPerSample = inBitsPerSample; this->inChannel = inChannel; this->inBigEndian = inBigEndian; this->outBitrateMode = outBitrateMode; this->outBitrate = outBitrate; this->outQuality = outQuality; this->outSampleRate = outSampleRate; this->outChannel = outChannel; if ( outQuality < -0.1 || 1.0 < outQuality ) { throw Exception( __FILE__, __LINE__, "invalid encoder quality"); } } /** * De-iitialize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { } protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline AudioEncoder ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Constructor. * * @param sink the sink to send encoded output to * @param inSampleRate sample rate of the input. * @param inBitsPerSample number of bits per sample of the input. * @param inChannel number of channels of the input. * @param inBigEndian shows if the input is big or little endian * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, inSampleRate is used. * @param outChannel number of channels of the output. * If 0, inChannel is used. * @exception Exception */ inline AudioEncoder ( Sink * sink, unsigned int inSampleRate, unsigned int inBitsPerSample, unsigned int inChannel, bool inBigEndian, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0 ) throw ( Exception ) { init ( sink, inSampleRate, inBitsPerSample, inChannel, inBigEndian, outBitrateMode, outBitrate, outQuality, outSampleRate ? outSampleRate : inSampleRate, outChannel ? outChannel : inChannel ); } /** * Constructor. * * @param sink the sink to send encoded output to * @param as get input sample rate, bits per sample and channels * from this AudioSource. * @param outBitrateMode the bit rate mode of the output. * @param outBitrate bit rate of the output (kbits/sec). * @param outQuality the quality of the stream. * @param outSampleRate sample rate of the output. * If 0, input sample rate is used. * @param outChannel number of channels of the output. * If 0, input channel is used. * @exception Exception */ inline AudioEncoder ( Sink * sink, const AudioSource * as, BitrateMode outBitrateMode, unsigned int outBitrate, double outQuality, unsigned int outSampleRate = 0, unsigned int outChannel = 0 ) throw ( Exception) { init( sink, as->getSampleRate(), as->getBitsPerSample(), as->getChannel(), as->isBigEndian(), outBitrateMode, outBitrate, outQuality, outSampleRate ? outSampleRate : as->getSampleRate(), outChannel ? outChannel : as->getChannel() ); } /** * Copy constructor. * * @param encoder the AudioEncoder to copy. */ inline AudioEncoder ( const AudioEncoder & encoder ) throw ( Exception ) { init ( encoder.sink.get(), encoder.inSampleRate, encoder.inBitsPerSample, encoder.inChannel, encoder.inBigEndian, encoder.outBitrateMode, encoder.outBitrate, encoder.outQuality, encoder.outSampleRate, encoder.outChannel ); } /** * Assignment operator. * * @param encoder the AudioEncoder to assign this to. * @return a reference to this AudioEncoder. * @exception Exception */ inline virtual AudioEncoder & operator= ( const AudioEncoder & encoder ) throw ( Exception ) { if ( this != &encoder ) { strip(); init ( encoder.sink.get(), encoder.inSampleRate, encoder.inBitsPerSample, encoder.inChannel, encoder.inBigEndian, encoder.outBitrateMode, encoder.outBitrate, encoder.outQuality, encoder.outSampleRate, encoder.outChannel ); } return *this; } public: /** * Destructor. * * @exception Exception */ inline virtual ~AudioEncoder ( void ) throw ( Exception ) { strip(); } /** * Get the underlying sink, that the encoded content is sent to. * * @return the underlying sink */ inline virtual Ref getSink(void) throw () { return sink; } /** * Get the number of channels of the input. * * @return the number of channels of the input. */ inline int getInChannel ( void ) const throw () { return inChannel; } /** * Tell if the input is big or little endian. * * @return true if the input is big endian, false if little endian. */ inline bool isInBigEndian ( void ) const throw () { return inBigEndian; } /** * Get the sample rate of the input. * * @return the sample rate of the input. */ inline int getInSampleRate ( void ) const throw () { return inSampleRate; } /** * Get the number of bits per sample of the input. * * @return the number of bits per sample of the input. */ inline int getInBitsPerSample ( void ) const throw () { return inBitsPerSample; } /** * Get the number of channels of the output. * * @return the number of channels of the output. */ inline int getOutChannel ( void ) const throw () { return outChannel; } /** * Get the sample rate of the output. * * @return the sample rate of the output. */ inline int getOutSampleRate ( void ) const throw () { return outSampleRate; } /** * Get the bit rate mode of the output. * * @return the bit rate mode of the output. */ inline BitrateMode getOutBitrateMode ( void ) const throw () { return outBitrateMode; } /** * Get the bit rate of the output in kbits/sec, for fixed bitrate * encodings. * * @return the bit rate of the output. */ inline unsigned int getOutBitrate ( void ) const throw () { return outBitrate; } /** * Get the encoding quality of the output, for variable bitrate * encodings. * * @return the encoding quality of the output. */ inline double getOutQuality ( void ) const throw () { return outQuality; } /** * Check wether encoding is in progress. * * @return true if encoding is in progress, false otherwise. */ virtual bool isRunning ( void ) const throw () = 0; /** * Start encoding. This function returns as soon as possible, * with encoding started in the background. * * @return true if encoding has started, false otherwise. * @exception Exception */ virtual bool start ( void ) throw ( Exception ) = 0; /** * Stop encoding. Stops the encoding running in the background. * * @exception Exception */ virtual void stop ( void ) throw ( Exception ) = 0; /** * Cut what the sink has been doing so far, and start anew. * This usually means separating the data sent to the sink up * until now, and start saving a new chunk of data. * * Typically this action is delegated to the underlying sink. */ inline virtual void cut ( void ) throw () { sink->cut(); } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* AUDIO_ENCODER_H */ darkice-1.0/src/BufferedSink.cpp0000644000175000001440000002664611371632310013546 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : BufferedSink.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ the buffer is filled like this: buffer bufferEnd | | +----------+--------------------------+--------------+ |<---- valid data -------->| outp inp buffer bufferEnd | | +----------------+--------------+--------------------+ -- valid data -->| |--- valid data -----> inp outp Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #include "Exception.h" #include "BufferedSink.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: BufferedSink.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void BufferedSink :: init ( Sink * sink, unsigned int size, unsigned int chunkSize ) throw ( Exception ) { if ( !sink ) { throw Exception( __FILE__, __LINE__, "no sink"); } this->sink = sink; // create a reference this->chunkSize = chunkSize ? chunkSize : 1; this->bufferSize = size; // make bufferSize a multiple of chunkSize this->bufferSize -= this->bufferSize % this->chunkSize; this->peak = 0; this->misalignment = 0; this->buffer = new unsigned char[bufferSize]; this->bufferEnd = buffer + bufferSize; this->inp = buffer; this->outp = buffer; } /*------------------------------------------------------------------------------ * Copy Constructor *----------------------------------------------------------------------------*/ BufferedSink :: BufferedSink ( const BufferedSink & buffer ) throw ( Exception ) { init( buffer.sink.get(), buffer.bufferSize, buffer.chunkSize); this->peak = buffer.peak; this->misalignment = buffer.misalignment; memcpy( this->buffer, buffer.buffer, this->bufferSize); } /*------------------------------------------------------------------------------ * De-initalize the object *----------------------------------------------------------------------------*/ void BufferedSink :: strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } sink = 0; // delete the reference delete buffer; } /*------------------------------------------------------------------------------ * Assignment operator *----------------------------------------------------------------------------*/ BufferedSink & BufferedSink :: operator= ( const BufferedSink & buffer ) throw ( Exception ) { if ( this != &buffer ) { strip(); Sink::operator=( buffer ); init( buffer.sink.get(), buffer.bufferSize, buffer.chunkSize); this->peak = buffer.peak; this->misalignment = buffer.misalignment; memcpy( this->buffer, buffer.buffer, this->bufferSize); } return *this; } /*------------------------------------------------------------------------------ * Store bufferSize bytes into the buffer * All data is consumed. The return value is less then bufferSize only * if the BufferedSink's internal buffer is smaller than bufferSize, * thus can't hold that much * The data to be stored is treated as parts with chunkSize size * Only full chunkSize sized parts are stored *----------------------------------------------------------------------------*/ unsigned int BufferedSink :: store ( const void * buffer, unsigned int bufferSize ) throw ( Exception ) { const unsigned char * buf; unsigned int size; unsigned int i; unsigned char * oldInp; if ( !buffer ) { throw Exception( __FILE__, __LINE__, "buffer is null"); } if ( !bufferSize ) { return 0; } oldInp = inp; buf = (const unsigned char *) buffer; // adjust so it is a multiple of chunkSize bufferSize -= bufferSize % chunkSize; // cut the front of the supplied buffer if it wouldn't fit if ( bufferSize > this->bufferSize ) { size = this->bufferSize - 1; size -= size % chunkSize; // keep it a multiple of chunkSize buf += bufferSize - size; } else { size = bufferSize; } // copy the data into the buffer i = bufferEnd - inp; if ( (i % chunkSize) != 0 ) { throw Exception( __FILE__, __LINE__, "copy quantity not aligned", i); } if ( size <= i ) { // the place between inp and bufferEnd is // big enough to hold the data memcpy( inp, buf, size); inp = slidePointer( inp, size); // adjust outp, lose the data that was overwritten, if any if ( outp > oldInp && outp <= inp ) { outp = slidePointer( inp, chunkSize); } } else { // the place between inp and bufferEnd is not // big enough to hold the data // writing will take place in two turns, once from // inp -> bufferEnd, then from buffer -> memcpy( inp, buf, i); i = size - i; if ( (i % chunkSize) != 0 ) { throw Exception(__FILE__, __LINE__, "copy quantity not aligned", i); } memcpy( this->buffer, buf, i); inp = slidePointer( this->buffer, i); // adjust outp, lose the data that was overwritten, if any if ( outp <= oldInp ) { if ( outp < inp ) { outp = slidePointer( inp, chunkSize); } } else { outp = slidePointer( inp, chunkSize); } } updatePeak(); if ( ((inp - this->buffer) % chunkSize) != 0 ) { throw Exception( __FILE__, __LINE__, "inp not aligned", inp - this->buffer); } if ( ((outp - this->buffer) % chunkSize) != 0 ) { throw Exception( __FILE__, __LINE__, "outp not aligned", outp - this->buffer); } return size; } /*------------------------------------------------------------------------------ * Write some data to the sink * if len == 0, try to flush the buffer *----------------------------------------------------------------------------*/ unsigned int BufferedSink :: write ( const void * buf, unsigned int len ) throw ( Exception ) { unsigned int length; unsigned int soFar; unsigned char * b = (unsigned char *) buf; if ( !buf ) { throw Exception( __FILE__, __LINE__, "buf is null"); } if ( !isOpen() ) { return 0; } if ( !align() ) { return 0; } // make it a multiple of chunkSize len -= len % chunkSize; // try to write data from the buffer first, if any if ( inp != outp ) { unsigned int size = 0; unsigned int total = 0; if ( outp > inp ) { // valuable data is between outp -> bufferEnd and buffer -> inp // try to write the outp -> bufferEnd // the rest will be written in the next if size = bufferEnd - outp - 1; size -= size % chunkSize; soFar = 0; while ( outp > inp && soFar < size && sink->canWrite( 0, 0) ) { length = sink->write( outp + soFar, size - soFar); outp = slidePointer( outp, length); soFar += length; } total += soFar; } if ( outp < inp ) { // valuable data is between outp and inp // in the previous if wrote all data from the end // this part will write the rest size = inp - outp; soFar = 0; while ( soFar < size && sink->canWrite( 0, 0) ) { length = sink->write( outp + soFar, size - soFar); outp = slidePointer( outp, length); soFar += length; } total += soFar; } while ( (outp - buffer) % chunkSize ) { slidePointer( outp, 1); } // calulate the misalignment to chunkSize boundaries misalignment = (chunkSize - (total % chunkSize)) % chunkSize; } if ( !align() ) { return 0; } // the internal buffer is empty, try to write the fresh data soFar = 0; if ( inp == outp ) { while ( soFar < len && sink->canWrite( 0, 0) ) { try { soFar += sink->write( b + soFar, len - soFar); } catch (Exception &e) { reportEvent(3,"Exception caught in BufferedSink :: write3\n"); throw; /* up a level */ } } } length = soFar; // calulate the misalignment to chunkSize boundaries misalignment = (chunkSize - (length % chunkSize)) % chunkSize; if ( length < len ) { // if not all fresh could be written, store the remains store( b + length, len - length); } // tell them we ate everything up to chunkSize alignment return len; } /*------------------------------------------------------------------------------ * Close the sink, lose all pending data *----------------------------------------------------------------------------*/ void BufferedSink :: close ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } flush(); sink->close(); inp = outp = buffer; } darkice-1.0/src/Connector.h0000644000175000001440000001757211371632310012574 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Connector.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef CONNECTOR_H #define CONNECTOR_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Referable.h" #include "Ref.h" #include "Reporter.h" #include "Source.h" #include "Sink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Connects a source to one or more sinks. * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class Connector : public virtual Referable, public virtual Reporter { private: /** * Initialize the object. * * @param source the source to read from. * @exception Exception */ void init ( Source * source ) throw ( Exception ); /** * De-initialize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); protected: /** * The source to read from. */ Ref source; /** * The sinks to connect the source to. */ Ref * sinks; /** * Total number of sinks. */ unsigned int numSinks; /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline Connector ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Detach an already attached Sink from the Source of this Connector. * * @param sink the Sink to detach. * @return true if the detachment was successful, false otherwise. * @exception Exception */ virtual bool detach ( Sink * sink ) throw ( Exception ); public: /** * Constructor based on a Source. * * @param source the source to connect to the sinks. * @exception Exception */ inline Connector ( Source * source ) throw ( Exception ) { init( source); } /** * Constructor based on a Source and a Sink. * * @param source the source to connect to the sinks. * @param sink a sink to connect to the source. * @exception Exception */ inline Connector ( Source * source, Sink * sink ) throw ( Exception ) { init( source); attach( sink); } /** * Copy constructor. * * @param connector the object to copy. * @exception Exception */ Connector ( const Connector & connector ) throw ( Exception ); /** * Destructor. * * @exception Exception */ inline virtual ~Connector( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param connector the object to assign to this one. * @return a reference to this object. * @exception Exception */ virtual Connector & operator= ( const Connector & connector ) throw ( Exception ); /** * Get the number of Sinks in the Connector. * * @return the number of Sinks in the Connector. * @exception Exception */ inline virtual unsigned int getNumSinks ( void ) const throw () { return numSinks; } /** * Attach a Sink to the Source of this Connector. * * @param sink the Sink to attach. * @exception Exception */ virtual void attach ( Sink * sink ) throw ( Exception ); /** * Open the connector. Opens the Source and the Sinks if necessary. * * @return true if opening was successful, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Transfer a given amount of data from the Source to all the * Sinks attached. * If an attached Sink closes or encounteres an error during the * process, it is detached and the function carries on with the * rest of the Sinks. If no Sinks remain, or an error is encountered * with the Source, the function returns prematurely. * * @param bytes the amount of data to transfer, in bytes. * If 0, transfer forever. * @param bufSize the size of the buffer to use for transfering. * This amount of data is read from the Source and * written to each Sink on each turn. * @param sec the number of seconds to wait for the Source to have * data available in each turn, and the number of seconds * to wait for the Sinks to accept data. * @param usec the number of micro seconds to wait for the Source to * have data available in each turn, and the number of * micro seconds to wait for the Sinks to accept data. * @return the number of bytes read from the Source. * @exception Exception */ virtual unsigned int transfer ( unsigned long bytes, unsigned int bufSize, unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Signal to each sink we have that they need to cut what they are * doing, and start again. For FileSinks, this usually means to * save the archive file recorded so far, and start a new archive * file. */ virtual void cut ( void ) throw (); /** * Close the Connector. The Source and all Sinks are closed. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* CONNECTOR_H */ darkice-1.0/src/Exception.cpp0000644000175000001440000001306111371632310013120 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Exception.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #include "Exception.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: Exception.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Constructor *----------------------------------------------------------------------------*/ Exception :: Exception ( const char * file, unsigned int line, const char * description1, const char * description2, int code ) throw () { size_t len = 0; if ( description1 ) { len += strlen( description1); } if ( description2 ) { len += strlen( description2); } if ( len ) { char * str = new char[len+1]; str[0] = '\0'; if ( description1 ) { strcat( str, description1); } if ( description2 ) { strcat( str, description2); } init( file, line, str, code); delete[] str; } else { init( file, line, 0, code); } } /*------------------------------------------------------------------------------ * Constructor *----------------------------------------------------------------------------*/ Exception :: Exception ( const char * file, unsigned int line, const char * description1, const char * description2, const char * description3, int code ) throw () { size_t len = 0; if ( description1 ) { len += strlen( description1); } if ( description2 ) { len += strlen( description2); } if ( description3 ) { len += strlen( description3); } if ( len ) { char * str = new char[len+1]; str[0] = '\0'; if ( description1 ) { strcat( str, description1); } if ( description2 ) { strcat( str, description2); } if ( description3 ) { strcat( str, description3); } init( file, line, str, code); delete[] str; } else { init( file, line, 0, code); } } /*------------------------------------------------------------------------------ * Initialize the class *----------------------------------------------------------------------------*/ void Exception :: init ( const char * file, unsigned int line, const char * description = 0, int code = 0 ) throw () { if ( !file ) { this->file = 0; } else { size_t len; len = strlen( file ) + 1; this->file = new char[len]; if ( this->file ) { memcpy( this->file, file, len); } } if ( !description ) { this->description = 0; } else { size_t len; len = strlen( description ) + 1; this->description = new char[len]; if ( this->description ) { memcpy( this->description, description, len); } } this->line = line; this->code = code; } /*------------------------------------------------------------------------------ * De-initialize the class *----------------------------------------------------------------------------*/ void Exception :: strip ( void ) throw () { if ( description ) { delete[] description; } if ( file ) { delete[] file; } } darkice-1.0/src/config.h.in0000644000175000001440000001123011371632436012506 00000000000000/* src/config.h.in. Generated from configure.in by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* build with aacplus library */ #undef HAVE_AACPLUS_LIB /* build with ALSA sound system */ #undef HAVE_ALSA_LIB /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H /* build with faac library */ #undef HAVE_FAAC_LIB /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Does function getaddrinfo exist? */ #undef HAVE_GETADDRINFO /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* build with JACK audio server support */ #undef HAVE_JACK_LIB /* build with lame library */ #undef HAVE_LAME_LIB /* Define to 1 if you have the `nsl' library (-lnsl). */ #undef HAVE_LIBNSL /* Define to 1 if you have the `rt' library (-lrt). */ #undef HAVE_LIBRT /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_MATH_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* use MSG_NOSIGNAL for send() */ #undef HAVE_MSG_NOSIGNAL /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define if you have POSIX threads libraries and header files. */ #undef HAVE_PTHREAD /* Define to 1 if you have the header file. */ #undef HAVE_PTHREAD_H /* Define to 1 if you have the `sched_getparam' function. */ #undef HAVE_SCHED_GETPARAM /* Define to 1 if you have the `sched_getscheduler' function. */ #undef HAVE_SCHED_GETSCHEDULER /* Define to 1 if you have the header file. */ #undef HAVE_SCHED_H /* Define to 1 if you have the header file. */ #undef HAVE_SIGNAL_H /* build with samplerate conversion through libsamplerate */ #undef HAVE_SRC_LIB /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_AUDIOIO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_AUDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOUNDCARD_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_TIME_H /* build with twolame library */ #undef HAVE_TWOLAME_LIB /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* build with Ogg Vorbis library */ #undef HAVE_VORBIS_LIB /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to the necessary symbol if this constant uses a non-standard name on your system. */ #undef PTHREAD_CREATE_JOINABLE /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned int' if does not define. */ #undef size_t darkice-1.0/src/Reporter.h0000644000175000001440000002226711371632310012441 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell Reporter File : Reporter.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef REPORTER_H #define REPORTER_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_TIME_H #include #else #error need time.h #endif #include #include "Exception.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Class for reporting events. All objects of this class share * the same verbosity level. Typical usage is to inherit this class * and use the report() function to report events. Only reports * which are of suffucient importance are really reported. * * The default verbosity is 1, and the default ostream is cout. * * Known problems: this class is not thread-safe. * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class Reporter { private: /** * Verbosity level shared among all Reporter objects */ static unsigned int verbosity; /** * The output stream to report to. */ static std::ostream * os; /** * Print timestamp for every report only if verbosity level * is above this value. */ static const unsigned int prefixVerbosity = 3; /** * Print a prefix to each report. */ static void printPrefix( void ) throw () { if ( verbosity > prefixVerbosity ) { char str[32]; time_t now; now = time(NULL); strftime( str, 32, "%d-%b-%Y %H:%M:%S ", localtime(&now) ); (*(Reporter::os)) << str; } } protected: public: /** * Destructor. * * @exception Exception */ inline virtual ~Reporter ( void ) throw ( Exception ) { (Reporter::os)->flush(); } /** * Set the verbosity level. This sets the verbosity for all * Reporter objects. * * @param verbosity the new verbosity level. */ static inline void setReportVerbosity ( unsigned int verbosity ) throw () { Reporter::verbosity = verbosity; } /** * Get the verbosity level. * * @return the current verbosity level. */ static inline unsigned int getReportVerbosity ( void ) throw () { return Reporter::verbosity; } /** * Set the output stream to report to. This setting effects all * Reporter objects. * * @param os the output stream */ static inline void setReportOutputStream ( std::ostream & os ) throw () { Reporter::os = &os; } /** * Get the output stream to report to. * * @return the output stream */ static inline std::ostream & getReportOutputStream ( void ) throw () { return *(Reporter::os); } /** * Report an event with a given verbosity. * * @param verbosity the importance of the event, with 0 being * the most important. * @param t the object to report. Must have an * ostream & operator<<( ostream&, const T) * operator overload. */ template static inline void reportEvent ( unsigned int verbosity, const T t ) throw () { if ( Reporter::verbosity >= verbosity ) { printPrefix(); (*(Reporter::os)) << t << std::endl; } } /** * Report an event with a given verbosity. * * @param verbosity the importance of the event, with 0 being * the most important. * @param t the object 1 to report. Must have an * ostream & operator<<( ostream&, const T) * operator overload. * @param u the object 2 to report. Must have an * ostream & operator<<( ostream&, const U) * operator overload. */ template inline void static reportEvent ( unsigned int verbosity, const T t, const U u ) throw () { if ( Reporter::verbosity >= verbosity ) { printPrefix(); (*(Reporter::os)) << t << " " << u << std::endl; } } /** * Report an event with a given verbosity. * * @param verbosity the importance of the event, with 0 being * the most important. * @param t the object 1 to report. Must have an * ostream & operator<<( ostream&, const T) * operator overload. * @param u the object 2 to report. Must have an * ostream & operator<<( ostream&, const U) * operator overload. * @param v the object 3 to report. Must have an * ostream & operator<<( ostream&, const V) * operator overload. */ template static inline void reportEvent ( unsigned int verbosity, const T t, const U u, const V v ) throw () { if ( Reporter::verbosity >= verbosity ) { printPrefix(); (*(Reporter::os)) << t << " " << u << " " << v << std::endl; } } /** * Report an event with a given verbosity. * * @param verbosity the importance of the event, with 0 being * the most important. * @param t the object 1 to report. Must have an * ostream & operator<<( ostream&, const T) * operator overload. * @param u the object 2 to report. Must have an * ostream & operator<<( ostream&, const U) * operator overload. * @param v the object 3 to report. Must have an * ostream & operator<<( ostream&, const V) * operator overload. * @param w the object 4 to report. Must have an * ostream & operator<<( ostream&, const W) * operator overload. */ template static inline void reportEvent ( unsigned int verbosity, const T t, const U u, const V v, const W w ) throw () { if ( Reporter::verbosity >= verbosity ) { printPrefix(); (*(Reporter::os)) << t << " " << u << " " << v << " " << w << std::endl; } } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* REPORTER_H */ darkice-1.0/src/aflibConverter.cc0000644000175000001440000005637011371632022013744 00000000000000/* * Copyright: (C) 2000 Julius O. Smith * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Julius O. Smith jos@ccrma.stanford.edu * */ /* This code was modified by Bruce Forsberg (forsberg@tns.net) to make it into a C++ class */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include "aflibConverter.h" #include "aflibConverterLargeFilter.h" #include "aflibConverterSmallFilter.h" #include "aflibDebug.h" #if (!defined(TRUE) || !defined(FALSE)) # define TRUE 1 # define FALSE 0 #endif /* * The configuration constants below govern * the number of bits in the input sample and filter coefficients, the * number of bits to the right of the binary-point for fixed-point math, etc. */ /* Conversion constants */ #define Nhc 8 #define Na 7 #define Np (Nhc+Na) #define Npc (1< (inCount - (int)framecount)) { Nsamps = inCount - framecount; } for (c = 0; c < _nChans; c++) { ptr = outPtr[c]; ptr += Xoff; /* Start at designated sample number */ for (i = 0; i < Nsamps; i++) *ptr++ = (short) inArray[c * inCount + i + framecount]; } framecount += Nsamps; if ((int)framecount >= inCount) /* return index of last samp */ return (((Nsamps - (framecount - inCount)) - 1) + Xoff); else return 0; } int aflibConverter::SrcLinear( short X[], short Y[], double factor, unsigned int *Time, unsigned short& Nx, unsigned short Nout) { short iconst; short *Xp, *Ystart; int v,x1,x2; double dt; /* Step through input signal */ unsigned int dtb; /* Fixed-point version of Dt */ // unsigned int endTime; /* When Time reaches EndTime, return to user */ unsigned int start_sample, end_sample; dt = 1.0/factor; /* Output sampling period */ dtb = (unsigned int)(dt*(1<>Np; Ystart = Y; // endTime = *Time + (1<>Np]; /* Ptr to current input sample */ x1 = *Xp++; x2 = *Xp; x1 *= ((1<>Np; Nx = end_sample - start_sample; return (Y - Ystart); /* Return number of output samples */ } int aflibConverter::SrcUp( short X[], short Y[], double factor, unsigned int *Time, unsigned short& Nx, unsigned short Nout, unsigned short Nwing, unsigned short LpScl, short Imp[], short ImpD[], bool Interp) { short *Xp, *Ystart; int v; double dt; /* Step through input signal */ unsigned int dtb; /* Fixed-point version of Dt */ // unsigned int endTime; /* When Time reaches EndTime, return to user */ unsigned int start_sample, end_sample; dt = 1.0/factor; /* Output sampling period */ dtb = (unsigned int)(dt*(1<>Np; Ystart = Y; // endTime = *Time + (1<>Np]; /* Ptr to current input sample */ /* Perform left-wing inner product */ v = FilterUp(Imp, ImpD, Nwing, Interp, Xp, (short)(*Time&Pmask),-1); /* Perform right-wing inner product */ v += FilterUp(Imp, ImpD, Nwing, Interp, Xp+1, (short)((((*Time)^Pmask)+1)&Pmask), 1); v >>= Nhg; /* Make guard bits */ v *= LpScl; /* Normalize for unity filter gain */ *Y++ = WordToHword(v,NLpScl); /* strip guard bits, deposit output */ *Time += dtb; /* Move to next sample by time increment */ } end_sample = (*Time)>>Np; Nx = end_sample - start_sample; return (Y - Ystart); /* Return the number of output samples */ } int aflibConverter::SrcUD( short X[], short Y[], double factor, unsigned int *Time, unsigned short& Nx, unsigned short Nout, unsigned short Nwing, unsigned short LpScl, short Imp[], short ImpD[], bool Interp) { short *Xp, *Ystart; int v; double dh; /* Step through filter impulse response */ double dt; /* Step through input signal */ // unsigned int endTime; /* When Time reaches EndTime, return to user */ unsigned int dhb, dtb; /* Fixed-point versions of Dh,Dt */ unsigned int start_sample, end_sample; dt = 1.0/factor; /* Output sampling period */ dtb = (unsigned int)(dt*(1<>Np; Ystart = Y; // endTime = *Time + (1<>Np]; /* Ptr to current input sample */ v = FilterUD(Imp, ImpD, Nwing, Interp, Xp, (short)(*Time&Pmask), -1, dhb); /* Perform left-wing inner product */ v += FilterUD(Imp, ImpD, Nwing, Interp, Xp+1, (short)((((*Time)^Pmask)+1)&Pmask), 1, dhb); /* Perform right-wing inner product */ v >>= Nhg; /* Make guard bits */ v *= LpScl; /* Normalize for unity filter gain */ *Y++ = WordToHword(v,NLpScl); /* strip guard bits, deposit output */ *Time += dtb; /* Move to next sample by time increment */ } end_sample = (*Time)>>Np; Nx = end_sample - start_sample; return (Y - Ystart); /* Return the number of output samples */ } int aflibConverter::resampleFast( /* number of output samples returned */ int& inCount, /* number of input samples to convert */ int outCount, /* number of output samples to compute */ short inArray[], /* input data */ short outArray[]) /* output data */ { unsigned int Time2; /* Current time/pos in input sample */ #if 0 unsigned short Ncreep; #endif unsigned short Xp, Xoff, Xread; int OBUFFSIZE = (int)(((double)IBUFFSIZE)*_factor); unsigned short Nout = 0, Nx, orig_Nx; unsigned short maxOutput; int total_inCount = 0; int c, i, Ycount, last; bool first_pass = TRUE; Xoff = 10; Nx = IBUFFSIZE - 2*Xoff; /* # of samples to process each iteration */ last = 0; /* Have not read last input sample yet */ Ycount = 0; /* Current sample and length of output file */ Xp = Xoff; /* Current "now"-sample pointer for input */ Xread = Xoff; /* Position in input array to read into */ if (_initial == TRUE) _Time = (Xoff< (OBUFFSIZE - (2*Xoff*_factor)) ) maxOutput = OBUFFSIZE - (unsigned short)(2*Xoff*_factor); else maxOutput = outCount-Ycount; for (c = 0; c < _nChans; c++) { orig_Nx = Nx; Time2 = _Time; /* Resample stuff in input buffer */ Nout=SrcLinear(_II[c],_JJ[c],_factor,&Time2,orig_Nx,maxOutput); } Nx = orig_Nx; _Time = Time2; _Time -= (Nx<>Np) - Xoff; /* Calc time accumulation in Time */ if (Ncreep) { Time -= (Ncreep<outCount) { Nout -= (Ycount-outCount); Ycount = outCount; } if (Nout > OBUFFSIZE) /* Check to see if output buff overflowed */ return err_ret("Output array overflow"); for (c = 0; c < _nChans; c++) for (i = 0; i < Nout; i++) outArray[c * outCount + i + Ycount - Nout] = _JJ[c][i]; total_inCount += Nx; } while (Ycount < outCount); /* Continue until done */ inCount = total_inCount; return(Ycount); /* Return # of samples in output file */ } int aflibConverter::resampleWithFilter( /* number of output samples returned */ int& inCount, /* number of input samples to convert */ int outCount, /* number of output samples to compute */ short inArray[], /* input data */ short outArray[], /* output data */ short Imp[], short ImpD[], unsigned short LpScl, unsigned short Nmult, unsigned short Nwing) { unsigned int Time2; /* Current time/pos in input sample */ #if 0 unsigned short Ncreep; #endif unsigned short Xp, Xoff, Xread; int OBUFFSIZE = (int)(((double)IBUFFSIZE)*_factor); unsigned short Nout = 0, Nx, orig_Nx; unsigned short maxOutput; int total_inCount = 0; int c, i, Ycount, last; bool first_pass = TRUE; /* Account for increased filter gain when using factors less than 1 */ if (_factor < 1) LpScl = (unsigned short)(LpScl*_factor + 0.5); /* Calc reach of LP filter wing & give some creeping room */ Xoff = (unsigned short)(((Nmult+1)/2.0) * MAX(1.0,1.0/_factor) + 10); if (IBUFFSIZE < 2*Xoff) /* Check input buffer size */ return err_ret("IBUFFSIZE (or factor) is too small"); Nx = IBUFFSIZE - 2*Xoff; /* # of samples to process each iteration */ last = 0; /* Have not read last input sample yet */ Ycount = 0; /* Current sample and length of output file */ Xp = Xoff; /* Current "now"-sample pointer for input */ Xread = Xoff; /* Position in input array to read into */ if (_initial == TRUE) _Time = (Xoff< (OBUFFSIZE - (2*Xoff*_factor)) ) maxOutput = OBUFFSIZE - (unsigned short)(2*Xoff*_factor); else maxOutput = outCount-Ycount; for (c = 0; c < _nChans; c++) { orig_Nx = Nx; Time2 = _Time; /* Resample stuff in input buffer */ if (_factor >= 1) { /* SrcUp() is faster if we can use it */ Nout=SrcUp(_II[c],_JJ[c],_factor, &Time2,Nx,maxOutput,Nwing,LpScl,Imp,ImpD,interpFilt); } else { Nout=SrcUD(_II[c],_JJ[c],_factor, &Time2,Nx,maxOutput,Nwing,LpScl,Imp,ImpD,interpFilt); } } _Time = Time2; _Time -= (Nx<>Np) - Xoff; /* Calc time accumulation in Time */ if (Ncreep) { Time -= (Ncreep< outCount) { Nout -= (Ycount - outCount); Ycount = outCount; } if (Nout > OBUFFSIZE) /* Check to see if output buff overflowed */ return err_ret("Output array overflow"); for (c = 0; c < _nChans; c++) { for (i = 0; i < Nout; i++) { outArray[c * outCount + i + Ycount - Nout] = _JJ[c][i]; } } int act_incount = (int)Nx; for (c = 0; c < _nChans; c++) { for (i=0; i>Na]; End = &Imp[Nwing]; if (Interp) { Hdp = &ImpD[Ph>>Na]; a = Ph & Amask; } if (Inc == 1) /* If doing right wing... */ { /* ...drop extra coeff, so when Ph is */ End--; /* 0.5, we don't do too many mult's */ if (Ph == 0) /* If the phase is zero... */ { /* ...then we've already skipped the */ Hp += Npc; /* first sample, so we must also */ Hdp += Npc; /* skip ahead in Imp[] and ImpD[] */ } } if (Interp) { while (Hp < End) { t = *Hp; /* Get filter coeff */ t += (((int)*Hdp)*a)>>Na; /* t is now interp'd filter coeff */ Hdp += Npc; /* Filter coeff differences step */ t *= *Xp; /* Mult coeff by input sample */ if (t & (1<<(Nhxn-1))) /* Round, if needed */ t += (1<<(Nhxn-1)); t >>= Nhxn; /* Leave some guard bits, but come back some */ v += t; /* The filter output */ Hp += Npc; /* Filter coeff step */ Xp += Inc; /* Input signal step. NO CHECK ON BOUNDS */ } } else { while (Hp < End) { t = *Hp; /* Get filter coeff */ t *= *Xp; /* Mult coeff by input sample */ if (t & (1<<(Nhxn-1))) /* Round, if needed */ t += (1<<(Nhxn-1)); t >>= Nhxn; /* Leave some guard bits, but come back some */ v += t; /* The filter output */ Hp += Npc; /* Filter coeff step */ Xp += Inc; /* Input signal step. NO CHECK ON BOUNDS */ } } return(v); } int aflibConverter::FilterUD( short Imp[], short ImpD[], unsigned short Nwing, bool Interp, short *Xp, short Ph, short Inc, unsigned short dhb) { short a; short *Hp, *Hdp, *End; int v, t; unsigned int Ho; v=0; Ho = (Ph*(unsigned int)dhb)>>Np; End = &Imp[Nwing]; if (Inc == 1) /* If doing right wing... */ { /* ...drop extra coeff, so when Ph is */ End--; /* 0.5, we don't do too many mult's */ if (Ph == 0) /* If the phase is zero... */ Ho += dhb; /* ...then we've already skipped the */ } /* first sample, so we must also */ /* skip ahead in Imp[] and ImpD[] */ if (Interp) { while ((Hp = &Imp[Ho>>Na]) < End) { t = *Hp; /* Get IR sample */ Hdp = &ImpD[Ho>>Na]; /* get interp (lower Na) bits from diff table*/ a = Ho & Amask; /* a is logically between 0 and 1 */ t += (((int)*Hdp)*a)>>Na; /* t is now interp'd filter coeff */ t *= *Xp; /* Mult coeff by input sample */ if (t & 1<<(Nhxn-1)) /* Round, if needed */ t += 1<<(Nhxn-1); t >>= Nhxn; /* Leave some guard bits, but come back some */ v += t; /* The filter output */ Ho += dhb; /* IR step */ Xp += Inc; /* Input signal step. NO CHECK ON BOUNDS */ } } else { while ((Hp = &Imp[Ho>>Na]) < End) { t = *Hp; /* Get IR sample */ t *= *Xp; /* Mult coeff by input sample */ if (t & 1<<(Nhxn-1)) /* Round, if needed */ t += 1<<(Nhxn-1); t >>= Nhxn; /* Leave some guard bits, but come back some */ v += t; /* The filter output */ Ho += dhb; /* IR step */ Xp += Inc; /* Input signal step. NO CHECK ON BOUNDS */ } } return(v); } darkice-1.0/src/Exception.h0000644000175000001440000002131611371632310012567 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Exception.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef EXCEPTION_H #define EXCEPTION_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * An exception class. * * This class should not depend on any other class * should not throw any exceptions itself. * * Typical usage: * *
 *  throw Exception( __FILE__, __LINE__, "describe the exception", code);
 *  
* * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class Exception { private: /** * Source file the exception was thrown in. */ char * file; /** * Line number in the source file the exception was thrown in. */ unsigned int line; /** * Textual description of the exception. */ char * description; /** * Numerical error code. */ int code; /** * Initalize the object. * * @param file the source file the exception was thrown in. * @param line the line in the source file. * @param description textual description of the exception. * @param code numerical error code. */ void init ( const char * file, unsigned int line, const char * description, int code ) throw (); /** * De-initalize the object. */ void strip () throw (); protected: public: /** * Default constructor. */ inline Exception ( void ) throw () { init( 0, 0, 0, 0); } /** * Copy constructor. */ inline Exception ( const Exception & e ) throw () { init( e.file, e.line, e.description, e.code); } /** * Construct by a description and error code. * * @param description textual description of the exception. * @param code numerical error code. */ inline Exception ( const char * description, int code = 0 ) throw () { init( 0, 0, description, code); } /** * Construct by source file information, a description and error code. * * @param file the source file the exception was thrown in. * @param line the line in the source file. * @param description textual description of the exception. * @param code numerical error code. */ inline Exception ( const char * file, unsigned int line, const char * description = 0, int code = 0 ) throw () { init( file, line, description, code); } /** * Construct by source file information, a description and error code. * The description is constructed from two strings, any of which * may be NULL. * * @param file the source file the exception was thrown in. * @param line the line in the source file. * @param description1 textual description of the exception part 1. * @param description2 textual description of the exception part 2. * @param code numerical error code. */ Exception ( const char * file, unsigned int line, const char * description1, const char * description2, int code = 0 ) throw (); /** * Construct by source file information, a description and error code. * The description is constructed from three strings, any of * which may be NULL. * * @param file the source file the exception was thrown in. * @param line the line in the source file. * @param description1 textual description of the exception part 1. * @param description2 textual description of the exception part 2. * @param description3 textual description of the exception part 3. * @param code numerical error code. */ Exception ( const char * file, unsigned int line, const char * description1, const char * description2, const char * description3, int code = 0 ) throw (); /** * Desctructor. */ inline ~Exception ( void ) throw () { strip(); } /** * Assignment operator. * * @param e the Exception to assign this to. * @return a reference to this Exception. */ inline Exception & operator= ( const Exception & e ) throw () { if ( this != &e ) { strip(); init( e.file, e.line, e.description, e.code); } return *this; } /** * Return the textual description of the Exception. * * @return the textual description of the Exception. */ inline const char * getDescription( void ) const throw () { return description; } /** * Return the line number in the source file this Exception was * thrown in. * * @return the line number in the source file this Exception was * thrown in. */ inline unsigned int getLine ( void ) const throw () { return line; } /** * Return the source file this Exception was thrown in. * * @return the source file this Exception was thrown in. */ inline const char * getFile ( void ) const throw () { return file; } /** * Return the numerical code of the Exception. * * @return the numerical code of the Exception. */ inline int getCode ( void ) const throw () { return code; } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ /** * Print an Exception to an ostream. * * @param os the output stream to print to. * @param e the Exception to print. * @return a reference to the supplied output stream. */ inline std::ostream & operator<< ( std::ostream & os, const Exception & e ) { os << e.getFile() << ":" << e.getLine() << ": " << e.getDescription() << " [" << e.getCode() << "]"; return os; } #endif /* EXCEPTION_H */ darkice-1.0/src/ConfigSection.h0000644000175000001440000001226511371632310013366 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell ConfigSection File : ConfigSection.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef CONFIG_SECTION_H #define CONFIG_SECTION_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include #include #include "Referable.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A configuration file representation. The file is of the syntax: * *
 *  # this is a whole line comment
 *  key = value
 *  an ugly key name = long value    # this end is a comment too
 *  
* * also empty lines are ignored and all white space is removed * from the front and end of keys / values * * Knwon problem: you can't use '#' in any part of a key / value pair * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class ConfigSection : public virtual Referable { private: /** * Type of the hash table used in this class. */ typedef std::map TableType; /** * Hash table holding the configuration information. */ TableType table; protected: public: /** * Default constructor. * * @exception Exception */ inline ConfigSection ( void ) throw ( Exception ) { } /** * Destructor. * * @exception Exception */ inline virtual ~ConfigSection ( void ) throw ( Exception ) { } /* TODO inline ConfigSection ( const ConfigSection & di ) throw ( Exception ) { } inline ConfigSection & operator= ( const ConfigSection * di ) throw ( Exception ) { } */ /** * Add a key / value pair to the configuration information. * * @param key the key to add the value by * @param value the value to add for the key * @return true if adding was successful, false otherwise * @exception Exception */ virtual bool add ( const char * key, const char * value ) throw ( Exception ); /** * Get a value for a key. * * @param key the key to get the value for * @return the value for the key, or NULL if the key doesn't exist. * @exception Exception */ virtual const char * get ( const char * key ) const throw ( Exception ); /** * Get a value for a key, or throw an Exception. * * @param key the key to get the value for * @param message1 message part 1 of the Exception to be thrown. * @param message2 message part 2 of the Exception to be thrown. * @param code error code of the Exception to be thrown. * @return the value for the key. The return value is never NULL. * @exception Exception */ virtual const char * getForSure ( const char * key, const char * message1 = 0, const char * message2 = 0, int code = 0 ) const throw ( Exception ); /** * Add a line of configuration information. * * @param line the line to add. * @return true if a new key was added, false otherwise. * @exception Exception */ virtual bool addLine ( const char * line ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* CONFIG_SECTION_H */ darkice-1.0/src/CastSink.h0000644000175000001440000003306511371632310012354 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : CastSink.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef CAST_SINK_H #define CAST_SINK_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Ref.h" #include "Reporter.h" #include "Sink.h" #include "TcpSocket.h" #include "BufferedSink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Data output to a ShoutCast / IceCast / etc. server * This is an abstract class. A subclass should override at least * the sendLogin() function. * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class CastSink : public Sink, public virtual Reporter { private: /** * The socket connection to the server. */ Ref socket; /** * The BufferedSink encapsulating the socket connection to the server. */ Ref bufferedSink; /** * An optional Sink to enable stream dumps. */ Ref streamDump; /** * Duration of the BufferedSink buffer in seconds. */ unsigned int bufferDuration; /** * Password to the server. */ char * password; /** * Name of the stream. */ char * name; /** * URL associated with the stream. */ char * url; /** * Genre of the stream. */ char * genre; /** * Bitrate of the stream (e.g. mp3 bitrate). */ unsigned int bitRate; /** * Is the stream public? */ bool isPublic; /** * Initalize the object. * * @param socket socket connection to the server. * @param password password to the server. * @param name name of the stream. * @param url URL associated with the stream. * @param genre genre of the stream. * @param bitRate bitrate of the stream (e.g. mp3 bitrate). * @param isPublic is the stream public? * @param bufferDuration duration of the BufferedSink buffer * in seconds. * @exception Exception */ void init ( TcpSocket * socket, Sink * streamDump, const char * password, unsigned int bitRate, const char * name, const char * url, const char * genre, bool isPublic, unsigned int bufferDuration ) throw ( Exception ); /** * De-initalize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline CastSink ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Log in to the server using the socket avialable. * * @return true if login was successful, false otherwise. * @exception Exception */ virtual bool sendLogin ( void ) throw ( Exception ) = 0; /** * Get the Sink underneath this CastSink. * * @return pointer to the Sink underneath this CastSink. */ inline Sink * getSink ( void ) const throw () { return bufferedSink.get(); } /** * Get the TcpSocket underneath this CastSink. * * @return pointer to the TcpSocket underneath this CastSink. */ inline TcpSocket * getSocket ( void ) const throw () { return socket.get(); } public: /** * Constructor. * * @param socket socket connection to the server. * @param password password to the server. * @param name name of the stream. * @param url URL associated with the stream. * @param genre genre of the stream. * @param bitRate bitrate of the stream (e.g. mp3 bitrate). * @param isPublic is the stream public? * @param streamDump a Sink to dump the streamed binary data to * @param bufferDuration duration of the BufferedSink buffer * in seconds. * @exception Exception */ inline CastSink ( TcpSocket * socket, const char * password, unsigned int bitRate, const char * name = 0, const char * url = 0, const char * genre = 0, bool isPublic = false, Sink * streamDump = 0, unsigned int bufferDuration = 10 ) throw ( Exception ) { init( socket, streamDump, password, bitRate, name, url, genre, isPublic, bufferDuration ); } /** * Copy constructor. * * @param cs the CastSink to copy. */ inline CastSink( const CastSink & cs ) throw ( Exception ) : Sink( cs ) { init( cs.socket.get(), cs.streamDump.get(), cs.password, cs.bitRate, cs.name, cs.url, cs.genre, cs.isPublic, cs.bufferDuration ); } /** * Destructor. * * @exception Exception */ inline virtual ~CastSink( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param cs the CastSink to assign this to. * @return a reference to this CastSink. * @exception Exception */ inline virtual CastSink & operator= ( const CastSink & cs ) throw ( Exception ) { if ( this != &cs ) { strip(); Sink::operator=( cs ); init( cs.socket.get(), cs.streamDump.get(), cs.password, cs.bitRate, cs.name, cs.url, cs.genre, cs.isPublic, cs.bufferDuration ); } return *this; } /** * Open the CastSink. * Logs in to the server. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the CastSink is open. * * @return true if the CastSink is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return bufferedSink != NULL ? bufferedSink->isOpen() : false; } /** * Check if the CastSink is ready to accept data. * Blocks until the specified time for data to be available. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the CastSink is ready to accept data, * false otherwise. * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { return getSink()->canWrite( sec, usec); } /** * Write data to the CastSink. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ inline virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ) { if ( streamDump != 0 ) { streamDump->write( buf, len); } return getSink()->write( buf, len); } /** * Flush all data that was written to the CastSink to the server. * * @exception Exception */ inline virtual void flush ( void ) throw ( Exception ) { if ( streamDump != 0 ) { streamDump->flush(); } return getSink()->flush(); } /** * Cut what the sink has been doing so far, and start anew. * This usually means separating the data sent to the sink up * until now, and start saving a new chunk of data. */ inline virtual void cut ( void ) throw () { if ( streamDump != 0 ) { streamDump->cut(); } } /** * Close the CastSink. * * @exception Exception */ inline virtual void close ( void ) throw ( Exception ) { if ( streamDump != 0 ) { streamDump->close(); } return getSink()->close(); } /** * Get the password to the server. * * @return the password to the server. */ inline const char * getPassword ( void ) const throw () { return password; } /** * Get the name of the stream. * * @return the name of the stream. */ inline const char * getName ( void ) const throw () { return name; } /** * Get the URL associated with the stream. * * @return the URL associated with the stream. */ inline const char * getUrl ( void ) const throw () { return url; } /** * Get the genre of the stream. * * @return the genre of the stream. */ inline const char * getGenre ( void ) const throw () { return genre; } /** * Get the bitrate of the stream (e.g. mp3 bitrate). * * @return the bitrate of the stream (e.g. mp3 bitrate). */ inline unsigned int getBitRate ( void ) const throw () { return bitRate; } /** * Get wether this stream is public. * * @return true if the stream is public, false otherwise. */ inline bool getIsPublic ( void ) const throw () { return isPublic; } /** * Get the duration of the BufferedSink buffer in seconds. * * @return the the duration of the BufferedSink buffer in seconds. */ inline unsigned int getBufferDuration ( void ) const throw () { return bufferDuration; } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* CAST_SINK_H */ darkice-1.0/src/ShoutCast.h0000644000175000001440000002042611371632310012547 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : ShoutCast.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef SHOUT_CAST_H #define SHOUT_CAST_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Sink.h" #include "TcpSocket.h" #include "CastSink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Class representing output to a ShoutCast server with * icy login * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class ShoutCast : public CastSink { private: /** * IRC info string for the stream */ char * irc; /** * AIM info string for the stream */ char * aim; /** * ICQ info string for the stream */ char * icq; /** * The optional mountPoint */ char * mountPoint; /** * Initalize the object. * * @param irc IRC info string for the stream. * @param aim AIM info string for the stream. * @param icq ICQ info string for the stream. * @param mountPoint Optional mount point information * @exception Exception */ void init ( const char * irc, const char * aim, const char * icq, const char * mountPoint ) throw ( Exception ); /** * De-initalize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline ShoutCast ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Log in to the server using the socket avialable. * * @return true if login was successful, false otherwise. * @exception Exception */ virtual bool sendLogin ( void ) throw ( Exception ); public: /** * Constructor. * * @param socket socket connection to the server. * @param password password to the server. * @param mountPoint Optional mount point for DSS. * @param name name of the stream. * @param url URL associated with the stream. * @param genre genre of the stream. * @param bitRate bitrate of the stream (e.g. mp3 bitrate). * @param isPublic is the stream public? * @param irc IRC info string for the stream. * @param aim AIM info string for the stream. * @param icq ICQ info string for the stream. * @param streamDump an optional sink to dump the binary stream * data to. * @param bufferDuration duration of the BufferedSink buffer * in seconds. * @exception Exception */ inline ShoutCast ( TcpSocket * socket, const char * password, const char * mountPoint, unsigned int bitRate, const char * name = 0, const char * url = 0, const char * genre = 0, bool isPublic = false, const char * irc = 0, const char * aim = 0, const char * icq = 0, Sink * streamDump = 0, unsigned int bufferDuration = 10 ) throw ( Exception ) : CastSink( socket, password, bitRate, name, url, genre, isPublic, streamDump, bufferDuration ) { init( irc, aim, icq, mountPoint ); } /** * Copy constructor. * * @param cs the ShoutCast to copy. */ inline ShoutCast( const ShoutCast & cs ) throw ( Exception ) : CastSink( cs ) { init( cs.getIrc(), cs.getAim(), cs.getIcq(), cs.getMountPoint()); } /** * Destructor. * * @exception Exception */ inline virtual ~ShoutCast( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param cs the ShoutCast to assign this to. * @return a reference to this ShoutCast. * @exception Exception */ inline virtual ShoutCast & operator= ( const ShoutCast & cs ) throw ( Exception ) { if ( this != &cs ) { strip(); CastSink::operator=( cs ); init( cs.getIrc(), cs.getAim(), cs.getIcq(), getMountPoint()); } return *this; } /** * Get the mount point of the stream on the server. * The mount point can be null if it has not been set * (typical Shoutcast server) or not null (for instance * with Darwin Streaming Server). In that case, the * authentication process will be slightly different. * * @return the mount point of the stream on the server. */ inline const char * getMountPoint ( void ) const throw () { return mountPoint; } /** * Get the IRC info string for the stream. * * @return the IRC info string for the stream. */ inline const char * getIrc ( void ) const throw () { return irc; } /** * Get the AIM info string for the stream. * * @return the AIM info string for the stream. */ inline const char * getAim ( void ) const throw () { return aim; } /** * Get the ICQ info string for the stream. * * @return the ICQ info string for the stream. */ inline const char * getIcq ( void ) const throw () { return icq; } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* SHOUT_CAST_H */ darkice-1.0/src/IceCast2.h0000644000175000001440000001733511371632310012234 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : IceCast2.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef ICE_CAST2_H #define ICE_CAST2_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Sink.h" #include "TcpSocket.h" #include "CastSink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Class representing output to an IceCast2 server with * ice login * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class IceCast2 : public CastSink { public: /** * Type for specifying the format of the stream. */ enum StreamFormat { mp3, mp2, oggVorbis, aac, aacp }; private: /** * The format of the stream. */ StreamFormat format; /** * Mount point of the stream on the server. */ char * mountPoint; /** * Description of the stream. */ char * description; /** * Initalize the object. * * @param mountPoint mount point of the stream on the server. * @param remoteDumpFile remote dump file (may be NULL). * @param description description of the stream. * @exception Exception */ void init ( StreamFormat format, const char * mountPoint, const char * description ) throw ( Exception ); /** * De-initalize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline IceCast2 ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Log in to the server using the socket avialable. * * @return true if login was successful, false otherwise. * @exception Exception */ virtual bool sendLogin ( void ) throw ( Exception ); public: /** * Constructor. * * @param socket socket connection to the server. * @param password password to the server. * @param mountPoint mount point of the stream on the server. * @param format the format of the stream. * @param name name of the stream. * @param description description of the stream. * @param url URL associated with the stream. * @param genre genre of the stream. * @param bitRate bitrate of the stream (e.g. mp3 bitrate). * @param isPublic is the stream public? * @param streamDump an optional sink to dump the binary stream * data to. * @param bufferDuration duration of the BufferedSink buffer * in seconds. * @exception Exception */ inline IceCast2 ( TcpSocket * socket, const char * password, const char * mountPoint, StreamFormat format, unsigned int bitRate, const char * name = 0, const char * description = 0, const char * url = 0, const char * genre = 0, bool isPublic = false, Sink * streamDump = 0, unsigned int bufferDuration = 10 ) throw ( Exception ) : CastSink( socket, password, bitRate, name, url, genre, isPublic, streamDump, bufferDuration ) { init( format, mountPoint, description); } /** * Copy constructor. * * @param cs the IceCast2 to copy. */ inline IceCast2( const IceCast2 & cs ) throw ( Exception ) : CastSink( cs ) { init( cs.getFormat(), cs.getMountPoint(), cs.getDescription() ); } /** * Destructor. * * @exception Exception */ inline virtual ~IceCast2( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param cs the IceCast2 to assign this to. * @return a reference to this IceCast2. * @exception Exception */ inline virtual IceCast2 & operator= ( const IceCast2 & cs ) throw ( Exception ) { if ( this != &cs ) { strip(); CastSink::operator=( cs ); init( cs.getFormat(), cs.getMountPoint(), cs.getDescription() ); } return *this; } /** * Get the format of the stream. * * @return the format of the stream. */ inline StreamFormat getFormat ( void ) const throw () { return format; } /** * Get the mount point of the stream on the server. * * @return the mount point of the stream on the server. */ inline const char * getMountPoint ( void ) const throw () { return mountPoint; } /** * Get the description of the stream. * * @return the description of the stream. */ inline const char * getDescription ( void ) const throw () { return description; } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* ICE_CAST2_H */ darkice-1.0/src/DarkIce.h0000644000175000001440000002140211371632310012127 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : DarkIce.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef DARK_ICE_H #define DARK_ICE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #include #include "Referable.h" #include "Reporter.h" #include "Exception.h" #include "Ref.h" #include "AudioSource.h" #include "BufferedSink.h" #include "Connector.h" #include "AudioEncoder.h" #include "TcpSocket.h" #include "CastSink.h" #include "DarkIceConfig.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Program main object. * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class DarkIce : public virtual Referable, public virtual Reporter { private: /** * The maximum number of supported outputs. This should be * * */ static const unsigned int maxOutput = 4 * 7; /** * Type describing each lame library output. */ typedef struct { Ref encoder; Ref socket; Ref server; } Output; /** * The outputs. */ Output audioOuts[maxOutput]; /** * Number of lame library outputs. */ unsigned int noAudioOuts; /** * Duration of playing, in seconds. */ unsigned int duration; /** * The dsp to record from. */ Ref dsp; /** * The encoding Connector, connecting the dsp to the encoders. */ Ref encConnector; /** * Should we turn real-time scheduling on ? */ int enableRealTime; /** * Original scheduling policy */ int origSchedPolicy; /** * Original scheduling priority */ int origSchedPriority; /** * Initialize the object. * * @param config the config Object to read initialization * information from. * @exception Exception */ void init ( const Config & config ) throw ( Exception ); /** * Look for the icecast stream outputs from the config file. * Called from init() * * @param config the config Object to read initialization * information from. * @param bufferSecs number of seconds to buffer audio for * @exception Exception */ void configIceCast ( const Config & config, unsigned int bufferSecs ) throw ( Exception ); /** * Look for the icecast2 stream outputs from the config file. * Called from init() * * @param config the config Object to read initialization * information from. * @param bufferSecs number of seconds to buffer audio for * @exception Exception */ void configIceCast2 ( const Config & config, unsigned int bufferSecs ) throw ( Exception ); /** * Look for the shoutcast stream outputs from the config file. * Called from init() * * @param config the config Object to read initialization * information from. * @param bufferSecs number of seconds to buffer audio for * @exception Exception */ void configShoutCast ( const Config & config, unsigned int bufferSecs ) throw ( Exception ); /** * Look for file outputs from the config file. * Called from init() * * @param config the config Object to read initialization * information from. * @exception Exception */ void configFileCast ( const Config & config ) throw ( Exception ); /** * Set POSIX real-time scheduling for the encoding process, * if user permissions enable it. * * @exception Exception */ void setRealTimeScheduling ( void ) throw ( Exception ); /** * Set the scheduling that was before setting real-time scheduling. * This function must be called _only_ after setRealTimeScheduling. * * @exception Exception */ void setOriginalScheduling ( void ) throw ( Exception ); /** * Start encoding. Spawns all encoders, opens the dsp and * starts sending data to the encoders. * * @return if encoding was successful. * @exception Exception */ bool encode ( void ) throw ( Exception ); /** * Start shouting. fork()-s a process for each output, reads * the output of the encoders and sends them to an IceCast server. * * @return if shouting was successful. * @exception Exception */ bool shout ( unsigned int ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline DarkIce ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor based on a configuration object. * * @param config the config Object to read initialization * information from. * @exception Exception */ inline DarkIce ( const Config & config ) throw ( Exception ) { init( config); } /** * Destructor. * * @exception Exception */ inline virtual ~DarkIce ( void ) throw ( Exception ) { } /* TODO inline DarkIce ( const DarkIce & di ) throw ( Exception ) { } inline DarkIce & operator= ( const DarkIce * di ) throw ( Exception ) { } */ /** * Run the process of recording / encoding / sending to the servers. * * @return 0 on success * @exception Exception */ virtual int run ( void ) throw ( Exception ); /** * Signal to each sink we have that they need to cut what they are * doing, and start again. For FileSinks, this usually means to * save the archive file recorded so far, and start a new archive * file. */ virtual void cut ( void ) throw (); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* DARK_ICE_H */ darkice-1.0/src/DarkIce.cpp0000644000175000001440000014050011371632310012463 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : DarkIce.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDLIB_H #include #else #error need stdlib.h #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_SYS_TYPES_H #include #else #error need sys/types.h #endif #ifdef HAVE_SYS_WAIT_H #include #else #error need sys/wait.h #endif #ifdef HAVE_ERRNO_H #include #else #error need errno.h #endif #ifdef HAVE_SCHED_H #include #else #error need sched.h #endif #include "Util.h" #include "IceCast.h" #include "IceCast2.h" #include "ShoutCast.h" #include "FileCast.h" #include "MultiThreadedConnector.h" #include "DarkIce.h" #ifdef HAVE_LAME_LIB #include "LameLibEncoder.h" #endif #ifdef HAVE_TWOLAME_LIB #include "TwoLameLibEncoder.h" #endif #ifdef HAVE_VORBIS_LIB #include "VorbisLibEncoder.h" #endif #ifdef HAVE_FAAC_LIB #include "FaacEncoder.h" #endif #ifdef HAVE_AACPLUS_LIB #include "aacPlusEncoder.h" #endif /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: DarkIce.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Make sure wait-related stuff is what we expect *----------------------------------------------------------------------------*/ #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void DarkIce :: init ( const Config & config ) throw ( Exception ) { unsigned int bufferSecs; const ConfigSection * cs; const char * str; unsigned int sampleRate; unsigned int bitsPerSample; unsigned int channel; bool reconnect; const char * device; const char * jackClientName; // the [general] section if ( !(cs = config.get( "general")) ) { throw Exception( __FILE__, __LINE__, "no section [general] in config"); } str = cs->getForSure( "duration", " missing in section [general]"); duration = Util::strToL( str); str = cs->getForSure( "bufferSecs", " missing in section [general]"); bufferSecs = Util::strToL( str); if (bufferSecs == 0) { throw Exception(__FILE__, __LINE__, "setting bufferSecs to 0 not supported"); } str = cs->get( "reconnect"); reconnect = str ? (Util::strEq( str, "yes") ? true : false) : true; // real-time scheduling is enabled by default str = cs->get( "realtime" ); enableRealTime = str ? (Util::strEq( str, "yes") ? true : false) : true; // the [input] section if ( !(cs = config.get( "input")) ) { throw Exception( __FILE__, __LINE__, "no section [input] in config"); } str = cs->getForSure( "sampleRate", " missing in section [input]"); sampleRate = Util::strToL( str); str = cs->getForSure( "bitsPerSample", " missing in section [input]"); bitsPerSample = Util::strToL( str); str = cs->getForSure( "channel", " missing in section [input]"); channel = Util::strToL( str); device = cs->getForSure( "device", " missing in section [input]"); jackClientName = cs->get ( "jackClientName"); dsp = AudioSource::createDspSource( device, jackClientName, sampleRate, bitsPerSample, channel ); encConnector = new MultiThreadedConnector( dsp.get(), reconnect ); noAudioOuts = 0; configIceCast( config, bufferSecs); configIceCast2( config, bufferSecs); configShoutCast( config, bufferSecs); configFileCast( config); } /*------------------------------------------------------------------------------ * Look for the IceCast stream outputs in the config file *----------------------------------------------------------------------------*/ void DarkIce :: configIceCast ( const Config & config, unsigned int bufferSecs ) throw ( Exception ) { // look for IceCast encoder output streams, // sections [icecast-0], [icecast-1], ... char stream[] = "icecast- "; size_t streamLen = Util::strLen( stream); unsigned int u; for ( u = noAudioOuts; u < maxOutput; ++u ) { const ConfigSection * cs; // ugly hack to change the section name to "stream0", "stream1", etc. stream[streamLen-1] = '0' + (u - noAudioOuts); if ( !(cs = config.get( stream)) ) { break; } #if !defined HAVE_LAME_LIB && !defined HAVE_TWOLAME_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with lame or twolame support, " "thus can't connect to IceCast 1.x, stream: ", stream); #else const char * str; unsigned int sampleRate = 0; unsigned int channel = 0; AudioEncoder::BitrateMode bitrateMode; unsigned int bitrate = 0; double quality = 0.0; const char * server = 0; unsigned int port = 0; const char * password = 0; const char * mountPoint = 0; const char * remoteDumpFile = 0; const char * name = 0; const char * description = 0; const char * url = 0; const char * genre = 0; bool isPublic = false; int lowpass = 0; int highpass = 0; const char * localDumpName = 0; FileSink * localDumpFile = 0; bool fileAddDate = false; const char * fileDateFormat = 0; str = cs->get( "sampleRate"); sampleRate = str ? Util::strToL( str) : dsp->getSampleRate(); str = cs->get( "channel"); channel = str ? Util::strToL( str) : dsp->getChannel(); str = cs->get( "bitrate"); bitrate = str ? Util::strToL( str) : 0; str = cs->get( "quality"); quality = str ? Util::strToD( str) : 0.0; str = cs->getForSure( "bitrateMode", " not specified in section ", stream); if ( Util::strEq( str, "cbr") ) { bitrateMode = AudioEncoder::cbr; if ( bitrate == 0 ) { throw Exception( __FILE__, __LINE__, "bitrate not specified for CBR encoding"); } if ( cs->get( "quality" ) == 0 ) { throw Exception( __FILE__, __LINE__, "quality not specified for CBR encoding"); } } else if ( Util::strEq( str, "abr") ) { bitrateMode = AudioEncoder::abr; if ( bitrate == 0 ) { throw Exception( __FILE__, __LINE__, "bitrate not specified for ABR encoding"); } } else if ( Util::strEq( str, "vbr") ) { bitrateMode = AudioEncoder::vbr; if ( cs->get( "quality" ) == 0 ) { throw Exception( __FILE__, __LINE__, "quality not specified for VBR encoding"); } } else { throw Exception( __FILE__, __LINE__, "invalid bitrate mode: ", str); } server = cs->getForSure( "server", " missing in section ", stream); str = cs->getForSure( "port", " missing in section ", stream); port = Util::strToL( str); password = cs->getForSure("password"," missing in section ",stream); mountPoint = cs->getForSure( "mountPoint", " missing in section ", stream); remoteDumpFile = cs->get( "remoteDumpFile"); name = cs->get( "name"); description = cs->get("description"); url = cs->get( "url"); genre = cs->get( "genre"); str = cs->get( "public"); isPublic = str ? (Util::strEq( str, "yes") ? true : false) : false; str = cs->get( "lowpass"); lowpass = str ? Util::strToL( str) : 0; str = cs->get( "highpass"); highpass = str ? Util::strToL( str) : 0; str = cs->get("fileAddDate"); fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false; fileDateFormat = cs->get("fileDateFormat"); localDumpName = cs->get( "localDumpFile"); // go on and create the things // check for and create the local dump file if needed if ( localDumpName != 0 ) { if ( fileAddDate ) { if (fileDateFormat == 0) { localDumpName = Util::fileAddDate(localDumpName); } else { localDumpName = Util::fileAddDate( localDumpName, fileDateFormat ); } } localDumpFile = new FileSink( stream, localDumpName); if ( !localDumpFile->exists() ) { if ( !localDumpFile->create() ) { reportEvent( 1, "can't create local dump file", localDumpName); localDumpFile = 0; } } if ( fileAddDate ) { delete[] localDumpFile; } } // streaming related stuff audioOuts[u].socket = new TcpSocket( server, port); audioOuts[u].server = new IceCast( audioOuts[u].socket.get(), password, mountPoint, bitrate, name, description, url, genre, isPublic, remoteDumpFile, localDumpFile, bufferSecs ); str = cs->getForSure( "format", " missing in section ", stream); if (!Util::strEq(str, "mp3") && !Util::strEq(str, "mp2")) { throw Exception( __FILE__, __LINE__, "unsupported stream format: ", str); } #ifdef HAVE_LAME_LIB if ( Util::strEq( str, "mp3") ) { audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, channel, lowpass, highpass ); } #endif #ifdef HAVE_TWOLAME_LIB if ( Util::strEq( str, "mp2") ) { audioOuts[u].encoder = new TwoLameLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, sampleRate, channel ); } #endif encConnector->attach( audioOuts[u].encoder.get()); #endif // HAVE_LAME_LIB || HAVE_TWOLAME_LIB } noAudioOuts += u; } /*------------------------------------------------------------------------------ * Look for the IceCast2 stream outputs in the config file *----------------------------------------------------------------------------*/ void DarkIce :: configIceCast2 ( const Config & config, unsigned int bufferSecs ) throw ( Exception ) { // look for IceCast2 encoder output streams, // sections [icecast2-0], [icecast2-1], ... char stream[] = "icecast2- "; size_t streamLen = Util::strLen( stream); unsigned int u; for ( u = noAudioOuts; u < maxOutput; ++u ) { const ConfigSection * cs; // ugly hack to change the section name to "stream0", "stream1", etc. stream[streamLen-1] = '0' + (u - noAudioOuts); if ( !(cs = config.get( stream)) ) { break; } const char * str; IceCast2::StreamFormat format; unsigned int sampleRate = 0; unsigned int channel = 0; AudioEncoder::BitrateMode bitrateMode; unsigned int bitrate = 0; unsigned int maxBitrate = 0; double quality = 0.0; const char * server = 0; unsigned int port = 0; const char * password = 0; const char * mountPoint = 0; const char * name = 0; const char * description = 0; const char * url = 0; const char * genre = 0; bool isPublic = false; int lowpass = 0; int highpass = 0; const char * localDumpName = 0; FileSink * localDumpFile = 0; bool fileAddDate = false; const char * fileDateFormat = 0; str = cs->getForSure( "format", " missing in section ", stream); if ( Util::strEq( str, "vorbis") ) { format = IceCast2::oggVorbis; } else if ( Util::strEq( str, "mp3") ) { format = IceCast2::mp3; } else if ( Util::strEq( str, "mp2") ) { format = IceCast2::mp2; } else if ( Util::strEq( str, "aac") ) { format = IceCast2::aac; } else if ( Util::strEq( str, "aacp") ) { format = IceCast2::aacp; } else { throw Exception( __FILE__, __LINE__, "unsupported stream format: ", str); } str = cs->get( "sampleRate"); sampleRate = str ? Util::strToL( str) : dsp->getSampleRate(); str = cs->get( "channel"); channel = str ? Util::strToL( str) : dsp->getChannel(); // determine fixed bitrate or variable bitrate quality str = cs->get( "bitrate"); bitrate = str ? Util::strToL( str) : 0; str = cs->get( "maxBitrate"); maxBitrate = str ? Util::strToL( str) : 0; str = cs->get( "quality"); quality = str ? Util::strToD( str) : 0.0; str = cs->getForSure( "bitrateMode", " not specified in section ", stream); if ( Util::strEq( str, "cbr") ) { bitrateMode = AudioEncoder::cbr; if ( bitrate == 0 ) { throw Exception( __FILE__, __LINE__, "bitrate not specified for CBR encoding"); } } else if ( Util::strEq( str, "abr") ) { bitrateMode = AudioEncoder::abr; if ( bitrate == 0 ) { throw Exception( __FILE__, __LINE__, "bitrate not specified for ABR encoding"); } } else if ( Util::strEq( str, "vbr") ) { bitrateMode = AudioEncoder::vbr; if ( cs->get( "quality" ) == 0 ) { throw Exception( __FILE__, __LINE__, "quality not specified for VBR encoding"); } } else { throw Exception( __FILE__, __LINE__, "invalid bitrate mode: ", str); } server = cs->getForSure( "server", " missing in section ", stream); str = cs->getForSure( "port", " missing in section ", stream); port = Util::strToL( str); password = cs->getForSure("password"," missing in section ",stream); mountPoint = cs->getForSure( "mountPoint", " missing in section ", stream); name = cs->get( "name"); description = cs->get( "description"); url = cs->get( "url"); genre = cs->get( "genre"); str = cs->get( "public"); isPublic = str ? (Util::strEq( str, "yes") ? true : false) : false; str = cs->get( "lowpass"); lowpass = str ? Util::strToL( str) : 0; str = cs->get( "highpass"); highpass = str ? Util::strToL( str) : 0; str = cs->get( "fileAddDate"); fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false; fileDateFormat = cs->get( "fileDateFormat"); localDumpName = cs->get( "localDumpFile"); // go on and create the things // check for and create the local dump file if needed if ( localDumpName != 0 ) { if ( fileAddDate ) { if (fileDateFormat == 0) { localDumpName = Util::fileAddDate(localDumpName); } else { localDumpName = Util::fileAddDate( localDumpName, fileDateFormat ); } } localDumpFile = new FileSink( stream, localDumpName); if ( !localDumpFile->exists() ) { if ( !localDumpFile->create() ) { reportEvent( 1, "can't create local dump file", localDumpName); localDumpFile = 0; } } if ( fileAddDate ) { delete[] localDumpName; } } // streaming related stuff audioOuts[u].socket = new TcpSocket( server, port); audioOuts[u].server = new IceCast2( audioOuts[u].socket.get(), password, mountPoint, format, bitrate, name, description, url, genre, isPublic, localDumpFile, bufferSecs ); switch ( format ) { case IceCast2::mp3: #ifndef HAVE_LAME_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with lame support, " "thus can't create mp3 stream: ", stream); #else audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, channel, lowpass, highpass ); #endif // HAVE_LAME_LIB break; case IceCast2::oggVorbis: #ifndef HAVE_VORBIS_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with Ogg Vorbis support, " "thus can't Ogg Vorbis stream: ", stream); #else audioOuts[u].encoder = new VorbisLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, dsp->getChannel(), maxBitrate); #endif // HAVE_VORBIS_LIB break; case IceCast2::mp2: #ifndef HAVE_TWOLAME_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with TwoLame support, " "thus can't create mp2 stream: ", stream); #else audioOuts[u].encoder = new TwoLameLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, sampleRate, channel ); #endif // HAVE_TWOLAME_LIB break; case IceCast2::aac: #ifndef HAVE_FAAC_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with AAC support, " "thus can't aac stream: ", stream); #else audioOuts[u].encoder = new FaacEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, dsp->getChannel()); #endif // HAVE_FAAC_LIB break; case IceCast2::aacp: #ifndef HAVE_AACPLUS_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with AAC+ support, " "thus can't aacp stream: ", stream); #else audioOuts[u].encoder = new aacPlusEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, channel ); #endif // HAVE_AACPLUS_LIB break; default: throw Exception( __FILE__, __LINE__, "Illegal stream format: ", format); } encConnector->attach( audioOuts[u].encoder.get()); } noAudioOuts += u; } /*------------------------------------------------------------------------------ * Look for the ShoutCast stream outputs in the config file *----------------------------------------------------------------------------*/ void DarkIce :: configShoutCast ( const Config & config, unsigned int bufferSecs ) throw ( Exception ) { // look for Shoutcast encoder output streams, // sections [shoutcast-0], [shoutcast-1], ... char stream[] = "shoutcast- "; size_t streamLen = Util::strLen( stream); unsigned int u; for ( u = noAudioOuts; u < maxOutput; ++u ) { const ConfigSection * cs; // ugly hack to change the section name to "stream0", "stream1", etc. stream[streamLen-1] = '0' + (u - noAudioOuts); if ( !(cs = config.get( stream)) ) { break; } #ifndef HAVE_LAME_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with lame support, " "thus can't connect to ShoutCast, stream: ", stream); #else const char * str; unsigned int sampleRate = 0; unsigned int channel = 0; AudioEncoder::BitrateMode bitrateMode; unsigned int bitrate = 0; double quality = 0.0; const char * server = 0; unsigned int port = 0; const char * password = 0; const char * name = 0; const char * url = 0; const char * genre = 0; bool isPublic = false; const char * mountPoint = 0; int lowpass = 0; int highpass = 0; const char * irc = 0; const char * aim = 0; const char * icq = 0; const char * localDumpName = 0; FileSink * localDumpFile = 0; bool fileAddDate = false; const char * fileDateFormat = 0; str = cs->get( "sampleRate"); sampleRate = str ? Util::strToL( str) : dsp->getSampleRate(); str = cs->get( "channel"); channel = str ? Util::strToL( str) : dsp->getChannel(); str = cs->get( "bitrate"); bitrate = str ? Util::strToL( str) : 0; str = cs->get( "quality"); quality = str ? Util::strToD( str) : 0.0; str = cs->getForSure( "bitrateMode", " not specified in section ", stream); if ( Util::strEq( str, "cbr") ) { bitrateMode = AudioEncoder::cbr; if ( bitrate == 0 ) { throw Exception( __FILE__, __LINE__, "bitrate not specified for CBR encoding"); } if ( cs->get( "quality" ) == 0 ) { throw Exception( __FILE__, __LINE__, "quality not specified for CBR encoding"); } } else if ( Util::strEq( str, "abr") ) { bitrateMode = AudioEncoder::abr; if ( bitrate == 0 ) { throw Exception( __FILE__, __LINE__, "bitrate not specified for ABR encoding"); } } else if ( Util::strEq( str, "vbr") ) { bitrateMode = AudioEncoder::vbr; if ( cs->get( "quality" ) == 0 ) { throw Exception( __FILE__, __LINE__, "quality not specified for VBR encoding"); } } else { throw Exception( __FILE__, __LINE__, "invalid bitrate mode: ", str); } server = cs->getForSure( "server", " missing in section ", stream); str = cs->getForSure( "port", " missing in section ", stream); port = Util::strToL( str); password = cs->getForSure("password"," missing in section ",stream); name = cs->get( "name"); mountPoint = cs->get( "mountPoint" ); url = cs->get( "url"); genre = cs->get( "genre"); str = cs->get( "public"); isPublic = str ? (Util::strEq( str, "yes") ? true : false) : false; str = cs->get( "lowpass"); lowpass = str ? Util::strToL( str) : 0; str = cs->get( "highpass"); highpass = str ? Util::strToL( str) : 0; irc = cs->get( "irc"); aim = cs->get( "aim"); icq = cs->get( "icq"); str = cs->get("fileAddDate"); fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false; fileDateFormat = cs->get( "fileDateFormat"); localDumpName = cs->get( "localDumpFile"); // go on and create the things // check for and create the local dump file if needed if ( localDumpName != 0 ) { if ( fileAddDate ) { if (fileDateFormat == 0) { localDumpName = Util::fileAddDate(localDumpName); } else { localDumpName = Util::fileAddDate( localDumpName, fileDateFormat ); } } localDumpFile = new FileSink( stream, localDumpName); if ( !localDumpFile->exists() ) { if ( !localDumpFile->create() ) { reportEvent( 1, "can't create local dump file", localDumpName); localDumpFile = 0; } } if ( fileAddDate ) { delete[] localDumpFile; } } // streaming related stuff audioOuts[u].socket = new TcpSocket( server, port); audioOuts[u].server = new ShoutCast( audioOuts[u].socket.get(), password, mountPoint, bitrate, name, url, genre, isPublic, irc, aim, icq, localDumpFile, bufferSecs ); audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, channel, lowpass, highpass ); encConnector->attach( audioOuts[u].encoder.get()); #endif // HAVE_LAME_LIB } noAudioOuts += u; } /*------------------------------------------------------------------------------ * Look for the FileCast stream outputs in the config file *----------------------------------------------------------------------------*/ void DarkIce :: configFileCast ( const Config & config ) throw ( Exception ) { // look for FileCast encoder output streams, // sections [file-0], [file-1], ... char stream[] = "file- "; size_t streamLen = Util::strLen( stream); unsigned int u; for ( u = noAudioOuts; u < maxOutput; ++u ) { const ConfigSection * cs; // ugly hack to change the section name to "stream0", "stream1", etc. stream[streamLen-1] = '0' + (u - noAudioOuts); if ( !(cs = config.get( stream)) ) { break; } const char * str; const char * format = 0; AudioEncoder::BitrateMode bitrateMode; unsigned int bitrate = 0; double quality = 0.0; const char * targetFileName = 0; unsigned int sampleRate = 0; int lowpass = 0; int highpass = 0; bool fileAddDate = false; const char * fileDateFormat = 0; format = cs->getForSure( "format", " missing in section ", stream); if ( !Util::strEq( format, "vorbis") && !Util::strEq( format, "mp3") && !Util::strEq( format, "mp2") && !Util::strEq( format, "aac") && !Util::strEq( format, "aacp") ) { throw Exception( __FILE__, __LINE__, "unsupported stream format: ", format); } str = cs->getForSure("bitrate", " missing in section ", stream); bitrate = Util::strToL( str); targetFileName = cs->getForSure( "fileName", " missing in section ", stream); str = cs->get( "fileAddDate"); fileAddDate = str ? (Util::strEq( str, "yes") ? true : false) : false; fileDateFormat = cs->get( "fileDateFormat"); str = cs->get( "sampleRate"); sampleRate = str ? Util::strToL( str) : dsp->getSampleRate(); str = cs->get( "bitrate"); bitrate = str ? Util::strToL( str) : 0; str = cs->get( "quality"); quality = str ? Util::strToD( str) : 0.0; str = cs->getForSure( "bitrateMode", " not specified in section ", stream); if ( Util::strEq( str, "cbr") ) { bitrateMode = AudioEncoder::cbr; if ( bitrate == 0 ) { throw Exception( __FILE__, __LINE__, "bitrate not specified for CBR encoding"); } } else if ( Util::strEq( str, "abr") ) { bitrateMode = AudioEncoder::abr; if ( bitrate == 0 ) { throw Exception( __FILE__, __LINE__, "bitrate not specified for ABR encoding"); } } else if ( Util::strEq( str, "vbr") ) { bitrateMode = AudioEncoder::vbr; if ( cs->get( "quality" ) == 0 ) { throw Exception( __FILE__, __LINE__, "quality not specified for VBR encoding"); } } else { throw Exception( __FILE__, __LINE__, "invalid bitrate mode: ", str); } if (Util::strEq(format, "aac") && bitrateMode != AudioEncoder::abr) { throw Exception(__FILE__, __LINE__, "currently the AAC format only supports " "average bitrate mode"); } if (Util::strEq(format, "aacp") && bitrateMode != AudioEncoder::cbr) { throw Exception(__FILE__, __LINE__, "currently the AAC+ format only supports " "constant bitrate mode"); } str = cs->get( "lowpass"); lowpass = str ? Util::strToL( str) : 0; str = cs->get( "highpass"); highpass = str ? Util::strToL( str) : 0; // go on and create the things // the underlying file if ( fileAddDate ) { if (fileDateFormat == 0) { targetFileName = Util::fileAddDate( targetFileName); } else { targetFileName = Util::fileAddDate( targetFileName, fileDateFormat ); } } FileSink * targetFile = new FileSink( stream, targetFileName); if ( !targetFile->exists() ) { if ( !targetFile->create() ) { throw Exception( __FILE__, __LINE__, "can't create output file", targetFileName); } } // streaming related stuff audioOuts[u].socket = 0; audioOuts[u].server = new FileCast( targetFile ); if ( Util::strEq( format, "mp3") ) { #ifndef HAVE_LAME_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with lame support, " "thus can't create mp3 stream: ", stream); #else audioOuts[u].encoder = new LameLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, dsp->getChannel(), lowpass, highpass ); #endif // HAVE_TWOLAME_LIB } else if ( Util::strEq( format, "mp2") ) { #ifndef HAVE_TWOLAME_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with TwoLAME support, " "thus can't create MPEG Audio Layer 2 stream: ", stream); #else audioOuts[u].encoder = new TwoLameLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, sampleRate, dsp->getChannel() ); #endif // HAVE_TWOLAME_LIB } else if ( Util::strEq( format, "vorbis") ) { #ifndef HAVE_VORBIS_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with Ogg Vorbis support, " "thus can't Ogg Vorbis stream: ", stream); #else audioOuts[u].encoder = new VorbisLibEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, dsp->getSampleRate(), dsp->getChannel() ); #endif // HAVE_VORBIS_LIB } else if ( Util::strEq( format, "aac") ) { #ifndef HAVE_FAAC_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with AAC support, " "thus can't aac stream: ", stream); #else audioOuts[u].encoder = new FaacEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, dsp->getChannel()); #endif // HAVE_FAAC_LIB } else if ( Util::strEq( format, "aacp") ) { #ifndef HAVE_AACPLUS_LIB throw Exception( __FILE__, __LINE__, "DarkIce not compiled with AAC+ support, " "thus can't aacplus stream: ", stream); #else audioOuts[u].encoder = new aacPlusEncoder( audioOuts[u].server.get(), dsp.get(), bitrateMode, bitrate, quality, sampleRate, dsp->getChannel()); #endif // HAVE_AACPLUS_LIB } else { throw Exception( __FILE__, __LINE__, "Illegal stream format: ", format); } encConnector->attach( audioOuts[u].encoder.get()); } noAudioOuts += u; } /*------------------------------------------------------------------------------ * Set POSIX real-time scheduling *----------------------------------------------------------------------------*/ void DarkIce :: setRealTimeScheduling ( void ) throw ( Exception ) { // Only if the OS has the POSIX real-time scheduling functions implemented. #if defined( HAVE_SCHED_GETSCHEDULER ) && defined( HAVE_SCHED_GETPARAM ) int high_priority; struct sched_param param; /* store the old scheduling parameters */ if ( (origSchedPolicy = sched_getscheduler(0)) == -1 ) { throw Exception( __FILE__, __LINE__, "sched_getscheduler", errno); } if ( sched_getparam( 0, ¶m) == -1 ) { throw Exception( __FILE__, __LINE__, "sched_getparam", errno); } origSchedPriority = param.sched_priority; /* set SCHED_FIFO with max - 1 priority */ if ( (high_priority = sched_get_priority_max(SCHED_FIFO)) == -1 ) { throw Exception(__FILE__,__LINE__,"sched_get_priority_max",errno); } reportEvent( 8, "scheduler high priority", high_priority); param.sched_priority = high_priority - 1; if ( sched_setscheduler( 0, SCHED_FIFO, ¶m) == -1 ) { reportEvent( 1, "Could not set POSIX real-time scheduling, " "this may cause recording skips.\n" "Try to run darkice as the super-user."); } else { /* ask the new priortiy and report it */ if ( sched_getparam( 0, ¶m) == -1 ) { throw Exception( __FILE__, __LINE__, "sched_getparam", errno); } reportEvent( 1, "Using POSIX real-time scheduling, priority", param.sched_priority ); } #else reportEvent( 1, "POSIX scheduling not supported on this system, " "this may cause recording skips"); #endif // HAVE_SCHED_GETSCHEDULER && HAVE_SCHED_GETPARAM } /*------------------------------------------------------------------------------ * Set the original scheduling of the process, the one prior to the * setRealTimeScheduling call. * WARNING: make sure you don't call this before setRealTimeScheduling!! *----------------------------------------------------------------------------*/ void DarkIce :: setOriginalScheduling ( void ) throw ( Exception ) { // Only if the OS has the POSIX real-time scheduling functions implemented. #if defined( HAVE_SCHED_GETSCHEDULER ) && defined( HAVE_SCHED_GETPARAM ) uid_t euid; euid = geteuid(); if ( euid == 0 ) { struct sched_param param; if ( sched_getparam( 0, ¶m) == -1 ) { throw Exception( __FILE__, __LINE__, "sched_getparam", errno); } param.sched_priority = origSchedPriority; if ( sched_setscheduler( 0, origSchedPolicy, ¶m) == -1 ) { throw Exception( __FILE__, __LINE__, "sched_setscheduler", errno); } reportEvent( 5, "reverted to original scheduling"); } #endif // HAVE_SCHED_GETSCHEDULER && HAVE_SCHED_GETPARAM } /*------------------------------------------------------------------------------ * Run the encoder *----------------------------------------------------------------------------*/ bool DarkIce :: encode ( void ) throw ( Exception ) { unsigned int len; unsigned long bytes; if ( !encConnector->open() ) { throw Exception( __FILE__, __LINE__, "can't open connector"); } bytes = dsp->getSampleRate() * (dsp->getBitsPerSample() / 8UL) * dsp->getChannel() * duration; len = encConnector->transfer( bytes, 4096, 1, 0 ); reportEvent( 1, len, "bytes transfered to the encoders"); encConnector->close(); return true; } /*------------------------------------------------------------------------------ * Run *----------------------------------------------------------------------------*/ int DarkIce :: run ( void ) throw ( Exception ) { reportEvent( 3, "encoding"); if (enableRealTime) { setRealTimeScheduling(); } encode(); if (enableRealTime) { setOriginalScheduling(); } reportEvent( 3, "encoding ends"); return 0; } /*------------------------------------------------------------------------------ * Tell each sink to cut what they are doing, and start again. *----------------------------------------------------------------------------*/ void DarkIce :: cut ( void ) throw () { reportEvent( 5, "cutting"); encConnector->cut(); reportEvent( 5, "cutting ends"); } darkice-1.0/src/FaacEncoder.cpp0000644000175000001440000002420311371632310013314 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : FaacEncoder.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif // compile the whole file only if faac support configured in #ifdef HAVE_FAAC_LIB #include "Exception.h" #include "Util.h" #include "FaacEncoder.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: FaacEncoder.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Open an encoding session *----------------------------------------------------------------------------*/ bool FaacEncoder :: open ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } // open the underlying sink if ( !getSink()->open() ) { throw Exception( __FILE__, __LINE__, "faac lib opening underlying sink error"); } char * faacVersion; char * faacCopyright; faacEncGetVersion(&faacVersion, &faacCopyright); reportEvent(1, "Using faac codec version", faacVersion); encoderHandle = faacEncOpen(getOutSampleRate(), getInChannel(), &inputSamples, &maxOutputBytes); faacEncConfiguration * faacConfig; faacConfig = faacEncGetCurrentConfiguration(encoderHandle); faacConfig->aacObjectType = MAIN; faacConfig->mpegVersion = MPEG2; faacConfig->useTns = 1; faacConfig->shortctl = SHORTCTL_NORMAL; faacConfig->useLfe = 0; faacConfig->allowMidside = 1; faacConfig->bitRate = getOutBitrate() * 1000 / getOutChannel(); faacConfig->bandWidth = lowpass; faacConfig->quantqual = (unsigned long) (getOutQuality() * 1000.0); faacConfig->outputFormat = 1; faacConfig->inputFormat = FAAC_INPUT_16BIT; if (!faacEncSetConfiguration(encoderHandle, faacConfig)) { throw Exception(__FILE__, __LINE__, "error configuring faac library"); } // initialize the resampling coverter if needed if ( converter ) { #ifdef HAVE_SRC_LIB converterData.input_frames = 4096/((getInBitsPerSample() / 8) * getInChannel()); converterData.data_in = new float[converterData.input_frames*getInChannel()]; converterData.output_frames = (int) (converterData.input_frames * resampleRatio + 1); if ((int) inputSamples > getInChannel() * converterData.output_frames) { resampledOffset = new float[2 * inputSamples]; } else { resampledOffset = new float[2 * getInChannel() * converterData.input_frames]; } converterData.src_ratio = resampleRatio; converterData.end_of_input = 0; #else converter->initialize( resampleRatio, getInChannel()); //needed 2x(converted input samples) to handle offsets int outCount = 2 * getInChannel() * (inputSamples + 1); if (resampleRatio > 1) outCount = (int) (outCount * resampleRatio); resampledOffset = new short int[outCount]; #endif resampledOffsetSize = 0; } faacOpen = true; return true; } /*------------------------------------------------------------------------------ * Write data to the encoder *----------------------------------------------------------------------------*/ unsigned int FaacEncoder :: write ( const void * buf, unsigned int len ) throw ( Exception ) { if ( !isOpen() || len == 0 ) { return 0; } unsigned int channels = getInChannel(); unsigned int bitsPerSample = getInBitsPerSample(); unsigned int sampleSize = (bitsPerSample / 8) * channels; unsigned char * b = (unsigned char*) buf; unsigned int processed = len - (len % sampleSize); unsigned int nSamples = processed / sampleSize; unsigned char * faacBuf = new unsigned char[maxOutputBytes]; int samples = (int) nSamples * channels; int processedSamples = 0; if ( converter ) { unsigned int converted; #ifdef HAVE_SRC_LIB src_short_to_float_array ((short *) b, converterData.data_in, samples); converterData.input_frames = nSamples; converterData.data_out = resampledOffset + (resampledOffsetSize * channels); int srcError = src_process (converter, &converterData); if (srcError) throw Exception (__FILE__, __LINE__, "libsamplerate error: ", src_strerror (srcError)); converted = converterData.output_frames_gen; #else int inCount = nSamples; short int * shortBuffer = new short int[samples]; int outCount = (int) (inCount * resampleRatio); Util::conv( bitsPerSample, b, processed, shortBuffer, isInBigEndian()); converted = converter->resample( inCount, outCount+1, shortBuffer, &resampledOffset[resampledOffsetSize*channels]); delete[] shortBuffer; #endif resampledOffsetSize += converted; // encode samples (if enough) while(resampledOffsetSize - processedSamples >= inputSamples/channels) { int outputBytes; #ifdef HAVE_SRC_LIB short *shortData = new short[inputSamples]; src_float_to_short_array(resampledOffset + (processedSamples * channels), shortData, inputSamples) ; outputBytes = faacEncEncode(encoderHandle, (int32_t*) shortData, inputSamples, faacBuf, maxOutputBytes); delete [] shortData; #else outputBytes = faacEncEncode(encoderHandle, (int32_t*) &resampledOffset[processedSamples*channels], inputSamples, faacBuf, maxOutputBytes); #endif getSink()->write(faacBuf, outputBytes); processedSamples+=inputSamples/channels; } if (processedSamples && (int) resampledOffsetSize >= processedSamples) { resampledOffsetSize -= processedSamples; //move least part of resampled data to beginning if(resampledOffsetSize) #ifdef HAVE_SRC_LIB resampledOffset = (float *) memmove(resampledOffset, &resampledOffset[processedSamples*channels], resampledOffsetSize*channels*sizeof(float)); #else resampledOffset = (short *) memmove(resampledOffset, &resampledOffset[processedSamples*channels], resampledOffsetSize*sampleSize); #endif } } else { while (processedSamples < samples) { int outputBytes; int inSamples = samples - processedSamples < (int) inputSamples ? samples - processedSamples : inputSamples; outputBytes = faacEncEncode(encoderHandle, (int32_t*) (b + processedSamples/sampleSize), inSamples, faacBuf, maxOutputBytes); getSink()->write(faacBuf, outputBytes); processedSamples += inSamples; } } delete[] faacBuf; // return processedSamples; return samples; } /*------------------------------------------------------------------------------ * Flush the data from the encoder *----------------------------------------------------------------------------*/ void FaacEncoder :: flush ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } getSink()->flush(); } /*------------------------------------------------------------------------------ * Close the encoding session *----------------------------------------------------------------------------*/ void FaacEncoder :: close ( void ) throw ( Exception ) { if ( isOpen() ) { flush(); faacEncClose(encoderHandle); faacOpen = false; getSink()->close(); } } #endif // HAVE_FAAC_LIB darkice-1.0/src/JackDspSource.h0000644000175000001440000002000611371632310013324 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Copyright (c) 2005 Nicholas Humfrey. All rights reserved. Tyrell DarkIce File : JackDspSource.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef JACK_DSP_SOURCE_H #define JACK_DSP_SOURCE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Reporter.h" #include "AudioSource.h" #if defined( HAVE_JACK_LIB ) #include #include #else #error configure for JACK #endif /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * An audio input based on JACK * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class JackDspSource : public AudioSource, public virtual Reporter { private: /** * The jack client name. */ const char * jack_client_name; /** * The jack port */ jack_port_t * ports[2]; /** * The jack ring buffer. */ jack_ringbuffer_t * rb[2]; /** * The jack client. */ jack_client_t * client; /** * The jack audio sample buffer. */ jack_default_audio_sample_t * tmp_buffer; /** * Automatically connect the jack ports ? (default is to not) */ bool auto_connect; protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline JackDspSource ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Initialize the object * * @exception Exception */ void init ( const char* name ) throw ( Exception ); /** * De-initialize the object * * @exception Exception */ void strip ( void ) throw ( Exception ); /** * Attempt to connect up the JACK ports automatically */ void do_auto_connect( ) throw ( Exception ); /** * Callback called by JACK when audio is available */ static int process_callback( jack_nframes_t nframes, void *arg ); /** * Callback called by JACK when jackd is shutting down */ static void shutdown_callback( void *arg ); public: /** * Constructor. * * @param name the name of the jack device * @param sampleRate samples per second (e.g. 44100 for 44.1kHz). * @param bitsPerSample bits per sample (e.g. 16 bits). * @param channels number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.). * @exception Exception */ inline JackDspSource ( const char * name, const char * jackClientName, int sampleRate = 44100, int bitsPerSample = 16, int channels = 2 ) throw ( Exception ) : AudioSource( sampleRate, bitsPerSample, channels ) { jack_client_name = jackClientName; init( name ); } /** * Copy Constructor. * * @param jds the object to copy. * @exception Exception */ inline JackDspSource ( const JackDspSource & jds ) throw ( Exception ) : AudioSource( jds ) { throw Exception( __FILE__, __LINE__, "JackDspSource doesn't copy"); } /** * Destructor. * * @exception Exception */ inline virtual ~JackDspSource ( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param ds the object to assign to this one. * @return a reference to this object. * @exception Exception */ inline virtual JackDspSource & operator= ( const JackDspSource & ds ) throw ( Exception ) { throw Exception( __FILE__, __LINE__, "JackDspSource doesn't assign"); } /** * Open the JackDspSource. * This does not put the Jack DSP device into recording mode. * To start getting samples, call either canRead() or read(). * * @return true if opening was successful, false otherwise * @exception Exception * * @see #canRead * @see #read */ virtual bool open ( void ) throw ( Exception ); /** * Check if the JackDspSource is registered * * @return true if Jack client is setup */ inline virtual bool isOpen ( void ) const throw () { return client != NULL; } /** * Check if the JackDspSource can be read from. * Blocks until the specified time for data to be available. * Puts the Jack DSP device into recording mode. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the JackDspSource is ready to be read from, * false otherwise. * @exception Exception */ virtual bool canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Read from the JackDspSource. * Puts the Jack DSP device into recording mode. * * @param buf the buffer to read into. * @param len the number of bytes to read into buf * @return the number of bytes read (may be less than len). * @exception Exception */ virtual unsigned int read ( void * buf, unsigned int len ) throw ( Exception ); /** * Close the JackDspSource. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* JACK_DSP_SOURCE_H */ darkice-1.0/src/SerialUlaw.h0000644000175000001440000001661511371631674012723 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Copyright (c) 2007 Clyde Stubbs Tyrell DarkIce File : SerialUlaw.h Version : $Revision$ Author : $Author$ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef SERIAL_ULAW_SOURCE_H #define SERIAL_ULAW_SOURCE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Reporter.h" #include "AudioSource.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * An audio input based on /dev/dsp-like raw devices * * @author $Author: darkeye $ * @version $Revision: 1.7 $ */ class SerialUlaw : public AudioSource, public virtual Reporter { private: /** * The file name of the OSS DSP device (e.g. /dev/dsp or /dev/dsp0). */ char * fileName; /** * The low-level file descriptor of the OSS DSP device. */ int fileDescriptor; /** * Indicates wether the low-level OSS DSP device is in a recording * state. */ bool running; protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline SerialUlaw ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Initialize the object * * @param name the file name of the OSS DSP device. * @exception Exception */ void init ( const char * name ) throw ( Exception ); /** * De-iitialize the object * * @exception Exception */ void strip ( void ) throw ( Exception ); public: /** * Constructor. * * @param name the file name of the OSS DSP device * (e.g. /dev/dsp or /dev/dsp0). * @param sampleRate samples per second (e.g. 44100 for 44.1kHz). * @param bitsPerSample bits per sample (e.g. 16 bits). * @param channel number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.). * @exception Exception */ inline SerialUlaw ( const char * name, int sampleRate = 44100, int bitsPerSample = 16, int channel = 2 ) throw ( Exception ) : AudioSource( sampleRate, bitsPerSample, channel) { init( name); } /** * Copy Constructor. * * @param ods the object to copy. * @exception Exception */ inline SerialUlaw ( const SerialUlaw & ods ) throw ( Exception ) : AudioSource( ods ) { init( ods.fileName); } /** * Destructor. * * @exception Exception */ inline virtual ~SerialUlaw ( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param ds the object to assign to this one. * @return a reference to this object. * @exception Exception */ inline virtual SerialUlaw & operator= ( const SerialUlaw & ds ) throw ( Exception ) { if ( this != &ds ) { strip(); AudioSource::operator=( ds); init( ds.fileName); } return *this; } /** * Tell if the data from this source comes in big or little endian. * * @return true if the source is big endian, false otherwise */ virtual bool isBigEndian ( void ) const throw (); /** * Open the SerialUlaw. * This does not put the OSS DSP device into recording mode. * To start getting samples, call either canRead() or read(). * * @return true if opening was successful, false otherwise * @exception Exception * * @see #canRead * @see #read */ virtual bool open ( void ) throw ( Exception ); /** * Check if the SerialUlaw is open. * * @return true if the SerialUlaw is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return fileDescriptor != 0; } /** * Check if the SerialUlaw can be read from. * Blocks until the specified time for data to be available. * Puts the OSS DSP device into recording mode. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the SerialUlaw is ready to be read from, * false otherwise. * @exception Exception */ virtual bool canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Read from the SerialUlaw. * Puts the OSS DSP device into recording mode. * * @param buf the buffer to read into. * @param len the number of bytes to read into buf * @return the number of bytes read (may be less than len). * @exception Exception */ virtual unsigned int read ( void * buf, unsigned int len ) throw ( Exception ); /** * Close the SerialUlaw. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* SERIAL_ULAW_SOURCE_H */ darkice-1.0/src/BufferedSink.h0000644000175000001440000002637711371632310013214 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : BufferedSink.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef BUFFERED_SINK_H #define BUFFERED_SINK_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Ref.h" #include "Reporter.h" #include "Sink.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A Sink First-In First-Out buffer. * This buffer can always be written to, it overwrites any * data contained if needed. * The class is not thread-safe. * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class BufferedSink : public Sink, public virtual Reporter { private: /** * The buffer. */ unsigned char * buffer; /** * The end of the buffer. */ unsigned char * bufferEnd; /** * The size of the buffer. */ unsigned int bufferSize; /** * The highest usage of the buffer. */ unsigned int peak; /** * All data written to this BufferedSink is handled by chuncks * of this size. */ unsigned int chunkSize; /** * Number of bytes the underlying stream is misaligned with * chunkSize. (It needs this many bytes more to be aligned.) */ unsigned int misalignment; /** * Start of free territory in buffer. */ unsigned char * inp; /** * Start of sensible data in buffer. */ unsigned char * outp; /** * The underlying Sink. */ Ref sink; /** * Initialize the object. * * @param sink the Sink to attach this BufferedSink to. * @param size the size of the internal buffer to use. * @param chunkSize size of chunks to handle data in. * @exception Exception */ void init ( Sink * sink, unsigned int size, unsigned int chunkSize ) throw ( Exception ); /** * De-initialize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); /** * Slide a pointer in the internal buffer by offset. If the pointer * would reach beyond the end of the buffer, it goes wraps around. * * @param p the pointer to slide. * @param offset the amount to slide with. * @return pointer p + offset, wrapped around if needed. */ inline unsigned char * slidePointer ( unsigned char * p, unsigned int offset ) throw () { p += offset; while ( p >= bufferEnd ) { p -= bufferSize; } return p; } /** * Update the peak buffer usage indicator. * * @see #peak */ inline void updatePeak ( void ) throw () { unsigned int u; u = outp <= inp ? inp - outp : (bufferEnd - outp) + (inp - buffer); if ( peak < u ) { peak = u; reportEvent( 4, "BufferedSink, new peak:", peak); reportEvent( 4, "BufferedSink, remaining:", bufferSize - peak); } } /** * If the underlying Sink is misaligned on chunkSize, write as * many 0s as needed to get it aligned. * * @see #misalignment * @see #chunkSize */ inline bool align ( void ) throw ( Exception ) { char b[] = { 0 }; while ( misalignment ) { if ( sink->canWrite( 0, 0) ) { unsigned int ret; if ( !(ret = sink->write( b, 1)) ) { return false; } --misalignment; } else { return false; } } return true; } protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline BufferedSink ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Get the size of the buffer. * * @return the size of the buffer. */ inline unsigned int getSize ( void ) const throw () { return bufferSize; } /** * Store data in the internal buffer. If there is not enough space, * discard all in the buffer and the beginning of the supplied * buffer if needed. * * @param buffer the data to store. * @param bufferSize the amount of data to store in bytes. * @return number of bytes really stored. */ unsigned int store ( const void * buffer, unsigned int bufferSize ) throw ( Exception ); public: /** * Constructor by an underlying Sink, buffer size and chunk size. * * @param sink the Sink to attach this BufferSink to. * @param size the size of the buffer to use for buffering. * @param chunkSize hanlde all data in write() as chunks of * chunkSize * @exception Exception */ inline BufferedSink ( Sink * sink, unsigned int size, unsigned int chunkSize = 1 ) throw ( Exception ) { init( sink, size, chunkSize); } /** * Copy constructor. * * @param buffer the object to copy. * @exception Exception */ BufferedSink ( const BufferedSink & buffer ) throw ( Exception ); /** * Destructor. * * @exception Exception */ inline virtual ~BufferedSink ( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param bs the object to assign to this one. * @return a reference to this object. * @exception Exception */ virtual BufferedSink & operator= ( const BufferedSink & bs ) throw ( Exception ); /** * Get the peak usage of the internal buffer. * * @return the peak usage of the internal buffer. */ inline unsigned int getPeak ( void ) const throw () { return peak; } /** * Open the BufferedSink. Opens the underlying Sink. * * @return true if opening was successful, false otherwise. * @exception Exception */ inline virtual bool open ( void ) throw ( Exception ) { return sink->open(); } /** * Check if a BufferedSink is open. * * @return true if the BufferedSink is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return sink->isOpen(); } /** * Check if the BufferedSink is ready to accept data. * Always returns true immediately. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true * @exception Exception */ inline virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ) { return true; } /** * Write data to the BufferedSink. * Always reads the maximum number of chunkSize chunks buf * holds. If the data can not be written to the underlying * stream, it is buffered. If the buffer overflows, the oldest * data is discarded. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * Flush all data that was written to the BufferedSink to the * underlying Sink. * * @exception Exception */ inline virtual void flush ( void ) throw ( Exception ) { unsigned char b[1]; write( b, 0); } /** * Cut what the sink has been doing so far, and start anew. * This usually means separating the data sent to the sink up * until now, and start saving a new chunk of data. */ inline virtual void cut ( void ) throw () { flush(); sink->cut(); } /** * Close the BufferedSink. Closes the underlying Sink. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* BUFFERED_SINK_H */ darkice-1.0/src/aflibDebug.h0000644000175000001440000000744211371632022012661 00000000000000 /* Copyright (C) 2000 Stefan Westerfeld stefan@space.twc.de This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Some inspiration taken from glib. Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald Modified by the GLib Team and others 1997-1999. */ #ifndef _AFLIBDEBUG_H_ #define _AFLIBDEBUG_H_ /* * BC - Status (2000-09-30): Debug. * * Collection class, no instance, no members. Thus binary compatible (will * be kept). */ #define aflib_fatal ::aflibDebug::fatal #define aflib_warning ::aflibDebug::warning #define aflib_info ::aflibDebug::info #define aflib_debug ::aflibDebug::debug /* source compatibility with older sources */ #define aflibdebug ::aflibDebug::debug #define setaflibdebug(x) aflib_warning("setaflibdebug is obsolete") #ifdef __GNUC__ #define aflib_return_if_fail(expr) \ if (!(expr)) \ { \ aflib_warning ("file %s: line %d (%s): assertion failed: (%s)", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \ return; \ } #define aflib_return_val_if_fail(expr,val) \ if (!(expr)) \ { \ aflib_warning ("file %s: line %d (%s): assertion failed: (%s)", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \ return (val); \ } #define aflib_assert(expr) \ if (!(expr)) \ aflib_fatal ("file %s: line %d (%s): assertion failed: (%s)", \ __FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \ #else #define aflib_return_if_fail(expr) \ if (!(expr)) \ { \ aflib_warning ("file %s: line %d: assertion failed: (%s)", \ __FILE__, __LINE__, #expr); \ return; \ } #define aflib_return_val_if_fail(expr,val) \ if (!(expr)) \ { \ aflib_warning ("file %s: line %d: assertion failed: (%s)", \ __FILE__, __LINE__, #expr); \ return (val); \ } #define aflib_assert(expr) \ if (!(expr)) \ aflib_fatal ("file %s: line %d: assertion failed: (%s)", \ __FILE__, __LINE__, #expr); \ #endif class aflibDebug { public: enum Level { lFatal = 3, lWarning = 2, lInfo = 1, lDebug = 0 }; /** * Initializes at which is the minimum level to react to. If you * call this, call this before creating the Arts::Dispatcher object. */ static void init(const char *prefix, Level level); static void fatal(const char *fmt,...); // print on stderr & abort static void warning(const char *fmt,...); // print on stderr static void info(const char *fmt,...); // print on stdout static void debug(const char *fmt,...); // print on stdout /** * This method sets the name of an external application to * display messages graphically. */ static void messageApp(const char *appName); }; #endif darkice-1.0/src/AudioSource.h0000644000175000001440000002150711371632310013055 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : AudioSource.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef AUDIO_SOURCE_H #define AUDIO_SOURCE_H #ifndef __cplusplus #error This is a C++ include file #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif /* ============================================================ include files */ #include "Source.h" #include "Reporter.h" /* ================================================================ constants */ /* =================================================================== macros */ /*------------------------------------------------------------------------------ * Determine the kind of audio device based on the system *----------------------------------------------------------------------------*/ #if defined( HAVE_ALSA_LIB ) // we have an ALSA sound system available #define SUPPORT_ALSA_DSP 1 #endif #if defined( HAVE_SYS_SOUNDCARD_H ) // we have an OSS DSP sound source device available #define SUPPORT_OSS_DSP 1 #endif #if defined( HAVE_SYS_AUDIO_H ) || defined( HAVE_SYS_AUDIOIO_H ) // we have a Solaris DSP sound device available (same for OpenBSD) #define SUPPORT_SOLARIS_DSP 1 #endif #if defined( HAVE_JACK_LIB ) // we have JACK audio server #define SUPPORT_JACK_DSP 1 #endif #if defined ( HAVE_TERMIOS_H ) #define SUPPORT_SERIAL_ULAW 1 #endif #if !defined( SUPPORT_ALSA_DSP ) \ && !defined( SUPPORT_OSS_DSP ) \ && !defined( SUPPORT_JACK_DSP ) \ && !defined( SUPPORT_SOLARIS_DSP ) \ && !defined( SUPPORT_SERIAL_ULAW) // there was no DSP audio system found #error No DSP audio input device found on system #endif /* =============================================================== data types */ /** * Audio data input * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class AudioSource : public Source, public virtual Reporter { private: /** * Number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.) */ unsigned int channel; /** * Samples per second (e.g. 44100 for 44.1kHz CD quality) */ unsigned int sampleRate; /** * Bits per sample (e.g. 8 bits, 16 bits, etc.) */ unsigned int bitsPerSample; /** * Initialize the object. * * @param sampleRate samples per second. * @param bitsPerSample bits per sample. * @param channel number of channels of the audio source. * @exception Exception */ inline void init ( unsigned int sampleRate, unsigned int bitsPerSample, unsigned int channel ) throw ( Exception ) { this->sampleRate = sampleRate; this->bitsPerSample = bitsPerSample; this->channel = channel; } /** * De-initialize the object. * * @exception Exception */ inline void strip ( void ) throw ( Exception ) { } protected: /** * Constructor. * Because all values have defaults, this is also the default * constructor. * * @param sampleRate samples per second (e.g. 44100 for 44.1kHz). * @param bitsPerSample bits per sample (e.g. 16 bits). * @param channel number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.). * @exception Exception */ inline AudioSource ( unsigned int sampleRate = 44100, unsigned int bitsPerSample = 16, unsigned int channel = 2 ) throw ( Exception ) { init ( sampleRate, bitsPerSample, channel); } /** * Copy Constructor. * * @param as the object to copy. * @exception Exception */ inline AudioSource ( const AudioSource & as ) throw ( Exception ) : Source( as ) { init ( as.sampleRate, as.bitsPerSample, as.channel); } /** * Assignment operator. * * @param as the object to assign to this one. * @return a reference to this object. * @exception Exception */ inline virtual AudioSource & operator= ( const AudioSource & as ) throw ( Exception ) { if ( this != &as ) { strip(); Source::operator=( as ); init ( as.sampleRate, as.bitsPerSample, as.channel); } return *this; } public: /** * Destructor. * * @exception Exception */ virtual inline ~AudioSource ( void ) throw ( Exception ) { } /** * Get the number of channels for this AudioSource. * * @return the number of channels. */ inline unsigned int getChannel ( void ) const throw () { return channel; } /** * Tell if the data from this source comes in big or little endian. * * @return true if the data is big endian, false if little endian */ virtual bool isBigEndian ( void ) const throw () { #ifdef WORDS_BIGENDIAN return true; #else return false; #endif } /** * Get the sample rate per seconds for this AudioSource. * * @return the sample rate per seconds. */ inline unsigned int getSampleRate ( void ) const throw () { return sampleRate; } /** * Get the number of bits per sample for this AudioSource. * * @return the number of bits per sample. */ inline unsigned int getBitsPerSample ( void ) const throw () { return bitsPerSample; } /** * Factory method for creating an AudioSource object of the * appropriate type, based on the compiled DSP support and * the supplied DSP name parameter. * * @param deviceName the audio device (/dev/dspX, hwplug:0,0, etc) * @param sampleRate samples per second (e.g. 44100 for 44.1kHz). * @param bitsPerSample bits per sample (e.g. 16 bits). * @param channel number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.). * @exception Exception */ static AudioSource * createDspSource( const char * deviceName, const char * jackClientName, int sampleRate = 44100, int bitsPerSample = 16, int channel = 2) throw ( Exception ); }; /* ================================================= external data structures */ /*------------------------------------------------------------------------------ * Determine the kind of audio device based on the system *----------------------------------------------------------------------------*/ #if defined( SUPPORT_ALSA_DSP ) #include "AlsaDspSource.h" #endif #if defined( SUPPORT_OSS_DSP ) #include "OssDspSource.h" #endif #if defined( SUPPORT_SOLARIS_DSP ) #include "SolarisDspSource.h" #endif #if defined( SUPPORT_JACK_DSP ) #include "JackDspSource.h" #endif #if defined ( SUPPORT_SERIAL_ULAW ) #include "SerialUlaw.h" #endif /* ====================================================== function prototypes */ #endif /* AUDIO_SOURCE_H */ darkice-1.0/src/AlsaDspSource.h0000644000175000001440000002035611371632310013344 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Copyright (c) 2004 LS Informationstechnik (LIKE) University of Erlangen Nuremberg All rights reserved. Tyrell DarkIce File : AlsaDspSource.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef ALSA_SOURCE_H #define ALSA_SOURCE_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "Reporter.h" #include "AudioSource.h" #ifdef HAVE_ALSA_LIB #include #else #error configure for ALSA #endif /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * An audio input based on the ALSA sound system * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class AlsaDspSource : public AudioSource, public virtual Reporter { private: /** * Name of the capture PCM stream. */ char *pcmName; /** * Handle to access PCM stream data. */ snd_pcm_t *captureHandle; /** * Stores number of bytes per frame. One frame * contains all samples per time instance. */ int bytesPerFrame; /** * Is the stream running? */ bool running; /** * Number of useconds to do buffering in the audio device. */ unsigned int bufferTime; protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline AlsaDspSource ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Initialize the object * * @param name the PCM to open. * @exception Exception */ void init ( const char * name ) throw ( Exception ); /** * De-iitialize the object * * @exception Exception */ void strip ( void ) throw ( Exception ); public: /** * Constructor. * * @param name the PCM (e.g. "hwplug:0,0"). * @param sampleRate samples per second (e.g. 44100 for 44.1kHz). * @param bitsPerSample bits per sample (e.g. 16 bits). * @param channel number of channels of the audio source * (e.g. 1 for mono, 2 for stereo, etc.). * @exception Exception */ inline AlsaDspSource ( const char * name, int sampleRate = 44100, int bitsPerSample = 16, int channel = 2 ) throw ( Exception ) : AudioSource( sampleRate, bitsPerSample, channel) { init( name); } /** * Copy Constructor. * * @param ds the object to copy. * @exception Exception */ inline AlsaDspSource ( const AlsaDspSource & ds ) throw ( Exception ) : AudioSource( ds ) { init( ds.pcmName); } /** * Destructor. * * @exception Exception */ inline virtual ~AlsaDspSource ( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param ds the object to assign to this one. * @return a reference to this object. * @exception Exception */ inline virtual AlsaDspSource & operator= ( const AlsaDspSource & ds ) throw ( Exception ) { if ( this != &ds ) { strip(); AudioSource::operator=( ds); init( ds.pcmName); } return *this; } /** * Tell if the data from this source comes in big or little endian. * * @return true if the source is big endian, false otherwise */ virtual bool isBigEndian ( void ) const throw (); /** * Open the AlsaDspSource. * This does not put Alsa device into recording mode. * To start getting samples, call either canRead() or read(). * * @return true if opening was successful, false otherwise * @exception Exception * * @see #canRead * @see #read */ virtual bool open ( void ) throw ( Exception ); /** * Check if the AlsaDspSource is open. * * @return true if the AlsaDspSource is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return captureHandle != 0; } /** * Check if the AlsaDspSource can be read from. * Blocks until the specified time for data to be available. * Puts the PCM into recording mode. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the AlsaDspSource is ready to be read from, * false otherwise. * @exception Exception */ virtual bool canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Read from the AlsaDspSource. * Puts the PCM into recording mode. * * @param buf the buffer to read into. * @param len the number of bytes to read into buf * @return the number of bytes read (may be less than len). * @exception Exception */ virtual unsigned int read ( void * buf, unsigned int len ) throw ( Exception ); /** * Close the AlsaDspSource. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); /** * Returns the buffer size in useconds. * * @return the number of useconds audio will be buffered in ALSA */ inline virtual unsigned int getBufferTime( void ) const { return bufferTime; } /** * Sets the number of useconds to buffer audio in ALSA * * @param time buffer time */ inline virtual void setBufferTime( unsigned int time ) { bufferTime = time; } }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* ALSA_SOURCE_H */ darkice-1.0/src/Util.h0000644000175000001440000002610711371632310011551 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : Util.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef UTIL_H #define UTIL_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Exception.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * Widely used utilities. * This class can not be instantiated, but contains useful (?) static * functions. * * Typical usage: * *
 *  #include "Util.h"
 *  
 *  char  * str = Util::strDup( otherStr);
 *  
* * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class Util { private: /** * Helper table for base64 encoding. */ static char base64Table[]; protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline Util ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Copy constructor. Always throws an Exception. * * @exception Exception */ inline Util ( const Util & e ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Destructor. Always throws an Exception. * * @exception Exception */ inline ~Util ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } /** * Assignment operator. Always throws an Exception. * * @param u the object to assign to this one. * @exception Exception */ inline Util & operator= ( const Util & u ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Determine a C string's length. * * @param str a zero-terminated C string. * @return length of str * @exception Exception */ static unsigned int strLen ( const char * str ) throw ( Exception ); /** * Copy a C string into another. * * @param dest place for the copy. Storage size must be at least * Util::strLen(src) + 1 long. * @param src the string to copy. * @exception Exception */ static void strCpy ( char * dest, const char * src ) throw ( Exception ); /** * Concatenate a string to another's end. * * @param dest the string to concatenate to. * Storage size of dest must be at least * Util::strLen(dest) + Util::strLen(src) + 1 long. * @param src the string to concatenate. * @exception Exception */ static void strCat ( char * dest, const char * src ) throw ( Exception ); /** * Duplicate a string by allocating space with new[]. * The returned string must be freed with delete[]. * * @param str the string to duplicate. * @exception Exception */ static char * strDup ( const char * str ) throw ( Exception ); /** * Determine wether two string are equal. * * @param str1 one of the strings. * @param str2 the other string. * @param len check the first most len characters. if 0, check * the whole string * @return true if the two strings are equal, false othersize. * @exception Exception */ static bool strEq ( const char * str1, const char * str2, unsigned int len = 0 ) throw ( Exception ); /** * Convert a string to long. * * @param str the string to convert. * @param base numeric base of number in str. * @return the value of str as a long int * @exception Exception */ static long int strToL ( const char * str, int base = 10 ) throw ( Exception ); /** * Convert a string to double. * * @param str the string to convert. * @return the value of str as a double * @exception Exception */ static double strToD ( const char * str ) throw ( Exception ); /** * Add current date to a file name, before the file extension (if any) * * @param str the string to convert (file name). * @return the new string with the date appended before * extension of the file name. the string has to be * deleted with delete[] after it is not needed * @exception Exception */ static char * fileAddDate ( const char * str, const char * format = "[%m-%d-%Y-%H-%M-%S]" ) throw ( Exception ); /** * Convert a string into base64 encoding. * base64 is described in RFC 2045, section 6.8 * The returned string must be freed with delete[]. * * @param str the string to convert. * @return the supplied string in base64 encoding. * @exception Exception */ static char * base64Encode ( const char * str ) throw ( Exception ); /** * Convert an unsigned char buffer holding 8 or 16 bit PCM values * with channels interleaved to a short int buffer, still * with channels interleaved. * * @param bitsPerSample the number of bits per sample in the input * @param pcmBuffer the input buffer * @param lenPcmBuffer the number of samples total in pcmBuffer * (e.g. if 2 channel input, this is twice the * number of sound samples) * @param outBuffer the output buffer, must be big enough * @param isBigEndian true if the input is big endian, false otherwise */ static void conv ( unsigned int bitsPerSample, unsigned char * pcmBuffer, unsigned int lenPcmBuffer, short int * outBuffer, bool isBigEndian = true ) throw ( Exception ); /** * Convert a short buffer holding PCM values with channels interleaved * to one or more float buffers, one for each channel * * @param shortBuffer the input buffer * @param lenShortBuffer total length of the input buffer * @param floatBuffers an array of float buffers, each * (lenShortBuffer / channels) long * @param channels number of channels to separate the input to */ static void conv ( short int * shortBuffer, unsigned int lenShortBuffer, float ** floatBuffers, unsigned int channels ) throw ( Exception ); /** * Convert a char buffer holding 8 bit PCM values to a short buffer * * @param pcmBuffer buffer holding 8 bit PCM audio values, * channels are interleaved * @param lenPcmBuffer length of pcmBuffer * @param leftBuffer put the left channel here (must be big enough) * @param rightBuffer put the right channel here (not touched if mono, * must be big enough) * @param channels number of channels (1 = mono, 2 = stereo) */ static void conv8 ( unsigned char * pcmBuffer, unsigned int lenPcmBuffer, short int * leftBuffer, short int * rightBuffer, unsigned int channels ) throw ( Exception ); /** * Convert a char buffer holding 16 bit PCM values to a short buffer * * @param pcmBuffer buffer holding 16 bit PCM audio values, * channels are interleaved * @param lenPcmBuffer length of pcmBuffer * @param leftBuffer put the left channel here (must be big enough) * @param rightBuffer put the right channel here (not touched if mono, * must be big enough) * @param channels number of channels (1 = mono, 2 = stereo) * @param isBigEndian true if input is big endian, false otherwise */ static void conv16 ( unsigned char * pcmBuffer, unsigned int lenPcmBuffer, short int * leftBuffer, short int * rightBuffer, unsigned int channels, bool isBigEndian ) throw ( Exception ); /** * Make a thread sleep for specified amount of time. * Only the thread which this is called in will sleep. * The SIGUSR1 signal will be blocked during the sleep. * * @param sec the number of seconds to sleep. * @param nsec the number of nano-seconds to sleep. */ static void sleep( long sec, long nsec); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* UTIL_H */ darkice-1.0/src/OssDspSource.cpp0000644000175000001440000002005411371632310013556 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : OssDspSource.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #include "OssDspSource.h" #ifdef SUPPORT_OSS_DSP // only compile this code if there is support for it #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_UNISTD_H #include #else #error need unistd.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #ifdef HAVE_SYS_TYPES_H #include #else #error need sys/types.h #endif #ifdef HAVE_SYS_STAT_H #include #else #error need sys/stat.h #endif #ifdef HAVE_FCNTL_H #include #else #error need fcntl.h #endif #ifdef HAVE_SYS_TIME_H #include #else #error need sys/time.h #endif #ifdef HAVE_SYS_IOCTL_H #include #else #error need sys/ioctl.h #endif #ifdef HAVE_SIGNAL_H #include #else #error need signal.h #endif #ifdef HAVE_SYS_SOUNDCARD_H #include #else #error need sys/soundcard.h #endif #include "Util.h" #include "Exception.h" #include "OssDspSource.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: OssDspSource.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /*------------------------------------------------------------------------------ * Define the natural endiannes of 16 bit recording if not defined, * based on the endiannes of the system *----------------------------------------------------------------------------*/ #ifndef AFMT_S16_NE # ifdef WORDS_BIGENDIAN # define AFMT_S16_NE AFMT_S16_BE # else # define AFMT_S16_NE AFMT_S16_LE # endif #endif /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Tell if source id big endian *----------------------------------------------------------------------------*/ bool OssDspSource :: isBigEndian ( void ) const throw () { return AFMT_S16_NE == AFMT_S16_BE; } /*------------------------------------------------------------------------------ * Initialize the object *----------------------------------------------------------------------------*/ void OssDspSource :: init ( const char * name ) throw ( Exception ) { fileName = Util::strDup( name); fileDescriptor = 0; running = false; } /*------------------------------------------------------------------------------ * De-initialize the object *----------------------------------------------------------------------------*/ void OssDspSource :: strip ( void ) throw ( Exception ) { if ( isOpen() ) { close(); } delete[] fileName; } /*------------------------------------------------------------------------------ * Open the audio source *----------------------------------------------------------------------------*/ bool OssDspSource :: open ( void ) throw ( Exception ) { int format; int i; unsigned int u; if ( isOpen() ) { return false; } switch ( getBitsPerSample() ) { case 8: format = AFMT_U8; break; case 16: format = AFMT_S16_NE; break; default: return false; } if ( (fileDescriptor = ::open( fileName, O_RDONLY)) == -1 ) { fileDescriptor = 0; return false; } i = format; if ( ioctl( fileDescriptor, SNDCTL_DSP_SETFMT, &i) == -1 || i != format ) { close(); throw Exception( __FILE__, __LINE__, "can't set format", i); } u = getChannel(); if ( ioctl( fileDescriptor, SNDCTL_DSP_CHANNELS, &u) == -1 || u != getChannel() ) { close(); throw Exception( __FILE__, __LINE__, "can't set channels", u); } u = getSampleRate(); if ( ioctl( fileDescriptor, SNDCTL_DSP_SPEED, &u) == -1 ) { close(); throw Exception( __FILE__, __LINE__, "can't set soundcard recording sample rate", u); } if ( u != getSampleRate() ) { reportEvent( 2, "sound card recording sample rate set to ", u, " while trying to set it to ", getSampleRate()); reportEvent( 2, "this is probably not a problem, but a slight " "drift in the sound card driver"); } return true; } /*------------------------------------------------------------------------------ * Check wether read() would return anything *----------------------------------------------------------------------------*/ bool OssDspSource :: canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ) { fd_set fdset; struct timespec timespec; sigset_t sigset; int ret; if ( !isOpen() ) { return false; } if ( !running ) { /* ugly workaround to get the dsp into recording state */ unsigned char * b = new unsigned char[getChannel()*getBitsPerSample()/8]; read( b, getChannel()*getBitsPerSample()/8); delete[] b; } FD_ZERO( &fdset); FD_SET( fileDescriptor, &fdset); timespec.tv_sec = sec; timespec.tv_nsec = usec * 1000L; // mask out SIGUSR1, as we're expecting that signal for other reasons sigemptyset(&sigset); sigaddset(&sigset, SIGUSR1); ret = pselect( fileDescriptor + 1, &fdset, NULL, NULL, ×pec, &sigset); if ( ret == -1 ) { throw Exception( __FILE__, __LINE__, "select error"); } return ret > 0; } /*------------------------------------------------------------------------------ * Read from the audio source *----------------------------------------------------------------------------*/ unsigned int OssDspSource :: read ( void * buf, unsigned int len ) throw ( Exception ) { ssize_t ret; if ( !isOpen() ) { return 0; } ret = ::read( fileDescriptor, buf, len); if ( ret == -1 ) { throw Exception( __FILE__, __LINE__, "read error"); } running = true; return ret; } /*------------------------------------------------------------------------------ * Close the audio source *----------------------------------------------------------------------------*/ void OssDspSource :: close ( void ) throw ( Exception ) { if ( !isOpen() ) { return; } ::close( fileDescriptor); fileDescriptor = 0; running = false; } #endif // SUPPORT_OSS_DSP darkice-1.0/src/Makefile.in0000644000175000001440000005372011371632436012542 00000000000000# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = darkice$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/config.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am__darkice_SOURCES_DIST = AudioEncoder.h AudioSource.h \ AudioSource.cpp BufferedSink.cpp BufferedSink.h CastSink.cpp \ CastSink.h FileSink.h FileSink.cpp Connector.cpp Connector.h \ MultiThreadedConnector.cpp MultiThreadedConnector.h \ DarkIce.cpp DarkIce.h Exception.cpp Exception.h IceCast.cpp \ IceCast.h IceCast2.cpp IceCast2.h ShoutCast.cpp ShoutCast.h \ FileCast.h FileCast.cpp LameLibEncoder.cpp LameLibEncoder.h \ TwoLameLibEncoder.cpp TwoLameLibEncoder.h VorbisLibEncoder.cpp \ VorbisLibEncoder.h FaacEncoder.cpp FaacEncoder.h \ aacPlusEncoder.cpp aacPlusEncoder.h OssDspSource.cpp \ OssDspSource.h SerialUlaw.cpp SerialUlaw.h \ SolarisDspSource.cpp SolarisDspSource.h Ref.h Referable.h \ Sink.h Source.h TcpSocket.cpp TcpSocket.h Util.cpp Util.h \ ConfigSection.h ConfigSection.cpp DarkIceConfig.h \ DarkIceConfig.cpp Reporter.h Reporter.cpp AlsaDspSource.h \ AlsaDspSource.cpp JackDspSource.h JackDspSource.cpp main.cpp \ aflibDebug.h aflibDebug.cc aflibConverter.h aflibConverter.cc \ aflibConverterLargeFilter.h aflibConverterSmallFilter.h @HAVE_SRC_LIB_FALSE@am__objects_1 = aflibDebug.$(OBJEXT) \ @HAVE_SRC_LIB_FALSE@ aflibConverter.$(OBJEXT) am_darkice_OBJECTS = AudioSource.$(OBJEXT) BufferedSink.$(OBJEXT) \ CastSink.$(OBJEXT) FileSink.$(OBJEXT) Connector.$(OBJEXT) \ MultiThreadedConnector.$(OBJEXT) DarkIce.$(OBJEXT) \ Exception.$(OBJEXT) IceCast.$(OBJEXT) IceCast2.$(OBJEXT) \ ShoutCast.$(OBJEXT) FileCast.$(OBJEXT) \ LameLibEncoder.$(OBJEXT) TwoLameLibEncoder.$(OBJEXT) \ VorbisLibEncoder.$(OBJEXT) FaacEncoder.$(OBJEXT) \ aacPlusEncoder.$(OBJEXT) OssDspSource.$(OBJEXT) \ SerialUlaw.$(OBJEXT) SolarisDspSource.$(OBJEXT) \ TcpSocket.$(OBJEXT) Util.$(OBJEXT) ConfigSection.$(OBJEXT) \ DarkIceConfig.$(OBJEXT) Reporter.$(OBJEXT) \ AlsaDspSource.$(OBJEXT) JackDspSource.$(OBJEXT) main.$(OBJEXT) \ $(am__objects_1) darkice_OBJECTS = $(am_darkice_OBJECTS) darkice_LDADD = $(LDADD) darkice_DEPENDENCIES = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles 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 $@ SOURCES = $(darkice_SOURCES) $(EXTRA_darkice_SOURCES) DIST_SOURCES = $(am__darkice_SOURCES_DIST) $(EXTRA_darkice_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) AACPLUS_INCFLAGS = @AACPLUS_INCFLAGS@ AACPLUS_LDFLAGS = @AACPLUS_LDFLAGS@ ACLOCAL = @ACLOCAL@ ALSA_INCFLAGS = @ALSA_INCFLAGS@ ALSA_LDFLAGS = @ALSA_LDFLAGS@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CXXFLAGS = @DEBUG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FAAC_INCFLAGS = @FAAC_INCFLAGS@ FAAC_LDFLAGS = @FAAC_LDFLAGS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JACK_CFLAGS = @JACK_CFLAGS@ JACK_INCFLAGS = @JACK_INCFLAGS@ JACK_LDFLAGS = @JACK_LDFLAGS@ LAME_INCFLAGS = @LAME_INCFLAGS@ LAME_LDFLAGS = @LAME_LDFLAGS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SRC_CFLAGS = @SRC_CFLAGS@ SRC_INCFLAGS = @SRC_INCFLAGS@ SRC_LDFLAGS = @SRC_LDFLAGS@ STRIP = @STRIP@ TWOLAME_INCFLAGS = @TWOLAME_INCFLAGS@ TWOLAME_LDFLAGS = @TWOLAME_LDFLAGS@ VERSION = @VERSION@ VORBIS_INCFLAGS = @VORBIS_INCFLAGS@ VORBIS_LDFLAGS = @VORBIS_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ acx_pthread_config = @acx_pthread_config@ 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 = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CXXFLAGS = -O2 -pedantic -Wall @DEBUG_CXXFLAGS@ @PTHREAD_CFLAGS@ INCLUDES = @LAME_INCFLAGS@ @VORBIS_INCFLAGS@ @FAAC_INCFLAGS@ @AACPLUS_INCFLAGS@ @TWOLAME_INCFLAGS@ \ @ALSA_INCFLAGS@ @JACK_INCFLAGS@ @SRC_INCFLAGS@ LDADD = @PTHREAD_LIBS@ @LAME_LDFLAGS@ @VORBIS_LDFLAGS@ @FAAC_LDFLAGS@ @AACPLUS_LDFLAGS@ @TWOLAME_LDFLAGS@ \ @ALSA_LDFLAGS@ @JACK_LDFLAGS@ @SRC_LDFLAGS@ @HAVE_SRC_LIB_FALSE@AFLIB_SOURCE = aflibDebug.h\ @HAVE_SRC_LIB_FALSE@ aflibDebug.cc\ @HAVE_SRC_LIB_FALSE@ aflibConverter.h\ @HAVE_SRC_LIB_FALSE@ aflibConverter.cc\ @HAVE_SRC_LIB_FALSE@ aflibConverterLargeFilter.h\ @HAVE_SRC_LIB_FALSE@ aflibConverterSmallFilter.h @HAVE_SRC_LIB_TRUE@AFLIB_SOURCE = darkice_SOURCES = AudioEncoder.h\ AudioSource.h\ AudioSource.cpp\ BufferedSink.cpp\ BufferedSink.h\ CastSink.cpp\ CastSink.h\ FileSink.h\ FileSink.cpp\ Connector.cpp\ Connector.h\ MultiThreadedConnector.cpp\ MultiThreadedConnector.h\ DarkIce.cpp\ DarkIce.h\ Exception.cpp\ Exception.h\ IceCast.cpp\ IceCast.h\ IceCast2.cpp\ IceCast2.h\ ShoutCast.cpp\ ShoutCast.h\ FileCast.h\ FileCast.cpp\ LameLibEncoder.cpp\ LameLibEncoder.h\ TwoLameLibEncoder.cpp\ TwoLameLibEncoder.h\ VorbisLibEncoder.cpp\ VorbisLibEncoder.h\ FaacEncoder.cpp\ FaacEncoder.h\ aacPlusEncoder.cpp\ aacPlusEncoder.h\ OssDspSource.cpp\ OssDspSource.h\ SerialUlaw.cpp\ SerialUlaw.h\ SolarisDspSource.cpp\ SolarisDspSource.h\ Ref.h\ Referable.h\ Sink.h\ Source.h\ TcpSocket.cpp\ TcpSocket.h\ Util.cpp\ Util.h\ ConfigSection.h\ ConfigSection.cpp\ DarkIceConfig.h\ DarkIceConfig.cpp\ Reporter.h\ Reporter.cpp\ AlsaDspSource.h\ AlsaDspSource.cpp\ JackDspSource.h\ JackDspSource.cpp\ main.cpp \ $(AFLIB_SOURCE) EXTRA_darkice_SOURCES = aflibDebug.h\ aflibDebug.cc\ aflibConverter.h\ aflibConverter.cc\ aflibConverterLargeFilter.h\ aflibConverterSmallFilter.h all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .cc .cpp .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/config.h $(srcdir)/config.h.in: $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) 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; \ else :; fi; \ done uninstall-binPROGRAMS: @$(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"; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) darkice$(EXEEXT): $(darkice_OBJECTS) $(darkice_DEPENDENCIES) @rm -f darkice$(EXEEXT) $(CXXLINK) $(darkice_OBJECTS) $(darkice_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AlsaDspSource.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AudioSource.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BufferedSink.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CastSink.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConfigSection.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Connector.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DarkIce.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DarkIceConfig.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Exception.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FaacEncoder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileCast.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileSink.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IceCast.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IceCast2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JackDspSource.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/LameLibEncoder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiThreadedConnector.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OssDspSource.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Reporter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SerialUlaw.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ShoutCast.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SolarisDspSource.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TcpSocket.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TwoLameLibEncoder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/VorbisLibEncoder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aacPlusEncoder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aflibConverter.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aflibDebug.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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) tags=; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) config.h installdirs: 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 uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -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: install-data-am: install-dvi: install-dvi-am install-exec-am: install-binPROGRAMS install-html: install-html-am install-info: install-info-am install-man: install-pdf: install-pdf-am install-ps: install-ps-am installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-hdr distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS @JACK_CFLAGS@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: darkice-1.0/src/TcpSocket.h0000644000175000001440000002021011371632310012520 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : TcpSocket.h Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ #ifndef TCP_SOCKET_H #define TCP_SOCKET_H #ifndef __cplusplus #error This is a C++ include file #endif /* ============================================================ include files */ #include "Source.h" #include "Sink.h" #include "Reporter.h" /* ================================================================ constants */ /* =================================================================== macros */ /* =============================================================== data types */ /** * A TCP network socket * * @author $Author: rafael@riseup.net $ * @version $Revision: 474 $ */ class TcpSocket : public Source, public Sink, public virtual Reporter { private: /** * Name of the host this socket connects to. */ char * host; /** * Port to connect to. */ unsigned short port; /** * Low-level socket descriptor. */ int sockfd; /** * Initialize the object. * * @param host name of the host this socket connects to. * @param port port to connect to. * @exception Exception */ void init ( const char * host, unsigned short port ) throw ( Exception ); /** * De-initialize the object. * * @exception Exception */ void strip ( void ) throw ( Exception ); protected: /** * Default constructor. Always throws an Exception. * * @exception Exception */ inline TcpSocket ( void ) throw ( Exception ) { throw Exception( __FILE__, __LINE__); } public: /** * Constructor. * * @param host name of the host this socket connects to. * @param port port to connect to. * @exception Exception */ inline TcpSocket( const char * host, unsigned short port ) throw ( Exception ) { init( host, port); } /** * Copy constructor. * * @param ss the TcpSocket to copy. * @exception Exception */ TcpSocket( const TcpSocket & ss ) throw ( Exception ); /** * Destructor. * * @exception Exception */ inline virtual ~TcpSocket( void ) throw ( Exception ) { strip(); } /** * Assignment operator. * * @param ss the TcpSocket to assign this to. * @return a reference to this TcpSocket. * @exception Exception */ inline virtual TcpSocket & operator= ( const TcpSocket & ss ) throw ( Exception ); /** * Get the host this socket connects to. * * @return the host this socket connects to. */ inline const char * getHost ( void ) const throw () { return host; } /** * Get the port this socket connects to. * * @return the port this socket connects to. */ inline unsigned int getPort ( void ) const throw () { return port; } /** * Open the TcpSocket. * * @return true if opening was successfull, false otherwise. * @exception Exception */ virtual bool open ( void ) throw ( Exception ); /** * Check if the TcpSocket is open. * * @return true if the TcpSocket is open, false otherwise. */ inline virtual bool isOpen ( void ) const throw () { return sockfd != 0; } /** * Check if the TcpScoket can be read from. * Blocks until the specified time for data to be available. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the TcpSocket is ready to be read from, * false otherwise. * @exception Exception */ virtual bool canRead ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Read from the TcpSocket. * * @param buf the buffer to read into. * @param len the number of bytes to read into buf * @return the number of bytes read (may be less than len). * @exception Exception */ virtual unsigned int read ( void * buf, unsigned int len ) throw ( Exception ); /** * Check if the TcpSocket is ready to accept data. * Blocks until the specified time for data to be available. * * @param sec the maximum seconds to block. * @param usec micro seconds to block after the full seconds. * @return true if the TcpSocket is ready to accept data, * false otherwise. * @exception Exception */ virtual bool canWrite ( unsigned int sec, unsigned int usec ) throw ( Exception ); /** * Write data to the TcpSocket. * * @param buf the data to write. * @param len number of bytes to write from buf. * @return the number of bytes written (may be less than len). * @exception Exception */ virtual unsigned int write ( const void * buf, unsigned int len ) throw ( Exception ); /** * Flush all data that was written to the TcpSocket to the underlying * connection. * * @exception Exception */ inline virtual void flush ( void ) throw ( Exception ) { } /** * Cut what the sink has been doing so far, and start anew. * This usually means separating the data sent to the sink up * until now, and start saving a new chunk of data. * * For TcpSocket, this is a no-op. */ inline virtual void cut ( void ) throw () { } /** * Close the TcpSocket. * * @exception Exception */ virtual void close ( void ) throw ( Exception ); }; /* ================================================= external data structures */ /* ====================================================== function prototypes */ #endif /* TCP_SOCKET_H */ darkice-1.0/src/FileCast.cpp0000644000175000001440000000473211371632310012661 00000000000000/*------------------------------------------------------------------------------ Copyright (c) 2000-2007 Tyrell Corporation. All rights reserved. Tyrell DarkIce File : FileCast.cpp Version : $Revision: 474 $ Author : $Author: rafael@riseup.net $ Location : $HeadURL$ Copyright notice: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ------------------------------------------------------------------------------*/ /* ============================================================ include files */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDIO_H #include #else #error need stdio.h #endif #ifdef HAVE_STRING_H #include #else #error need string.h #endif #include "Exception.h" #include "Source.h" #include "Sink.h" #include "Util.h" #include "FileCast.h" /* =================================================== local data structures */ /* ================================================ local constants & macros */ /*------------------------------------------------------------------------------ * File identity *----------------------------------------------------------------------------*/ static const char fileid[] = "$Id: FileCast.cpp 474 2010-05-10 01:18:15Z rafael@riseup.net $"; /* =============================================== local function prototypes */ /* ============================================================= module code */ /*------------------------------------------------------------------------------ * Open the connection *----------------------------------------------------------------------------*/ bool FileCast :: open ( void ) throw ( Exception ) { if ( isOpen() ) { return false; } if ( !targetFile->open() ) { return false; } return true; } darkice-1.0/depcomp0000755000175000001440000004271311371632436011263 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2007-03-29.01 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 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., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: darkice-1.0/ChangeLog0000644000175000001440000002513611371625603011456 0000000000000009-05-2010 Darkice 1.0 released o fixed a bug in BufferedSink.cpp that leads to some buffers being written twice, causing corruption of datastream, closes ticked #20 thanks to Edwin van den Oetelaar o implemented samplerate conversion for all codecs using libsamplerate, and keeping internal aflibConverter as fallback, thanks to Sergiy o bugfix: fix for alsa driver - closes ticked #8 thanks to Clemens Ladisch 14-11-2009 Darkice 0.20.1 released o added rc.darkice init script thanks to Niels Dettenbach o bugfix: fix for gcc 4.4 05-11-2009 Darkice 0.20 released o new maintainer: Rafael Diniz o added AAC HEv2 encoding support (branch darkice-aacp merged) through libaacplus, http://tipok.org.ua/ru/node/17 thanks to tipok and others for the contribution. o bugfix: the configure script recognizes Ogg Vorbis shared objects now, not just static libraries. Thanks to omroepvenray. o bugfix: enabling jack source compilation on Debian Lenny, thanks to Alessandro Beretta 07-07-2008 Darkice 0.19 released o added mount point option for Darwin Streaming Server thanks to Pierre Souchay o fix for some reliablity issues when using a Jack source thanks to Pierre Souchay o enable easier finding of jack libraries on MacOS X, thanks to Daniel Hazelbaker o added ability to specify name of jack device created by darkice, thanks to Alessandro Beretta 26-04-2007 DarkIce 0.18.1 released o enable real-time scheduling for non-super-users, if they have the proper operating system permissions, thanks to Jens Maurer o fix to enable compliation of the Serial ULAW code on MacOS X, thanks to Elod Horvath o fix to solve Shoutcast login failures, introduced in 0.18 05-03-2007 DarkIce 0.18 released o added serial ulaw input device support, thanks to Clyde Stubbs o improvements on reconnecting: added TCP connection keep-alive to TCP sockets added graceful sleep when trying to reconnect o added user-defined date formatting for the fileAddDate options, thanks to dsk o added logging facility - [file-X] targets will cut the saved file and rename it as needed when darkice recieves the SIGUSR1 signal o added default configuration file handling - if no configuration file is specified, /etc/darkice.cfg is used o fix to enable compiling on 64 bit platforms thanks to Alexander Vlasov and Mariusz Mazur o fix to enable file dump feature using ogg vorbis. thanks to dsk o fix to enable compiling with jack installed at arbitrary locations 19-05-2006 DarkIce 0.17.1 released o bugfix: automatic reconnect works more reliably 26-01-2006 DarkIce 0.17 released o added check for bufferSecs set to 0 thanks to Toph o added realtime parameter to the general section o added MPEG2 support through the TwoLame library. thanks to Nicholas J Humfrey 22-10-2005 DarkIce 0.16 released o added AAC support through the faac codec, http://www.audiocoding.com o bug fix: icecast2 sections didn't honor lowpass or highpass filters when using the mp3 format 14-04-2005 DarkIce 0.15 released o ported to OpenBSD and NetBSD, though real-time scheduling not supported, since it is not implemented in OpenBSD / NetBSD o added possibility to downsample from stereo to mono when encoding to Ogg Vorbis, thanks to Deti Fliegl, o added support for Jack inputs, enabling a lot of interesting usage, including support for MacOS X. Thanks to Nicholas J. Humfrey o various improvements by Joel Ebel o added option to turn off automatic reconnect feature o added IPv6 support, thanks to 15-02-2004: DarkIce 0.14 released o added ALSA support, thanks to Christian Forster o added fix to enable downsampling from stereo to mono of mp3 streams when streaming to an icecast2 server. thanks to John Deeny o removed _X and _Y symbols from aflibConverter files, which caused a naming collision on Solaris. thanks to Robert Lunnon, o bug fix: ogg vorbis recording to only a file caused a segfault. now fixed, thanks to Enrico Ardizzoni 07-01-2004: DarkIce 0.13.2 released o bug fix: two bugs fixed that caused core dump when encoding into mp3 of FreeBSD. thanks to John Hay o added configure option --with-debug to enable compilation for debug mode 12-02-2003: Darkice 0.13.1 released o added cross-platform pthread detection, thanks to Steven G. Johnson and Alejandro Forero Cuervo see http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html o added proper detection of netural endiannes for 16 bit recording o basically these changes allow compilation on FreeBSD 09-02-2003: DarkIce 0.13 released o added feature for setting the TITLE comment field for vorbis streams. thanks to Ricardo Galli o bugfix: fixed minor bug in IcecCast2.cpp, which could have lead to a buffer overflow. thanks to Atsuhiko Yamanaka o bugfix: MultiThreadedConnector::sinkThread() was private, now public o added fileAddDate configuration option thanks to Nicu Pavel o added support for big endian OSS devices (like Linux PowerPC) 20-10-2002: DarkIce 0.12 released o ported to FreeBSD (removed reference to MSG_NOSIGNAL in TcpSocket.cpp) o bug fix: maximum bitrate setting fixed for Ogg Vorbis streams o changed internals so that now each encoding/server connection is a separate thread o when a connection is dropped, DarkIce tries to reconnect, indefinitely 20-08-2002: DarkIce 0.11 released o added possibility to specify maximum bitrate for Ogg Vorbis streams o added HTTP Basic authentication for icecast2 logins o added mp3 streaming for icecast2 o added possibility to stream in mono even when recording in stereo, thus enabling mono and stereo streams with the same darkice instance. only for mp3 streams at the moment thanks to Kai Krakow o bug fix: resampling audio for vorbis streams bugs fixed 02-08-2002: DarkIce 0.10.1 released o bug fix: when the last server dropped connection, darkice crashed thanks to Nicu Pavel o bug fix for LameLibEncoder: the mp3 encoding buffer was deleted too early, resulting in mp3 data corruption. thanks to Nicu Pavel 20-07-2002: DarkIce 0.10 released o added possibility to select constant, average and variable bit rate encoding modes with specifying encoding quality as well. thanks to Nicu Pavel o added support for Ogg Vorbis 1.0 final, removed support for rc2 o added fault tolerance: if one of several server connection drops, DarkIce carries on with the rest of the servers still connected 09-04-2002: DarkIce 0.9.1 released o bugfix: a memory leak was introduced in 0.9, which is fixed thanks to Kristjan G. Bjarnason and Nicu Pavel o minor documentation fix 28-03-2002: DarkIce 0.9 released o added possibility to simply read from the soundcard, encode, and save the encoded data into a local file (no streaming server needed) o added variable bitrate support for vorbis streams o support for both rc2 and rc3 versions of vorbis libraries o added support for resampling when encoding to vorbis thanks to the OSALP project for the resampling class, http://osalp.sourceforge.net/ and Julius O. Smith, for the original code 20-02-2002: DarkIce 0.8 released o added possibility to disable lowpass and highpass filtering for lame o fixed incorrect vorbis bitrate setting o fix: DarkIce now reports public streams correctly thanks to Tom Gray, o made up-to-date with Ogg Vorbis rc3 libs thanks to Michael Smith, o made up-to-date with current IceCast2 cvs version o added local stream dump possibility 19-10-2001: DarkIce 0.7 released o added support for FreeBSD thanks to Robin P. Blanchard, o added support for resampling mp3 streams o DarkIce config file now may contain spaces and tabs as white space o configure script enables build with or without lame / Ogg Vorbis also possibility to specify alternate locations for these 18-09-2001: DarkIce 0.6 released o added support for IceCast2 server with Ogg Vorbis streaming Ogg Vorbis support thanks to aNa|0Gue o added support for SUN Solaris o removed long command line options (as these are extensions to UNIX) o removed configure option to specify location of lame library o removed configure option to compile static executable 09-09-2001: DarkIce 0.5 released o added support for ShoutCast servers o removed local copy of SGI STL, uses STL of the C++ compiler o compiles with gcc3-c++ o added man page darkice.cfg.5 o bugfix: config files can have comments before the first section 02-09-2001: DarkIce 0.4 released o support for external command line encoder removed, replaced with using lame as a shared object or statically linked library o added darkice man page o created RPM packages o DarkIce no longer reports an error if the sound card recording sample rate could not be set to the exact specified amount (e.g. the sound card reports 44101 Hz instead of 44100 Hz) 26-08-2001: DarkIce 0.3.1 released o support for unlimited time encoding thanks to Jim Crilly, 20-12-2000: DarkIce 0.3 released o added POSIX real-time scheduling 18-11-2000: DarkIce 0.2 released o code cleanup o first real tests made o added verbosity command line option 13-11-2000: DarkIce 0.1 released darkice-1.0/INSTALL0000644000175000001440000000241611371632476010737 00000000000000DarkIce installation notes ========================== DarkIce uses the following libraries (and associated header files): for capability to stream mp3 to IceCast 1.x and Shoutcast: - libmp3lame for capability to stream Ogg Vorbis to IceCast 2: - libogg - libvoribs - libvorbisenc To install libmp3lame, please refer to INSTALL.lame. To install libogg, libvoribs and libvorbisenc, please look at INSTALL.vorbis. Installing DarkIce ------------------ If you're reading this, you probably have downloaded and extracted the DarkIce tarball. Go to the directory you extracted it, and try: ./configure --help This will give you all the compile configuration options. On Solaris systems, for some reason the configure script does not find the include file lame/lame.h if it uses the SUN Workshop C compiler as a preprocessor for testing. Therefore you might consider setting: export CPP="gcc -E" This hack is not needed on other systems. If chosing the default compile options, issue the following commands: ./configure make make install For the last step, you need to be root or have write permissions in the target directories, usually directories under /usr/local. Now you should have DarkIce installed. For documentation, try man darkice To try out the program, try darkice -h darkice-1.0/FAQ0000644000175000001440000000112211217323507010220 00000000000000DarkIce Frequenty Asked Questions Q: I get the following error: DarkIce: LameLibEncoder.cpp:75: lame lib opening underlying sink error [0] What am I doing wrong? A: This error means (quite anti-intuitively), that darkice coulnd't connect to the streaming server. Please double-check the following values in your config file: - server - port - password If you're streaming to a shoutcast server, make sure that the port you use is the _source_ port, which is usually 1 above the _client_ port for shoutcast (the defaults are 8000 for client, 8001 for source). darkice-1.0/AUTHORS0000644000175000001440000000307011371615153010744 00000000000000DarkIce initial author: Akos Maroy, DarkIce current maintainer: Rafael Diniz, with contributions by: Jim Crilly, aNa|0Gue, Robin P. Blanchard, Tom Gray, Michael Smith, Julius O. Smith, the OSALP team, http://osalp.sourceforge.net Kristjan G. Bjarnason Nicu Pavel Kai Krakow Atsuhiko Yamanaka Ricardo Galli John Hay Christian Forster John Deeny Robert Lunnon Enrico Ardizzoni Deti Fliegl Nicholas J. Humfrey Joel Ebel Alexander Vlasov Mariusz Mazur dsk Clyde Stubbs Jens Maurer Elod Horvath Pierre Souchay Daniel Hazelbaker Alessandro Beretta Roland Hermans Sergiy Clemens Ladisch Edwin van den Oetelaar darkice-1.0/man/0000777000175000001440000000000011371634115010532 500000000000000darkice-1.0/man/Makefile.am0000644000175000001440000000007611217323507012504 00000000000000man_MANS = darkice.1 darkice.cfg.5 EXTRA_DIST = ${man_MANS} darkice-1.0/man/darkice.10000644000175000001440000000705311371615153012140 00000000000000.TH darkice 1 "November 20, 2007" "DarkIce" "DarkIce live audio streamer" .SH NAME darkice \- an icecast / shoutcast live audio streamer .SH SYNOPSIS .B darkice [options] -c config.file .SH DESCRIPTION .PP DarkIce as a live audio streamer. It records audio from an audio interface (e.g. sound card), encodes it and sends it to a streaming server. DarkIce can record from: * OSS audio devices * ALSA audio devices * Solaris audio interface * Jack sources DarkIce can encode in the following formats: * mp3 - using the lame library * mp2 - using the twolame library * Ogg Vorbis * AAC - using the faac library * AAC HEv2 - using the libaacplus (3GPP reference code) DarkIce can send the encoded stream to the following streaming servers: * ShoutCast * IceCast 1.3.x and 2.x * Darwin Streaming Server Darkice runs on the following operating systems: * FreeBSD * Linux on intel and PowerPC * MacOS X * NetBSD / OpenBSD * SUN Solaris .B DarkIce uses .SM POSIX real-time scheduling to keep up with sound card input. .SM POSIX real-time scheduling is only available if the program is run as root. Therefore it is recommended that .B DarkIce is run as root. .SH OPTIONS .TP .BI "\-c " config.file Specifies what configuration file to use. If not specified, /etc/darkice.cfg will be used. .TP .BI "\-v " n Sets the verbosity level, between 0 and 10. 0 is silent, 10 is loud. Defaults to 1. .TP .BI "\-h " Prints the help page and exits. .SH BUGS .PP Lots of bugs. .SH "SEE ALSO" darkice.cfg(5) .SH AUTHOR Akos Maroy .I .SH ACKNOWLEDGEMENTS Developed with contributions by Jim Crilly, aNa|0Gue, Robin P. Blanchard, Tom Gray, Michael Smith, Julius O. Smith, the OSALP team, http://osalp.sourceforge.net Kristjan G. Bjarnason Nicu Pavel Kai Krakow Atsuhiko Yamanaka Ricardo Galli John Hay Christian Forster John Deeny Robert Lunnon Enrico Ardizzoni Deti Fliegl Nicholas J. Humfrey Joel Ebel Alexander Vlasov Mariusz Mazur dsk Clyde Stubbs Jens Maurer Elod Horvath Pierre Souchay Daniel Hazelbaker Alessandro Beretta Roland Hermans Rafael Diniz .SH LINKS Project homepage: .I http://code.google.com/p/darkice/ .B IceCast homepage: .I http://www.icecast.org/ .B ShoutCast homepage: .I http://www.shoutcast.com/ .B Darwin Streaming Server homepage: .I http://developer.apple.com/darwin/projects/streaming/ .B Lame homepage: .I http://www.mp3dev.org/mp3/ .B TwoLame homepage: .I http://www.twolame.org/ .B Ogg Vorbis homepage: .I http://www.xiph.org/ogg/vorbis/ .B faac homepage: .I http://www.audiocoding.com/ .B libaacplus homepage: .I http://tipok.org.ua/node/17 .B DarkSnow GTK front-end: .I http://darksnow.radiolivre.org/index.en.html written by Rafael Diniz darkice-1.0/man/darkice.cfg.50000644000175000001440000004156411371615153012707 00000000000000.TH darkice.cfg 5 "February 25, 2007" "DarkIce" "DarkIce live audio streamer" .SH NAME darkice.cfg \- configuration file for darkice .SH DESCRIPTION .PP The configuration file consists of sections, with key = value pairs separated with spaces and/or tabs inside each secion: .nf [section1] # this is a whole line comment key = value an ugly key name = long value # this end is a comment too [section2] # this is a whole line comment in section 2 key = value an ugly key name = long value # this end is a comment too .fi A proper .B DarkIce configuration file contains the following sections: .nf [general] [input] [icecast-0] ... [icecast-7] [icecast2-0] ... [icecast2-7] [shoutcast-0] ... [shoutcast-7] [file-0] ... [file-7] .fi The order of the sections is not important. Sections [general] and [input] are required, and at least one of [icecast-x], [icecast2-x], [shoutcast-x] or [file-x] is needed. In particular, the following sections and values are recognized: .PP .B [general] This section describes general operational parameters (required). Required values: .TP .I duration Time for DarkIce to run, in seconds. If 0, run forever. .TP .I bufferSecs Data read from the sound card is buffered before sent to the encoder. Each buffer will be able to hold this many seconds of samples. .PP Optional values: .TP .I reconnect Try to reconnect to the server(s) if the connection is broken during streaming, "yes" or "no". (optional parameter, defaults to "yes") .TP .I realtime Use POSIX realtime scheduling, "yes" or "no". (optional parameter, defaults to "yes") .PP .B [input] This section describes the input (required). Required values: .TP .I device Specify the device to record from, which can be an OSS DSP device, an ALSA source or you can use Jack audio. - OSS DSP audio device to record from (e.g. /dev/dsp) - ALSA DSP device name (e.g. hwplug:0,0) - the string 'jack', to have an unconnected Jack port, or 'jack_auto' to automatically make Jack connect to the first source. .TP .I sampleRate The sample rate to record with, samples per second (e.g. 44100 for 44.1kHz CD-quality audio, 22050 for 22kHz or 11025 for 11kHz) .TP .I bitsPerSample Number of bits to use for each sample (e.g. 8 bits or 16 bits) .TP .I channel Number of channels to record (e.g. 1 for mono, 2 for stereo) .TP .I jackClientName The name of the jack input channel created by darkice if device=jack is specified. .PP .B [icecast-x] This section describes an output to an .B IceCast 1.3.x server or .B Darwin Streaming Server , while encoding with a lame encoder. There may be at most 8 outputs, numbered from 0 ... 7. The number is included in the section name (e.g. [icecast-0] ... [icecast-7]). The stream will be reachable at .I http://:/ Required values: .TP .I bitrateMode The bit rate mode of the encoding, either "cbr", "abr" or "vbr", standing for constant bit rate, average bit rate and variable bit respectively. Use the bitrate and/or quality values to specify details of the appropriate bit rate mode. .TP .I bitrate Bit rate to encode to in kBits / sec (e.g. 96). Only used when cbr or abr bit rate modes are specified. .TP .I quality The quality of encoding a value between 0.0 .. 1.0 (e.g. 0.8), with 1.0 being the highest quality. Use a value greater than 0.0. Only used when cbr or vbr bit rate modes are specified. .TP .I server The .B IceCast server's name (e.g. yp.yourserver.com) .TP .I port The port to connect to the IceCast server (e.g. 8000) .TP .I password The password to use to connect to the .B IceCast server .TP .I mountPoint Mount point for the stream on the server .PP Optional values: .TP .I sampleRate The sample rate of the encoded mp3 output. If not specified, defaults to the value of the input sample rate. .TP .I channel Number of channels for the mp3 output (e.g. 1 for mono, 2 for stereo). If not specified, defaults to the value of the input sample rate. .TP .I name Name of the stream .TP .I description Description of the stream .TP .I url Url related to the stream .TP .I genre Genre of the stream .TP .I public "yes" or "no", wether the stream is public .TP .I remoteDumpFile The file the .B IceCast server should dump the contents of this stream on its side. .TP .I localDumpFile Dump the same mp3 data sent to the .B IceCast server to this local file. .TP .I fileAddDate "yes" or "no" if you want to automaticaly insert a date string in the localDumpFile name before its extension or at the end of file name if no extension present .TP .I fileDateFormat The date format to use for appending the date to the dump file name. Defaults to "[%m-%d-%Y-%H-%M-%S]". All format strings acceptable by strftime() can be used, see the strftime man page for details. Only applicable is fileAddDate is "true". .TP .I lowpass Lowpass filter setting for the lame encoder, in Hz. Frequencies above the specified value will be cut. If not set or set to 0, the encoder's default behaviour is used. If set to -1, the filter is disabled. .TP .I highpass Highpass filter setting for the lame encoder, in Hz. Frequencies below the specified value will be cut. If not set or set to 0, the encoder's default behaviour is used. If set to -1, the filter is disabled. .PP .B [icecast2-x] This section describes an output to an .B IceCast2 server, while encoding with the ogg vobis encoder. There may be at most 8 outputs, numbered from 0 ... 7. The number is included in the section name (e.g. [icecast2-0] ... [icecast2-7]). The stream will be reachable at .I http://:/ .P .B DarkIce supports both fixed bitrate and variable bitrate vorbis streams. When using fixed bitrate, specify the bitrate using the .I bitrate field. When using variable bitrate, specify the quality of the stream by the .I quality field, which is a value between 0.0 and 1.0. Required values: .TP .I format Format of the stream sent to the .B IceCast2 server. Supported formats are 'vorbis', 'mp3', 'mp2', 'aac' and 'aacp'. .TP .I bitrateMode The bit rate mode of the encoding, either "cbr", "abr" or "vbr", standing for constant bit rate, average bit rate and variable bit respectively. Use the bitrate and/or quality values to specify details of the appropriate bit rate mode. .TP .I bitrate Bit rate to encode to in kBits / sec (e.g. 96). Only used when cbr or abr bit rate modes are specified. .TP .I quality The quality of encoding a value between 0.0 .. 1.0 (e.g. 0.8), with 1.0 being the highest quality. Use a value greater than 0.0. Only used when vbr bit rate mode is specified for Ogg Vorbis format, or in vbr and abr modes for mp3 and mp2 format. .TP .I server The .B IceCast2 server's name (e.g. yp.yourserver.com) .TP .I port The port to connect to the IceCast server (e.g. 8000) .TP .I password The password to use to connect to the .B IceCast2 server .TP .I mountPoint Mount point for the stream on the server .PP Optional values: .TP .I sampleRate The sample rate of the encoded output. If not specified, defaults to the value of the input sample rate. .TP .I channel Number of channels for the output (e.g. 1 for mono, 2 for stereo). If not specified, defaults to the value of the input sample rate. Different channels for input and output are only supported for mp3, but not for Ogg Vorbis. .TP .I maxBitrate The maximum bitrate of the stream. Only used when in cbr mode and in Ogg Vorbis format. .TP .I name Name of the stream .TP .I description Description of the stream .TP .I url Url related to the stream .TP .I genre Genre of the stream .TP .I public "yes" or "no", wether the stream is public .TP .I localDumpFile Dump the same Ogg Vorbis data sent to the .B IceCast2 server to this local file. .TP .I fileAddDate "yes" or "no" if you want to automaticaly insert a date string in the localDumpFile name before its extension or at the end of file name if no extension present .TP .I fileDateFormat The date format to use for appending the date to the dump file name. Defaults to "[%m-%d-%Y-%H-%M-%S]". All format strings acceptable by strftime() can be used, see the strftime man page for details. Only applicable is fileAddDate is "true". .TP .I lowpass Lowpass filter setting for the lame encoder, in Hz. Frequencies above the specified value will be cut. If not set or set to 0, the encoder's default behaviour is used. If set to -1, the filter is disabled. Only has effect if the mp3 or mp2 format is used. .TP .I highpass Highpass filter setting for the lame encoder, in Hz. Frequencies below the specified value will be cut. If not set or set to 0, the encoder's default behaviour is used. If set to -1, the filter is disabled. Only has effect if the mp3 or mp2 format is used. .PP .B [shoutcast-x] This section describes an output to a .B ShoutCast server, while encoding with a lame encoder. There may be at most 8 outputs, numbered from 0 ... 7. The number is included in the section name (e.g. [shoutcast-0] ... [shoutcast-7]). The stream will be reachable at .I http://:/ Required values: .TP .I bitrateMode The bit rate mode of the encoding, either "cbr", "abr" or "vbr", standing for constant bit rate, average bit rate and variable bit respectively. Use the bitrate and/or quality values to specify details of the appropriate bit rate mode. .TP .I bitrate Bit rate to encode to in kBits / sec (e.g. 96). Only used when cbr or abr bit rate modes are specified. .TP .I quality The quality of encoding a value between 0.0 .. 1.0 (e.g. 0.8), with 1.0 being the highest quality. Use a value greater than 0.0. Only used when cbr or vbr bit rate modes are specified. .TP .I server The .B ShoutCast server's name (e.g. yp.yourserver.com) .TP .I port The source port to connect to the ShoutCast server (e.g. 8001) .TP .I password The password to use to connect to the .B ShoutCast server .PP Optional values: .TP .I mountPoint Mount point for the stream on the server. Only works on Darwin Streaming Server, the original Shoutcast server does not support mount points .TP .I sampleRate The sample rate of the encoded mp3 output. If not specified, defaults to the value of the input sample rate. .TP .I channel Number of channels for the mp3 output (e.g. 1 for mono, 2 for stereo). If not specified, defaults to the value of the input sample rate. .TP .I name Name of the stream .TP .I url Url related to the stream .TP .I genre Genre of the stream .TP .I public "yes" or "no", wether the stream is public .TP .I irc IRC information related to the stream .TP .I aim AIM information related to the stream .TP .I icq ICQ information related to the stream .TP .I lowpass Lowpass filter setting for the lame encoder, in Hz. Frequencies above the specified value will be cut. If not set or set to 0, the encoder's default behaviour is used. If set to -1, the filter is disabled. .TP .I highpass Highpass filter setting for the lame encoder, in Hz. Frequencies below the specified value will be cut. If not set or set to 0, the encoder's default behaviour is used. If set to -1, the filter is disabled. .TP .I localDumpFile Dump the same mp3 data sent to the .B ShoutCast server to this local file. .TP .I fileAddDate "yes" or "no" if you want to automaticaly insert a date string in the localDumpFile name before its extension or at the end of file name if no extension present .TP .I fileDateFormat The date format to use for appending the date to the dump file name. Defaults to "[%m-%d-%Y-%H-%M-%S]". All format strings acceptable by strftime() can be used, see the strftime man page for details. Only applicable is fileAddDate is "true". .PP .B [file-x] This section describes an output to a local file in either Ogg Vorbis or mp3 format. There may be at most 8 outputs, numbered from 0 ... 7. The number is included in the section name (e.g. [file-0] ... [file-7]). Required values: .TP .I format Format to encode in. Must be either 'mp3', 'mp2', 'vorbis', 'aac' or 'aacp'. .TP .I bitrateMode The bit rate mode of the encoding, either "cbr", "abr" or "vbr", standing for constant bit rate, average bit rate and variable bit respectively. Use the bitrate and/or quality values to specify details of the appropriate bit rate mode. .TP .I bitrate Bit rate to encode to in kBits / sec (e.g. 96). Only used when cbr or abr bit rate modes are specified. .TP .I quality The quality of encoding a value between 0.0 .. 1.0 (e.g. 0.8), with 1.0 being the highest quality. Use a value greater than 0.0. Only used when cbr or vbr bit rate modes are specified. .TP .I fileName The name of the local file to save the encoded data into. .PP Optional values: .TP .I sampleRate The sample rate of the encoded mp3 output. If not specified, defaults to the value of the input sample rate. Only used if the output format is mp3. .TP .I lowpass Lowpass filter setting for the lame encoder, in Hz. Frequencies above the specified value will be cut. If not set or set to 0, the encoder's default behaviour is used. If set to -1, the filter is disabled. Only used if the output format is mp3. .TP .I highpass Highpass filter setting for the lame encoder, in Hz. Frequencies below the specified value will be cut. If not set or set to 0, the encoder's default behaviour is used. If set to -1, the filter is disabled. Only used if the output format is mp3. .PP A sample configuration file follows. This file makes .B DarkIce stream for 1 minute (60 seconds) from the audio device .I /dev/dsp at 22.05kHz, 16 bit stereo. It will build up a connection to the .B IceCast server yp.yourserver.com on port 8000 with the password "hackme". The stream will be encoded to 96 kb/s mp3 with quality 0.8, and will be reachable at .I http://yp.yourserver.com:8000/live96 to mp3 players. The encoding session will be stored by .B IceCast in the file .I /tmp/server-dump.mp3 on the server side, and also by .B DarkIce in the file .I /tmp/encoder-dump.mp3 on the encoder side. .nf [general] duration = 60 bufferSecs = 5 [input] device = /dev/dsp sampleRate = 22050 bitsPerSample = 16 channel = 2 [icecast-0] bitrateMode = cbr bitrate = 96 quality = 0.8 server = yp.yourserver.com port = 8000 password = hackme mountPoint = live96 name = DarkIce trial description = This is only a trial url = http://www.yourserver.com genre = live public = no remoteDumpFile = /tmp/server-dump.mp3 localDumpFile = /tmp/encoder-dump.mp3 fileAddDate = no .fi .PP The following sample configuration file simply encodes the 16 bit stereo 44.1 kHz sound card input into Ogg Vorbis at average bit rate 96 kb/s for 60 seconds, and saves it in the local file at /tmp/save.ogg. .nf [general] duration = 60 bufferSecs = 5 [input] device = /dev/dsp sampleRate = 44100 bitsPerSample = 16 channel = 2 [file-0] format = vorbis bitrateMode = abr bitrate = 96 fileName = /tmp/save.ogg .fi .PP A bit more complicated sample follows. This one makes .B DarkIce stream for 1 hour (3600 seconds) from the audio device .I /dev/dsp at 44.1kHz, 16 bit stereo. It will build up a connection to an .B IceCast server yp.your-ice-server.com on port 8000 with the password "ice-hackme". The sound for this stream will be cut at 10500 Hz from above. The stream will be encoded to average bit rate 96 kb/s mp3 and resampled to 22.05kHz and 1 channel (mono). The stream will be reachable at .I http://yp.your-ice-server.com:8000/live96 to mp3 players. The encoding session will be stored by .B IceCast in the file .I /tmp/live96.mp3 on the server side. It will also connect to a .I ShoutCast server at yp.your-shout-server.com on port 8001 with the password "shout-hackme" This stream will be encoded to constant bit rate 128 kb/s mp3 with quality 0.8, and will be reachable at .I http://yp.your-shout-server.com:8000 to mp3 players. .nf [general] duration = 3600 bufferSecs = 5 [input] device = /dev/dsp sampleRate = 22050 bitsPerSample = 16 channel = 2 [icecast-0] sampleRate = 22050 channel = 1 bitrateMode = abr bitrate = 96 lowpass = 10500 server = yp.your-ice-server.com port = 8000 password = ice-hackme mountPoint = live96 name = DarkIce trial description = This is only a trial url = http://www.yourserver.com genre = live public = yes remoteDumpFile = /tmp/live96.mp3 [shoutcast-0] bitrateMode = cbr bitrate = 128 quality = 0.8 server = yp.your-shout-server.com port = 8001 password = shout-hackme name = DarkIce trial url = http://www.yourserver.com genre = live public = yes irc = irc.yourserver.com aim = aim here icq = I see you too .fi .SH BUGS .PP Lots of bugs. .SH "SEE ALSO" darkice(1) .SH AUTHOR Akos Maroy .I .SH LINKS Project homepage: .I http://code.google.com/p/darkice/ .B IceCast homepage: .I http://www.icecast.org/ .B ShoutCast homepage: .I http://www.shoutcast.com/ .B Lame homepage: .I http://www.mp3dev.org/mp3/ .B Ogg Vorbis homepage: .I http://www.xiph.org/ogg/vorbis/ darkice-1.0/man/Makefile.in0000644000175000001440000003033211371632436012520 00000000000000# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = man DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" man5dir = $(mandir)/man5 NROFF = nroff MANS = $(man_MANS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) AACPLUS_INCFLAGS = @AACPLUS_INCFLAGS@ AACPLUS_LDFLAGS = @AACPLUS_LDFLAGS@ ACLOCAL = @ACLOCAL@ ALSA_INCFLAGS = @ALSA_INCFLAGS@ ALSA_LDFLAGS = @ALSA_LDFLAGS@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CXXFLAGS = @DEBUG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FAAC_INCFLAGS = @FAAC_INCFLAGS@ FAAC_LDFLAGS = @FAAC_LDFLAGS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JACK_CFLAGS = @JACK_CFLAGS@ JACK_INCFLAGS = @JACK_INCFLAGS@ JACK_LDFLAGS = @JACK_LDFLAGS@ LAME_INCFLAGS = @LAME_INCFLAGS@ LAME_LDFLAGS = @LAME_LDFLAGS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SRC_CFLAGS = @SRC_CFLAGS@ SRC_INCFLAGS = @SRC_INCFLAGS@ SRC_LDFLAGS = @SRC_LDFLAGS@ STRIP = @STRIP@ TWOLAME_INCFLAGS = @TWOLAME_INCFLAGS@ TWOLAME_LDFLAGS = @TWOLAME_LDFLAGS@ VERSION = @VERSION@ VORBIS_INCFLAGS = @VORBIS_INCFLAGS@ VORBIS_LDFLAGS = @VORBIS_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ acx_pthread_config = @acx_pthread_config@ 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 = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ man_MANS = darkice.1 darkice.cfg.5 EXTRA_DIST = ${man_MANS} all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu man/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-man1: $(man1_MANS) $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ *) ext='1' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ done uninstall-man1: @$(NORMAL_UNINSTALL) @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ *) ext='1' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ done install-man5: $(man5_MANS) $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)" @list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.5*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 5*) ;; \ *) ext='5' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst"; \ done uninstall-man5: @$(NORMAL_UNINSTALL) @list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.5*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 5*) ;; \ *) ext='5' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f '$(DESTDIR)$(man5dir)/$$inst'"; \ rm -f "$(DESTDIR)$(man5dir)/$$inst"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-exec-am: install-html: install-html-am install-info: install-info-am install-man: install-man1 install-man5 install-pdf: install-pdf-am install-ps: install-ps-am installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man1 uninstall-man5 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man1 install-man5 install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am uninstall-man \ uninstall-man1 uninstall-man5 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: darkice-1.0/missing0000755000175000001440000002557711371632436011316 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2006-05-10.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case $1 in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $1 in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: darkice-1.0/INSTALL.vorbis0000644000175000001440000000164311217323507012232 00000000000000Installing Ogg Vorbis --------------------- To install DarkIce, you need the following Ogg Vorbis 1.0 or later libraries (and related header files): - libogg - libvoribs - libvorbisenc installed on your system. It is recommended that use install these to the usual system locations, /usr/lib, /usr/include, so that DarkIce will find the header files and libraries. Thus when configuring, add --prefix=/usr to the configure options. Grab the latest Ogg Vorbis tarballs from http://www.xiph.org/ogg/vorbis/download.html I took libogg-1.0.tar.gz and libvorbis-1.0.tar.gz. Go to the directory where you saved them, and issue the following commands: tar xfz libogg-1.0.tar.gz cd libogg-1.0 ./configure --prefix=/usr make make install cd .. tar xfz libvorbis-1.0.tar.gz cd libvorbis-1.0 ./configure --prefix=/usr make make install For the install steps, you need to be root or have write permissions in the target directories. darkice-1.0/rc.darkice0000644000175000001440000001245411371615153011632 00000000000000#!/bin/sh # generic init file for darkice # # Author: # Niels Dettenbach - nd@syndicat.com - 2009-11-05 # # License: # GPLv3 (2009) # ## settings ## # check your paths! program=/usr/bin/darkice pidfile=/var/run/darkice.pid configfile=/etc/darkice.cfg logfile=/var/log/darkice.log progname="darkice" restart_delay=2 verbose="5" ## end of settings ## RETVAL=0 if [ ! -f $configfile ] then echo "$progname: config file not found" exit fi if [ ! -f $program ] then echo "$progname: programm file $program not found" exit fi case $1 in 'start') if [ -f $pidfile ]; then PID=`cat $pidfile` running=`ps --no-headers -o "%c" -p $PID` if ( [ "$progname" == "$running" ] ); then echo "$progname is still running" else echo "$progname seems crashed - PID does not match the deamon" echo "removing stale PID File $pidfile" rm $pidfile $0 start exit $? fi exit 0 else echo -n $"Starting $progname " RETVAL=1 $program -v $verbose -c $configfile 2>%1 >> $logfile & echo RETVAL=$? if [ $RETVAL -eq 0 ]; then echo $! > $pidfile echo " started" else echo " not started" echo $RETVAL exit 0 fi RETVAL=$? fi ;; 'stop') if [ -f $pidfile ]; then echo -n $"Stop $progname " PID=`cat $pidfile` kill -s TERM $PID 2> /dev/null echo sleep $restart_delay rm $pidfile echo " stopped" else echo "$progname not running" fi RETVAL=$? ;; 'status') if [ -f $pidfile ]; then PID=`cat $pidfile` running=`ps --no-headers -o "%c" -p $PID` if ( [ "$progname" == "$running" ] ); then echo "$progname IS running with PID `cat $pidfile`." else echo "$progname process is dead or stale PID File $pidfile" exit 0 fi else echo "$progname is not running" exit 0 fi ;; 'restart') $0 stop $0 start RETVAL=$? ;; 'restartifdown') if [ -f $pidfile ]; then PID=`cat $pidfile` running=`ps --no-headers -o "%c" -p $PID` if ( [ "$progname" == "$running" ] ); then echo "$progname IS running with PID `cat $pidfile` - no restart." else echo "$progname PID $PID seems dead - restart" $0 stop $0 start RETVAL=$? fi else echo "PID file $pidfile found - restart" $0 stop $0 start RETVAL=$? fi ;; *) echo "Usage: $0 {start|stop|restart|status|restartifdown} " exit 1; ;; esac exit $RETVAL darkice-1.0/NEWS0000644000175000001440000000576411371615153010407 0000000000000014-11-2009, Rafael Diniz, rafael@riseup.net Released version 0.20.1. See ChangeLog for changes. 05-11-2009, Rafael Diniz, rafael@riseup.net Released version 0.20. See ChangeLog for changes. 07-07-2008, Akos Maroy, darkeye@tyrell.hu Released version 0.19. See ChangeLog for changes. 26-04-2007, Akos Maroy, darkeye@tyrell.hu Released version 0.18.1. See ChangeLog for changes. 05-03-2007, Akos Maroy, darkeye@users.sourceforge.net Released version 0.18. See ChangeLog for changes. 19-05-2006, Akos Maroy, darkeye@users.sourceforge.net Released version 0.17.1. See ChangeLog for changes. 26-01-2006, Akos Maroy, darkeye@users.sourceforge.net Released version 0.17. See ChangeLog for changes. 22-10-2005, Akos Maroy, darkeye@users.sourceforge.net Released version 0.16. See ChangeLog for changes. 14-04-2005, Akos Maroy, darkeye@users.sourceforge.net Released version 0.15. See ChangeLog for changes. 15-02-2004, Akos Maroy, darkeye@users.sourceforge.net Released version 0.14. See ChangeLog for changes. 07-01-2004, Akos Maroy, darkeye@users.sourceforge.net Released version 0.13.2. See ChangeLog for changes. 12-02-2003, Akos Maroy, darkeye@users.sourceforge.net Released version 0.13.1. See ChangeLog for changes. 09-02-2003, Akos Maroy, darkeye@users.sourceforge.net Released version 0.13. See ChangeLog for changes. 20-10-2002, Akos Maroy, darkeye@users.sourceforge.net Released version 0.12. See ChangeLog for changes. 20-08-2002, Akos Maroy, darkeye@users.sourceforge.net Released version 0.11. See ChangeLog for changes. 02-08-2002, Akos Maroy, darkeye@users.sourceforge.net Released version 0.10.1. See ChangeLog for changes. 20-07-2002, Akos Maroy, darkeye@users.sourceforge.net Released version 0.10. See ChangeLog for changes. 09-04-2002, Akos Maroy, darkeye@users.sourceforge.net Released version 0.9.1. See ChangeLog for changes. 28-03-2002, Akos Maroy, darkeye@users.sourceforge.net Released version 0.9. See ChangeLog for changes. 20-02-2002, Akos Maroy, darkeye@users.sourceforge.net Released version 0.8. See ChangeLog for changes. 19-10-2001, Akos Maroy, darkeye@users.sourceforge.net Released version 0.7. See ChangeLog for changes. 18-09-2001, Akos Maroy, darkeye@users.sourceforge.net Released version 0.6. See ChangeLog for changes. 09-09-2001, Akos Maroy, darkeye@users.sourceforge.net Released version 0.5. See ChangeLog for changes. 02-09-2001, Akos Maroy, darkeye@users.sourceforge.net Released version 0.4. See ChangeLog for changes. 26-08-2001, Akos Maroy, darkeye@users.sourceforge.net Released version 0.3.1. See ChangeLog for changes. 20-12-2000, Akos Maroy, darkeye@users.sourceforge.net Released version 0.3. See ChangeLog for changes. 18-11-2000, Akos Maroy, darkeye@users.sourceforge.net Released version 0.2. See ChangeLog for changes. 13-11-2000, Akos Maroy, darkeye@users.sourceforge.net Initial release. Supports the lame encoder. darkice-1.0/TODO0000644000175000001440000000115611371615153010367 00000000000000o Add samplerate conversion for samplerate audio output different from audio source o Add Coreaudio support o change Ref to follow inheritance o make a master config file, and a small one ? o add support for multiple servers for one stream ? o revisit real-time scheduling o look into performance o create proper error-reporting module o set comment fields for Ogg Vorbis streams as in http://www.xiph.org/ogg/vorbis/doc/v-comment.html o change config file to separate descriptions of input, streams and stream targets (servers, files, etc.) o add support for 24 and 32 bit input and higher sample rates (up to 96kHz) darkice-1.0/darkice.cfg0000644000175000001440000000776611371615153011777 00000000000000# sample DarkIce configuration file, edit for your needs before using # see the darkice.cfg man page for details # this section describes general aspects of the live streaming session [general] duration = 60 # duration of encoding, in seconds. 0 means forever bufferSecs = 5 # size of internal slip buffer, in seconds reconnect = yes # reconnect to the server(s) if disconnected # this section describes the audio input that will be streamed [input] device = /dev/dsp # OSS DSP soundcard device for the audio input sampleRate = 22050 # sample rate in Hz. try 11025, 22050 or 44100 bitsPerSample = 16 # bits per sample. try 16 channel = 2 # channels. 1 = mono, 2 = stereo # this section describes a streaming connection to an IceCast2 server # there may be up to 8 of these sections, named [icecast2-0] ... [icecast2-7] # these can be mixed with [icecast-x] and [shoutcast-x] sections [icecast2-0] bitrateMode = abr # average bit rate format = vorbis # format of the stream: ogg vorbis bitrate = 96 # bitrate of the stream sent to the server server = yp.yourserver.com # host name of the server port = 8000 # port of the IceCast2 server, usually 8000 password = hackme # source password to the IceCast2 server mountPoint = sample96 # mount point of this stream on the IceCast2 server name = DarkIce trial # name of the stream description = This is only a trial # description of the stream url = http://www.yourserver.com # URL related to the stream genre = my own # genre of the stream public = yes # advertise this stream? localDumpFile = dump.ogg # local dump file # this section describes a streaming connection to an IceCast server # there may be up to 8 of these sections, named [icecast-0] ... [icecast-7] # these can be mixed with [icecast2-x] and [shoutcast-x] sections [icecast-0] bitrateMode = cbr # constant bit rate bitrate = 96 # bitrate of the mp3 stream sent to the server quality = 0.8 # encoding quality server = yp.yourserver.com # host name of the server port = 8000 # port of the IceCast server, usually 8000 password = hackme # source password to the IceCast server mountPoint = sample96 # mount point of this stream on the IceCast server name = DarkIce trial # name of the stream description = This is only a trial # description of the stream url = http://www.yourserver.com # URL related to the stream genre = my own # genre of the stream public = yes # advertise this stream? # this section describes a streaming connection to a ShoutCast server # there may be up to 8 of these sections, named [shoutcast-0] ... [shoutcast-7] # these can be mixed with [icecast-x] and [icecast2-x] sections [shoutcast-0] bitrateMode = vbr # variable bit rate mode quality = 0.5 # encoding quality server = yp.yourserver.com # host name of the server port = 8001 # source port of the ShoutCast server, usually 8001 password = hackme # source password to the ShoutCast server name = DarkIce trial # name of the stream url = http://www.yourserver.com # URL related to the stream genre = my own # genre of the stream public = yes # advertise this stream? irc = irc.yourserver.com # IRC info related to the stream aim = aim here # AIM info related to the stream icq = I see you too # ICQ info related to the stream darkice-1.0/install-sh0000755000175000001440000003246411371632436011714 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2006-12-25.00 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: darkice-1.0/aclocal.m40000644000175000001440000007764311371632433011555 00000000000000# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(AC_AUTOCONF_VERSION, [2.63],, [m4_warning([this file was generated for autoconf 2.63. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.10.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.10.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep 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 # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 13 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.60])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) 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 AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])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_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl 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 ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _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. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # 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)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([acinclude.m4]) darkice-1.0/Makefile.in0000644000175000001440000005073511371632436011756 00000000000000# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \ ChangeLog INSTALL NEWS TODO config.guess config.sub depcomp \ install-sh ltmain.sh missing mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(sysconfdir)" sysconfDATA_INSTALL = $(INSTALL_DATA) DATA = $(sysconf_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print AACPLUS_INCFLAGS = @AACPLUS_INCFLAGS@ AACPLUS_LDFLAGS = @AACPLUS_LDFLAGS@ ACLOCAL = @ACLOCAL@ ALSA_INCFLAGS = @ALSA_INCFLAGS@ ALSA_LDFLAGS = @ALSA_LDFLAGS@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEBUG_CXXFLAGS = @DEBUG_CXXFLAGS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FAAC_INCFLAGS = @FAAC_INCFLAGS@ FAAC_LDFLAGS = @FAAC_LDFLAGS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ JACK_CFLAGS = @JACK_CFLAGS@ JACK_INCFLAGS = @JACK_INCFLAGS@ JACK_LDFLAGS = @JACK_LDFLAGS@ LAME_INCFLAGS = @LAME_INCFLAGS@ LAME_LDFLAGS = @LAME_LDFLAGS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SRC_CFLAGS = @SRC_CFLAGS@ SRC_INCFLAGS = @SRC_INCFLAGS@ SRC_LDFLAGS = @SRC_LDFLAGS@ STRIP = @STRIP@ TWOLAME_INCFLAGS = @TWOLAME_INCFLAGS@ TWOLAME_LDFLAGS = @TWOLAME_LDFLAGS@ VERSION = @VERSION@ VORBIS_INCFLAGS = @VORBIS_INCFLAGS@ VORBIS_LDFLAGS = @VORBIS_LDFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ acx_pthread_config = @acx_pthread_config@ 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 = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DOC_DIR = doc DOXYGEN_DIR = doc/doxygen DOXYGEN_CONFIG = etc/doxygen.config SUBDIRS = src man sysconf_DATA = darkice.cfg EXTRA_DIST = $(DOC_DIR) darkice.cfg INSTALL.lame INSTALL.vorbis FAQ rc.darkice all: all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ cd $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) install-sysconfDATA: $(sysconf_DATA) @$(NORMAL_INSTALL) test -z "$(sysconfdir)" || $(MKDIR_P) "$(DESTDIR)$(sysconfdir)" @list='$(sysconf_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(sysconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sysconfdir)/$$f'"; \ $(sysconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sysconfdir)/$$f"; \ done uninstall-sysconfDATA: @$(NORMAL_UNINSTALL) @list='$(sysconf_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(sysconfdir)/$$f'"; \ rm -f "$(DESTDIR)$(sysconfdir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d $(distdir) || mkdir $(distdir) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ am__remove_distdir=: \ am__skip_length_check=: \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ unlzma -c $(distdir).tar.lzma | $(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 chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(sysconfdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-exec-am: install-sysconfDATA install-html: install-html-recursive install-info: install-info-recursive install-man: install-pdf: install-pdf-recursive install-ps: install-ps-recursive installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-sysconfDATA .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ install-strip .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ dist-lzma dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip install-sysconfDATA installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ uninstall-sysconfDATA .PHONY: doc doc: src # mkdir -p $(DOXYGEN_DIR) # doxygen etc/doxygen.config doxygen_clean: rm -rf $(DOXYGEN_DIR) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: darkice-1.0/ltmain.sh0000644000175000001440000060603411072713530011521 00000000000000# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: progname=`echo "$progpath" | $SED $basename` modename="$progname" # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.5.26 TIMESTAMP=" (1.1220.2.492 2008/01/30 06:40:56)" # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= duplicate_deps=no preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 ##################################### # Shell function definitions: # This seems to be the best place for them # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $mkdir "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || { $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 exit $EXIT_FAILURE } fi $echo "X$my_tmpdir" | $Xsed } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ $SED -n -e '1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit $EXIT_FAILURE # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 exit $EXIT_FAILURE fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) extracted_serial=`expr $extracted_serial + 1` my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then exit $exit_status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist ${rm}r unfat-$$ cd "$darwin_orig_dir" else cd "$darwin_orig_dir" func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches fi # $run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" disable_libs=no # Parse our command line options once, thoroughly. while test "$#" -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 exit $EXIT_FAILURE ;; esac case $tagname in CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. ;; *) if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; esac ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) echo "\ $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $? ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done exit $? ;; --debug) $echo "$progname: enabling shell trace mode" set -x preserve_args="$preserve_args $arg" ;; --dry-run | -n) run=: ;; --features) $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $? ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag preserve_args="$preserve_args --tag" ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag preserve_args="$preserve_args --tag" ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi case $disable_libs in no) ;; shared) build_libtool_libs=no build_old_libs=yes ;; static) build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` ;; esac # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit $EXIT_FAILURE fi arg_mode=target continue ;; -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; * ) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, and some SunOS ksh mistreat backslash-escaping # in scan sets (worked around with variable expansion), # and furthermore cannot handle '|' '&' '(' ')' in scan sets # at all, so we specify them separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" exit $EXIT_FAILURE ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit $EXIT_FAILURE ;; *) # Get the name of the library object. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.[fF][09]?) xform=[fF][09]. ;; *.for) xform=for ;; *.java) xform=java ;; *.obj) xform=obj ;; *.sx) xform=sx ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit $EXIT_FAILURE ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` case $qlibobj in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qlibobj="\"$qlibobj\"" ;; esac test "X$libobj" != "X$qlibobj" \ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` case $qsrcfile in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qsrcfile="\"$qsrcfile\"" ;; esac $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit $EXIT_FAILURE fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit $EXIT_FAILURE fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; shrext) shrext_cmds="$arg" prev= continue ;; darwin_framework|darwin_framework_skip) test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework|-arch|-isysroot) case " $CC " in *" ${arg} ${1} "* | *" ${arg} ${1} "*) prev=darwin_framework_skip ;; *) compiler_flags="$compiler_flags $arg" prev=darwin_framework ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" notinst_path="$notinst_path $dir" fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. -model) compile_command="$compile_command $arg" compiler_flags="$compiler_flags $arg" finalize_command="$finalize_command $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) compiler_flags="$compiler_flags $arg" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -module) module=yes continue ;; # -64, -mips[0-9] enable 64-bit mode on the SGI compiler # -r[0-9][0-9]* specifies the processor on the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler # +DA*, +DD* enable 64-bit mode on the HP compiler # -q* pass through compiler args for the IBM compiler # -m* pass through architecture-specific compiler args for GCC # -m*, -t[45]*, -txscale* pass through architecture-specific # compiler args for GCC # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC # -F/path gives path to uninstalled frameworks, gcc on darwin # @file GCC response files -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" compiler_flags="$compiler_flags $arg" continue ;; -shrext) prev=shrext continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then exit $exit_status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) duplicate_compiler_generated_deps=$duplicate_deps ;; esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit $EXIT_FAILURE ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else compiler_flags="$compiler_flags $deplib" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit $EXIT_FAILURE fi continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $absdir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes ; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on # some systems (darwin) if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added if /usr/bin/file -L $add 2> /dev/null | $EGREP ": [^:]* bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" else add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi #if test "$absdir" != "$libdir"; then # $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 #fi path="$absdir" fi depdepl= case $host in *-*-darwin*) # we do not want to link against static libs, # but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$deplibdir/$depdepl" ; then depdepl="$deplibdir/$depdepl" elif test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" else # Can't find it, oh well... depdepl= fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; *) newlib_search_path="$newlib_search_path $path";; esac fi path="" ;; *) path="-L$path" ;; esac ;; -l*) case $host in *-*-darwin*) # Again, we only want to link against shared libraries eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` for tmp in $newlib_search_path ; do if test -f "$tmp/lib$tmp_libs.dylib" ; then eval depdepl="$tmp/lib$tmp_libs.dylib" break fi done path="" ;; *) continue ;; esac ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) case " $deplibs" in *\ -l* | *\ -L*) $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;; esac if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit $EXIT_FAILURE else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows|none) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; then major=`expr $current - $age` else major=`expr $current - $age + 1` fi case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name=`expr $a_deplib : '-l\(.*\)'` # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then case $archive_cmds in *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; esac else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output output_la=`$echo "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadable object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then $show "${rm}r $gentop" $run ${rm}r "$gentop" fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) case " $deplibs" in *\ -l* | *\ -L*) $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;; esac if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) new_libs="$new_libs -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$new_libs $deplib" ;; esac ;; *) new_libs="$new_libs $deplib" ;; esac done compile_deplibs="$new_libs" compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; *) dllsearchpath="$dllsearchpath:$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac else $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* ) $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ " case $host in *cygwin* | *mingw* ) $echo >> "$output_objdir/$dlsyms" "\ /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs */ struct { " ;; * ) $echo >> "$output_objdir/$dlsyms" "\ const struct { " ;; esac $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. case $host in *cygwin* | *mingw* ) if test -f "$output_objdir/${outputname}.def" ; then compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` else compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` fi ;; * ) compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` ;; esac ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit $EXIT_FAILURE ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" exit_status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $exit_status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) output_name=`basename $output` output_path=`dirname $output` cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) /* -DDEBUG is fairly common in CFLAGS. */ #undef DEBUG #if defined DEBUGWRAPPER # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) #else # define DEBUG(format, ...) #endif const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); const char * base_name (const char *name); char * find_executable(const char *wrapper); int check_executable(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup (base_name (argv[0])); DEBUG("(main) argv[0] : %s\n",argv[0]); DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = find_executable(argv[0]); if (newargz[1] == NULL) lt_fatal("Couldn't find %s", argv[0]); DEBUG("(main) found exe at : %s\n",newargz[1]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; for (i=0; i> $cwrappersource <> $cwrappersource <> $cwrappersource <<"EOF" return 127; } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } const char * base_name (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha ((unsigned char)name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return base; } int check_executable(const char * path) { struct stat st; DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); if ((!path) || (!*path)) return 0; if ((stat (path, &st) >= 0) && ( /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ #if defined (S_IXOTH) ((st.st_mode & S_IXOTH) == S_IXOTH) || #endif #if defined (S_IXGRP) ((st.st_mode & S_IXGRP) == S_IXGRP) || #endif ((st.st_mode & S_IXUSR) == S_IXUSR)) ) return 1; else return 0; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise */ char * find_executable (const char* wrapper) { int has_slash = 0; const char* p; const char* p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char* concat_name; DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char* path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char* q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR(*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable(concat_name)) return concat_name; XFREE(concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); tmp_len = strlen(tmp); concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable(concat_name)) return concat_name; XFREE(concat_name); return NULL; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \$*\" exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else $echo "copying selected object files to avoid basename conflicts..." if test -z "$gentop"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" $show "${rm}r $gentop" $run ${rm}r "$gentop" $show "$mkdir $gentop" $run $mkdir "$gentop" exit_status=$? if test "$exit_status" -ne 0 && test ! -d "$gentop"; then exit $exit_status fi fi save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase counter=`expr $counter + 1` case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" $run ln "$obj" "$gentop/$newobj" || $run cp "$obj" "$gentop/$newobj" oldobjs="$oldobjs $gentop/$newobj" ;; *) oldobjs="$oldobjs $obj" ;; esac done fi eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) case " $install_prog " in *[\\\ /]cp\ *) ;; *) prev=$arg ;; esac ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` else relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit $EXIT_FAILURE fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' fi exit $lt_exit } done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit $EXIT_FAILURE fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # Note that it is not necessary on cygwin/mingw to append a dot to # foo even if both foo and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. # # If there is no directory component, then add one. case $wrapper in */* | *\\*) . ${wrapper} ;; *) . ./${wrapper} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir=`func_mktempdir` file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS $echo "X----------------------------------------------------------------------" | $Xsed $echo "Libraries have been installed in:" for libdir in $libdirs; do $echo " $libdir" done $echo $echo "If you ever happen to want to link against installed libraries" $echo "in a given directory, LIBDIR, you must either use libtool, and" $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" $echo " during execution" fi if test -n "$runpath_var"; then $echo " - add LIBDIR to the \`$runpath_var' environment variable" $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi $echo $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "X----------------------------------------------------------------------" | $Xsed exit $EXIT_SUCCESS ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else if test ! -f "$dir/$dlname"; then $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit $EXIT_FAILURE fi fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" case "$mode" in clean) case " $library_names " in # " " in the beginning catches empty $dlname *" $dlname "*) ;; *) rmfiles="$rmfiles $objdir/$dlname" ;; esac test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit $EXIT_FAILURE fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit $EXIT_SUCCESS ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared disable_libs=shared # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static disable_libs=static # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: darkice-1.0/acinclude.m40000644000175000001440000002666211217323507012077 00000000000000dnl acinclude.m4. Change *this* file to add new or change macros. dnl When changes have been made, delete aclocal.m4 and run dnl "aclocal". dnl dnl DO NOT change aclocal.m4 ! dnl dnl----------------------------------------------------------------------------- dnl LA_SEARCH_FILE(variable, filename, PATH) dnl Search "filename" in the specified "PATH", "variable" will dnl contain the full pathname or the empty string dnl PATH is space-separated list of directories. dnl by Florian Bomers dnl----------------------------------------------------------------------------- AC_DEFUN([LA_SEARCH_FILE],[ $1= dnl hack: eliminate line feeds in $2 for FILE in $2; do for DIR in $3; do dnl use PATH in order if test ".$1"="." && test -f "$DIR/$FILE"; then $1=$DIR fi done done ]) dnl----------------------------------------------------------------------------- dnl LA_SEARCH_LIB(lib-variable, include-variable, lib-filename, header-filename, prefix) dnl looks for "lib-filename" and "header-filename" in the area of "prefix". dnl if found, "lib-variable" and "include-variable" are set to the dnl respective paths. dnl prefix is a single path dnl libs are searched in prefix, prefix/lib dnl headers are searched in prefix, prefix/include, dnl dnl If one of them is not found, both "lib-variable", "include-variable" are dnl set to the empty string. dnl dnl TODO: assert function call to verify lib dnl dnl by Florian Bomers dnl----------------------------------------------------------------------------- AC_DEFUN([LA_SEARCH_LIB],[ dnl look for lib LA_SEARCH_FILE($1, $3, $5 $5/lib64 $5/lib ) dnl look for header. LA_SEARCH_FILE($2, $4, $5 $5/include ) if test ".$1" = "." || test ".$2" = "."; then $1= $2= fi ]) dnl----------------------------------------------------------------------------- dnl funky posix threads checking, thanks to dnl Steven G. Johnson dnl and Alejandro Forero Cuervo dnl see http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html dnl----------------------------------------------------------------------------- dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) dnl dnl This macro figures out how to build C programs using POSIX dnl threads. It sets the PTHREAD_LIBS output variable to the threads dnl library and linker flags, and the PTHREAD_CFLAGS output variable dnl to any special C compiler flags that are needed. (The user can also dnl force certain compiler flags/libs to be tested by setting these dnl environment variables.) dnl dnl Also sets PTHREAD_CC to any special C compiler that is needed for dnl multi-threaded programs (defaults to the value of CC otherwise). dnl (This is necessary on AIX to use the special cc_r compiler alias.) dnl dnl NOTE: You are assumed to not only compile your program with these dnl flags, but also link it with them as well. e.g. you should link dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS dnl dnl If you are only building threads programs, you may wish to dnl use these variables in your default LIBS, CFLAGS, and CC: dnl dnl LIBS="$PTHREAD_LIBS $LIBS" dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" dnl CC="$PTHREAD_CC" dnl dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE dnl to that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). dnl dnl ACTION-IF-FOUND is a list of shell commands to run if a threads dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands dnl to run it if it is not found. If ACTION-IF-FOUND is not specified, dnl the default action will define HAVE_PTHREAD. dnl dnl Please let the authors know if this macro fails on any platform, dnl or if you have any other suggestions or comments. This macro was dnl based on work by SGJ on autoconf scripts for FFTW (www.fftw.org) dnl (with help from M. Frigo), as well as ac_pthread and hb_pthread dnl macros posted by AFC to the autoconf macro repository. We are also dnl grateful for the helpful feedback of numerous users. dnl dnl @version $Id: acinclude.m4 400 2007-02-25 17:04:17Z darkeye $ dnl @author Steven G. Johnson and Alejandro Forero Cuervo AC_DEFUN([ACX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_SAVE AC_LANG_C acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) AC_MSG_RESULT($acx_pthread_ok) if test x"$acx_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all. acx_pthread_flags="pthread-config pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthread-config: use pthread-config program (on NetBSD) # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # pthread: Linux, etcetera # --thread-safe: KAI C++ case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthread or # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" ;; esac if test x"$acx_pthread_ok" = xno; then for flag in $acx_pthread_flags; do case $flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; -*) AC_MSG_CHECKING([whether pthreads work with $flag]) PTHREAD_CFLAGS="$flag" ;; pthread-config) AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) if test x"$acx_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) AC_MSG_CHECKING([for the pthreads library -l$flag]) PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. AC_TRY_LINK([#include ], [pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], [acx_pthread_ok=yes]) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" AC_MSG_RESULT($acx_pthread_ok) if test "x$acx_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$acx_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: threads are created detached by default # and the JOINABLE attribute has a nonstandard name (UNDETACHED). AC_MSG_CHECKING([for joinable pthread attribute]) AC_TRY_LINK([#include ], [int attr=PTHREAD_CREATE_JOINABLE;], ok=PTHREAD_CREATE_JOINABLE, ok=unknown) if test x"$ok" = xunknown; then AC_TRY_LINK([#include ], [int attr=PTHREAD_CREATE_UNDETACHED;], ok=PTHREAD_CREATE_UNDETACHED, ok=unknown) fi if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok, [Define to the necessary symbol if this constant uses a non-standard name on your system.]) fi AC_MSG_RESULT(${ok}) if test x"$ok" = xunknown; then AC_MSG_WARN([we do not know how to create joinable pthreads]) fi AC_MSG_CHECKING([if more special flags are required for pthreads]) flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac AC_MSG_RESULT(${flag}) if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with cc_r AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) else PTHREAD_CC="$CC" fi AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(PTHREAD_CC) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) : else acx_pthread_ok=no $2 fi AC_LANG_RESTORE ])dnl ACX_PTHREAD darkice-1.0/config.guess0000755000175000001440000012751611371632436012233 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. timestamp='2008-01-08' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: darkice-1.0/mkinstalldirs0000755000175000001440000000664711371632436012522 00000000000000#! /bin/sh # mkinstalldirs --- make directory hierarchy scriptversion=2006-05-11.19 # Original author: Noah Friedman # Created: 1993-05-16 # Public domain. # # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' IFS=" "" $nl" errstatus=0 dirmode= usage="\ Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... Create each directory DIR (with mode MODE, if specified), including all leading file name components. Report bugs to ." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" exit $? ;; -m) # -m PERM arg shift test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } dirmode=$1 shift ;; --version) echo "$0 $scriptversion" exit $? ;; --) # stop option processing shift break ;; -*) # unknown option echo "$usage" 1>&2 exit 1 ;; *) # first non-opt arg break ;; esac done for file do if test -d "$file"; then shift else break fi done case $# in 0) exit 0 ;; esac # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and # mkdir -p a/c at the same time, both will detect that a is missing, # one will create a, then the other will try to create a and die with # a "File exists" error. This is a problem when calling mkinstalldirs # from a parallel make. We use --version in the probe to restrict # ourselves to GNU mkdir, which is thread-safe. case $dirmode in '') if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -p -- $*" exec 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. test -d ./-p && rmdir ./-p test -d ./--version && rmdir ./--version fi ;; *) if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" else # Clean up after NextStep and OpenStep mkdir. for d in ./-m ./-p ./--version "./$dirmode"; do test -d $d && rmdir $d done fi ;; esac for file do case $file in /*) pathcomp=/ ;; *) pathcomp= ;; esac oIFS=$IFS IFS=/ set fnord $file shift IFS=$oIFS for d do test "x$d" = x && continue pathcomp=$pathcomp$d case $pathcomp in -*) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr else if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" lasterr= chmod "$dirmode" "$pathcomp" || lasterr=$? if test ! -z "$lasterr"; then errstatus=$lasterr fi fi fi fi pathcomp=$pathcomp/ done done exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: